📒 

Chocolatey is a powerful package manager for Windows, designed to make software management simple and efficient. It allows you to install, update, and manage thousands of software packages from a central repository with just a few commands. Whether you’re managing a Windows-based server or a desktop, Chocolatey is an essential tool for automating software installation, especially on Windows servers hosted by AlexHost.

In this guide, we’ll walk you through the step-by-step process to install Chocolatey on your Windows server or local machine.


Why Use Chocolatey?

Chocolatey simplifies the process of software management by:

  • Automating software installations with a single command.
  • Keeping your software up to date with minimal effort.
  • Offering access to over 9,000 packages for a wide range of tools and applications.
  • Streamlining the process of software management across multiple systems.

When managing servers with AlexHost, Chocolatey can save time and reduce the complexity of software setup and maintenance.


Step 1: Ensure You Have Administrator Privileges

To install Chocolatey, you need to run the setup as an administrator. This ensures that Chocolatey has the necessary permissions to install packages and make system-wide changes.

  1. Open PowerShell as Administrator:
    • Press Win + X and choose Windows PowerShell (Admin) or search for PowerShell in the Start menu, right-click it, and select Run as Administrator.

    Make sure the PowerShell window shows Administrator in the title, indicating it has elevated permissions.


Step 2: Set PowerShell Execution Policy

Chocolatey requires the ability to run scripts on your system. To do this, you need to set the PowerShell execution policy.

  1. In the Administrator PowerShell window, enter the following command:
    powershell
    Set-ExecutionPolicy Bypass -Scope Process
  2. Press Enter. You may be prompted to confirm the change; if so, type Y and press Enter again.

This command allows the installation script to run without modifying your system-wide policy.


Step 3: Install Chocolatey

Once the execution policy is set, you can install Chocolatey by running a simple command in PowerShell.

  1. Copy and paste the following script into the PowerShell window:
    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'))
  2. Press Enter to execute the command.

The script will download and install Chocolatey on your system. The process typically takes a few moments, depending on your server’s internet connection.


Step 4: Verify the Installation

After the installation is complete, you can verify that Chocolatey was installed correctly by checking the version.

  1. In the same PowerShell window, type the following command:
    choco --version
  2. Press Enter. If Chocolatey was installed successfully, this command will return the installed version number.

Step 5: Install Software with Chocolatey

Now that Chocolatey is installed, you can use it to install software on your Windows server. For example, to install Git, simply run the following command:

choco install git -y

The -y flag automatically agrees to all prompts, making the process seamless.

You can search for other software packages by using the following command:

choco search <package-name>

For example, to search for Node.js:

choco search nodejs

This command will show a list of related packages available for installation.


Step 6: Keep Your Software Updated

One of the biggest advantages of Chocolatey is that it simplifies updating software across your system. To update all installed packages, run the following command:

choco upgrade all -y

This will ensure that all your installed packages are up to date.


Conclusion

Chocolatey is a must-have tool for system administrators, especially when managing Windows servers from AlexHost. It automates the process of installing and updating software, saving time and effort. By following this step-by-step guide, you’ve successfully installed Chocolatey on your Windows server and can now manage software packages with ease. For more efficient and powerful server management, Chocolatey is a valuable addition to your toolkit.