Set up HomeBrew on AlmaLinux 9 | Easy Package Manager
This guide will teach you how to Set up HomeBrew on AlmaLinux 9. Homebrew, often called Brew, is a free and open-source software package manager that streamlines the installation of software on macOS and Linux operating systems.
Essentially, a package manager’s role is to locate and install the necessary software packages that allow you to compile and run various applications on your specific operating system. A package manager, like Homebrew, automates much of the tedious and time-consuming work that you would otherwise have to perform manually. This makes software management significantly easier. Let’s learn how to Set up HomeBrew on AlmaLinux 9.
You can follow the steps below to install the Brew package manager on AlmaLinux 9.
Before proceeding, ensure you are logged into your server as a non-root user with sudo privileges. If you haven’t already, refer to a guide on initial server setup with AlmaLinux 9 for instructions on creating such a user.
1. Install Brew Package Manager on AlmaLinux 9
First, update your local package index using the following command:
sudo dnf update -y
Next, install Git on your server using the following command:
sudo dnf install git -y
Finally, install the Development Tools on your server with the command below:
sudo dnf groupinstall 'Development Tools' -y
2. Download HomeBrew Installer Script
Now, download the HomeBrew installer script on AlmaLinux 9 using the curl
command:
/bin/bash -c "$(sudo curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This command will take some time to complete.
3. Add Brew to System Path
Once the Brew installation on AlmaLinux 9 is complete, you need to add the Brew command to your system’s PATH environment variable. This allows you to run brew
commands from any directory in your terminal. Execute the following commands:
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/<your_username>/.bash_profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
Important: Replace <your_username>
with your actual username on the system.
The eval
command executes the output of the command within the double quotes as a shell command.
4. Start Brew on AlmaLinux 9
Now, run brew help
to get started with Homebrew on AlmaLinux 9:
brew help
This command displays a list of available Brew commands and their descriptions.

To verify that Homebrew is working correctly on AlmaLinux 9, run the following command:
brew doctor

For more information, visit the Homebrew documentation page.
5. Uninstall HomeBrew on AlmaLinux 9
To uninstall Homebrew from your server, download the "uninstall" script to your server and run it:
curl -fsSL -o uninstall.sh https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh
After reviewing the script contents, run this script to uninstall Homebrew:
bash uninstall.sh
Conclusion
At this point, you have learned how to Set up HomeBrew on AlmaLinux 9. Homebrew simplifies package management by allowing easy installation of software not included in AlmaLinux repositories. It also provides up-to-date and user-friendly tools for developers and system administrators.
Hope you enjoyed it. You may also be interested in these articles:
Install Rust Programming Language on AlmaLinux 9
How To Install Yarn on Rocky Linux 8
Upgrade Linux Kernel on AlmaLinux 8
Best Linux Desktop Distros for Teams to Access Remotely
Install Python 3.13 on AlmaLinux
FAQs
What is Homebrew?
Homebrew is a package manager that simplifies software installation on Linux and macOS.
Why use Homebrew instead of dnf?
Homebrew provides newer versions of software and packages that may not be available in the default AlmaLinux repositories.
Where does Homebrew install packages?
By default, it installs packages in the /home/linuxbrew/.linuxbrew/
.
How do I update Homebrew and installed packages?
You can use the commands below: brew update && brew upgrade
Alternative Solutions to Package Management on AlmaLinux 9
While Homebrew offers a convenient way to manage packages on AlmaLinux 9, other options exist. Here are two alternatives: using dnf
with alternative repositories and using Flatpak.
1. Using dnf
with Alternative Repositories (e.g., EPEL)
The default AlmaLinux repositories don’t always contain the latest versions of software. However, you can expand the available packages by enabling third-party repositories like EPEL (Extra Packages for Enterprise Linux). EPEL is a community-maintained repository that provides a wide range of additional packages for Red Hat-based distributions, including AlmaLinux.
Explanation:
dnf
is the default package manager for AlmaLinux. By adding EPEL, you’re essentially telling dnf
to look in another source for software. This approach leverages the existing package management infrastructure of AlmaLinux, making it a relatively straightforward solution.
Steps:
-
Install the EPEL release package:
sudo dnf install epel-release -y
-
Verify the EPEL repository is enabled:
sudo dnf repolist enabled
This command will list all enabled repositories, and you should see
epel
in the list. -
Search for and install packages using
dnf
:Now that EPEL is enabled, you can use
dnf
to search for and install packages from the EPEL repository. For example, to install theripgrep
tool, you would run:sudo dnf install ripgrep -y
Advantages:
- Leverages the native package manager (
dnf
). - Packages are generally well-integrated with the system.
- Easy to manage updates through
dnf update
.
Disadvantages:
- EPEL may not always have the very latest versions of software.
- Requires trusting a third-party repository.
2. Using Flatpak
Flatpak is a universal package manager that allows you to install applications from a variety of sources, independent of your Linux distribution. It packages applications with all their dependencies, ensuring that they run consistently across different systems. This approach offers a level of isolation and portability not found with traditional package managers.
Explanation:
Flatpak creates a sandbox for each application, isolating it from the rest of the system. This prevents conflicts between different applications and ensures that they run in a consistent environment. Flatpak applications are often larger than those installed with dnf
or Homebrew due to the included dependencies.
Steps:
-
Install Flatpak:
sudo dnf install flatpak -y
-
Add the Flathub repository (a popular source for Flatpak applications):
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
-
Search for and install applications using Flatpak:
To search for an application, use the
flatpak search
command:flatpak search <application_name>
For example, to search for the "LibreOffice" suite, you would run:
flatpak search LibreOffice
To install an application, use the
flatpak install
command, followed by the application ID (which you can find in the search results):flatpak install flathub org.libreoffice.LibreOffice
-
Run Flatpak applications:
Flatpak applications can be run using the
flatpak run
command, followed by the application ID:flatpak run org.libreoffice.LibreOffice
Advantages:
- Provides a consistent environment for applications, regardless of the underlying distribution.
- Applications are isolated from the rest of the system, preventing conflicts.
- Offers a wide range of applications from various sources.
Disadvantages:
- Flatpak applications can be larger than those installed with traditional package managers.
- Requires installing and configuring Flatpak.
- Applications may not be as tightly integrated with the system as native packages.
Ultimately, the best package management solution for you depends on your specific needs and preferences. Homebrew, dnf
with alternative repositories, and Flatpak all offer different advantages and disadvantages. Consider the factors outlined above to choose the option that best suits your workflow. The ability to Set up HomeBrew on AlmaLinux 9 is a great option, but understanding alternatives is key.