Search This Blog

2025/03/07

Automating installation of MS-Window Application Packages using Chocolatey

What is Package Manager?
    A Package Manager is a tool that helps you install, update, configure, and remove software
    in a consistent and automated way. Instead of manually downloading and installing software
    from websites, a package manager simplifies the process with a single command.
   
Why To Use a Package Manager?
    a)Saves Time – No need to manually search, download, and install software.
    b)Automates Updates – Keeps software up-to-date automatically.
    c)Manages Dependencies – Ensures required components are installed.
    e)Uninstalls Cleanly – Removes software and its related files properly.
    f)Works in Scripts – Great for IT automation and DevOps.


What is Chocolatey - Windows Package Manager?
    Chocolatey is a powerful package manager for Windows, similar to apt (Ubuntu) or brew (macOS).
    It automates software installation, updates, and management using simple PowerShell commands.

1. Installing Chocolatey
    Chocolatey requires Powershell (Admin) and .NET Framework 4+. To install it, follow these steps:

    Step 1: Open Powershell as Administrator
        Press Win + X → Click Powershell (Admin) or Terminal (Admin).

    Step 2: Run the Install Command

        Powershell Command:

            Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
            This will download and install Chocolatey.

    Step 3: Verify Installation
            Close and reopen Powershell, then run:

        Powershell Command:
            choco --version
            If Chocolatey is installed correctly, you’ll see its version number.

    Step 4: Using Chocolatey To Install a Package
        To install software (e.g., Google Chrome), run:
            Powershell  Command:
                choco install googlechrome -y
                (-y automatically agrees to prompts.)

        To Update a Package run:

            Powershell  Command:
                choco upgrade googlechrome -y
           
        To Uninstall a Package run:

            Powershell  Command:
                choco uninstall googlechrome -y
               
        To Search for a Package

            Powershell  Command:
                choco search notepad++
               
        To List Installed Packages

            Powershell  Command:
                choco list --localonly
               
        To Install Multiple Packages at Once

            Powershell  Command:
                choco install vscode git nodejs -y
               
        To Update All Installed Packages

            Powershell  Command:
                choco upgrade all -y

2. Uninstalling Chocolatey          
    To Uninstall Chocolatey (If Needed)

        Powershell  Command:
                choco uninstall chocolatey
               
    Then, manually delete the C:\ProgramData\chocolatey folder.

Why Use Chocolatey?
    a)Automates software installation & updates
    b)Installs software with one command
    c)Manages dependencies
    d)Works well with Powershell and Windows
   
Is Chocolatey Cross-Platform?
    Chocolatey is not cross-platform—it is specifically designed for Windows.
    It relies on Windows-specific technologies like PowerShell, Windows Installer (MSI),
    and the Windows Registry, making it incompatible with Linux or macOS.

    Cross-Platform Alternatives to Chocolatey
    If you need a package manager for other operating systems, here are some alternatives:

    For Windows, macOS, and Linux:
        a)Winget (Windows 10/11's built-in package manager)
        b)Scoop (Windows alternative to Chocolatey, simpler and more developer-focused)
        c)Ninite (Windows, but limited compared to Chocolatey)
       
    For macOS:
        a)Homebrew → The most popular package manager for macOS
            sh Command:
                /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
           
        b)MacPorts → Another option, but Homebrew is more common

    For Linux:
        a)APT (Debian/Ubuntu) → sudo apt install <package>
        b)DNF/YUM (Fedora, RHEL) → sudo dnf install <package>
        c)Pacman (Arch Linux) → sudo pacman -S <package>


Process has been practically validated for on MS-Window 11 for Chocolatey Package Manager.




No comments:

Post a Comment