Install Software in Arch Linux from Source, using AUR or ABS

Written by
Date: 2012-02-22 16:00:00 00:00

I really like Arch Linux a lot, it is my favorite distribution, one thing I like a lot, is how easy is to install software from sources, and configure it to fit your needs.

We will see two ways of doing that, the first one is when the software is available in the official Arch Linux repositories. The second is when the software is not in the official Arch Linux repositories.

For the first one we will use ABS (Arch Build System) and for the second we will use AUR (Arch User Repository).

Let's start with the needed packages for both methods, so open a console and be sure you have an up to date system

pacman -Syu

Then install these software pieces

pacman -S base-devel sudo

Now we are ready to start

ABS (Arch Build System)

First thing is to install ABS

pacman -S abs

Then populate your disk

abs

Wait a little as this step may take some time, depending on your internet connection. Now create a folder to build your software, let's name it build, logged as your user, not as root run:

mkdir ~/build

Now enter your newly created folder

cd ~/build

And copy there the contents of the application you would like to build, let's say nginx

cp -r /var/abs/community/nginx .

Enter the nginx folder, and build the software

cd nginx && makepkg -s

You may have to enter your password, once finished you will be able to install the software with:

sudo pacman -U nginx-XXXXX.pkg.tar.xz

AUR (Arch User Repository)

Now let's check out how to install software using the Arch User Repository or AUR. The steps are almost the same:

First go to the AUR page and look for the software you want to install. Let's say jekyll, now you can download the tarbal file, and copy it in your ~/build folder. So continuing with our example:

cd ~/build && wget https://aur.archlinux.org/packages/ru/ruby-jekyll/ruby-jekyll.tar.gz

De-compress the file.

tar xvzf ruby-jekyll.tar.gz

Enter in the newly created folder

cd ruby-jekyll

And build the program

makepkg -s

If you have all the dependencies installed, you will end up with a package to install, just like in the above example. If not, pacman will try to install them for you, if they are not in the official repository, you will end up with an error like this: ==> ERROR: 'pacman' failed to install missing dependencies. In the case of this example, I had to install firs using the same system (AUR) ruby-albino, ruby-posix-spawn, ruby-classifier, ruby-fast-stemmer, ruby-directory_watcher, ruby-kramdown-last, ruby-liquid, ruby-maruku, ruby-syntax and ruby-redcloth, before I can actually install jekyll. I know the official way to install jekyll is not this one, but I'm using it just as an example.

Once you have all that satisfied, you can actually install the program

sudo pacman -U ruby-jekyll-0.11.2-1-any.pkg.tar.xz

I hope you may find this tutorial, useful. and with no intention, I'm also showing you how to install jekyll in Arch Linux, the Arch Linux way :).