×
< BLOG
Hardware & Software

Build AUR Packages in Arch Linux with makepkg or yaourt

July 14, 2015

Guest Author

Arch Linux presents unending learning opportunities for the novice and intermediate Linux users. A simple challenge for the beginner involves building packages from the Arch User Repository (AUR). This knowledge becomes useful when you realize Netflix isn’t possible without Google Chrome.

When working in an Arch enviroment, not every software packages you desire is accessible through the official respositories with the plug and press play command-line “pacman -S packagename” statement. By the conclusion of this quick run through, you’ll see that there’s really not much that goes into building packages. Package management is covered is taught in our CompTIA Linux+ and Red Hat Enterprise Linux courses.

When building a package (.tar, rpm), it’s a very succint process most of the time.

Download the tarball from the AUR

AUR packages google-chrome

In the terminal, change into the correct directory where the .tar package sits. Then go ahead and unpack it with:

tar -xf packagename

For the true command-line noobs, those who may not necessarily belong in the Arch world yet, pressing tab after beginning to type a package name completes the statement. This saves considerable time.

Change Package Permissions with Chmod

You must change the folder permissions of the unpacked package to excecute the next operation. Therefore, unlock the folder with:

chmod user=permissions((r)read, (w)write, or (e)execute) packagename

Refer to the “Changing Permissions Using chmod Command” section on the Arch Wiki page for further explanation. The options for users are:

  • u – user who owns said file
  • g – group
  • o – all others
  • a – all of the above

As you can see above, use the letters r, w, or x, or a combination or all of them to specify the new permissions. Remember to use sudo when using the chmod command.

Build the package with makepkg

The makepkg utility is a script that performs an automatic build of a package for pacman to install. You may need to install the makepkg package with pacman beforehand. To work, makepkg needs a package with a PKGBUILD. After changing permissions, then change directories into the package folder to run makepkg to build and install the package with:

makepkg -csi packagename

The “c” options cleans out leftover files. The “s” option installs necessary dependencies. The “i” option installs the built package with pacman.

Simplify the process with yaourt

Yet Another User Repository Tool (yaourt) is a frontend for pacman to automate the previously described process for building and installing AUR packages. Instead of using makepkg, as outlined above, use the yaourt command:

yaourt packagename

aur packages

The yaourt tool queries the AUR for related packages and lists all available options. Then you can proceed forward by selecting the option and it walks you through the package build and installation. However, to use yaourt, you need to download package-query and yaourt packages from source and build them with makepkg.

subscribe by email

Stay Ahead