Intro

LinuxBrew is a Linux-fork of the popular Mac OS X HomeBrew package manager.

LinuxBrew is package-management-software, which enables installing packages from source, on top on the system’s default package management (e.g. “apt/deb” in Debian/Ubuntu and “yum/rpm” in CentOS/RedHat).

Preparing for LinuxBrew – Debian/Ubuntu

For Debian/Ubuntu-based systems, run the following commands:

$ sudo apt-get update
$ sudo apt-get upgrade -y
$ sudo sudo apt-get install -y build-essential make cmake scons curl git \
                               ruby autoconf automake autoconf-archive \
                               gettext libtool flex bison \
                               libbz2-dev libcurl4-openssl-dev \
                               libexpat-dev libncurses-dev

Installing LinuxBrew

Step 1 – Clone LinuxBrew

To keep things tidy, clone LinuxBrew into a hidden directory in the user’s home directory:

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

Step 2 – Update environment variables

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

Step 3 – Test installation

To ensure those changes take effect, log-out and log-in again. The shell should then use these new settings.

To test these new settings, try:

$ which brew
/home/ubuntu/.linuxbrew/bin/brew
$ echo $PKG_CONFIG_PATH
/home/ubuntu/.linuxbrew/lib64/pkgconfig:/home/ubuntu/.linuxbrew/lib/pkgconfig:/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:

Install a package

To install a package, run brew install PACKAGE.

Example: brew install hello

The output should be appeared as below:

ubuntu@ubuntu:~$ brew install hello
Updating Homebrew...
==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
 https://docs.brew.sh/Analytics.html

==> Installing dependencies for hello: patchelf
==> Installing hello dependency: patchelf
==> Downloading https://linuxbrew.bintray.com/bottles/patchelf-0.9_1.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring patchelf-0.9_1.x86_64_linux.bottle.tar.gz
🍺 /home/ubuntu/.linuxbrew/Cellar/patchelf/0.9_1: 6 files, 1.2MB
==> Installing hello
==> Downloading https://linuxbrew.bintray.com/bottles/hello-2.10.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring hello-2.10.x86_64_linux.bottle.tar.gz
🍺 /home/ubuntu/.linuxbrew/Cellar/hello/2.10: 52 files, 595.5KB

 

Advertisements