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, LinuxBrew is a Linux fork of the popular macOS HomeBrew package manager. LinuxBrew is package-management software, which enables installing packages from source, on top of the system’s default package manager.

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 through 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.

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 gi

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 installed 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, 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!