LinuxTutorialsUbuntu

How To Install Homebrew on Ubuntu 18.04 LTS

Install Homebrew on Ubuntu 18.04

In this tutorial, we will show you how to install Homebrew on Ubuntu 18.04 LTS. For those of you who didn’t know, Homebrew, often referred to as “Brew,” is a powerful package manager that simplifies the installation, update, and management of software on macOS and Linux systems. Originally developed for macOS, Homebrew has been extended to Linux, offering a wide range of packages and the flexibility to install software beyond the offerings of native package managers like APT.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Homebrew on an Ubuntu 18.04 (Bionic Beaver). You can follow the same instructions for Ubuntu 16.04 and any other Debian-based distribution like Linux Mint.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 18.04 (Bionic Beaver) or Debian-based.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Homebrew.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Homebrew on Ubuntu 18.04 LTS

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade
sudo apt install build-essential curl file git

Step 2. Installing Homebrew on Ubuntu 18.04.

Clone LinuxBrew into a hidden directory in the user’s home directory:

git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew

The next step is to add LinuxBrew to the user’s environment variables, Add the following lines to the end of the user’s ~/.bashrc file:

# Until LinuxBrew is fixed, the following is required.
# See: https://github.com/Homebrew/linuxbrew/issues/47
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH
## Setup linux brew
export LINUXBREWHOME=$HOME/.linuxbrew
export PATH=$LINUXBREWHOME/bin:$PATH
export MANPATH=$LINUXBREWHOME/man:$MANPATH
export PKG_CONFIG_PATH=$LINUXBREWHOME/lib64/pkgconfig:$LINUXBREWHOME/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$LINUXBREWHOME/lib64:$LINUXBREWHOME/lib:$LD_LIBRARY_PATH

*NOTE: If you installed LinuxBrew to a different directory, change the path in LINUXBREWHOME above.

Step 3. Testing Homebrew on Linux.

After installing the LinuxBrew package manager on your Ubuntu Linux, you can try to install a package with LinuxBrew. If you want to install a package, you just need to run the following command:

brew install PackageName

For example, if you want to install a package named hello, just type the following command:

brew install hello

Congratulations! You have successfully installed Homebrew. Thanks for using this tutorial for installing Homebrew on Ubuntu 18.04 LTS Bionic Beaver system. For additional help or useful information, we recommend you to check the official Homebrew website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button