Monday, July 16, 2007

A Lesson in AUR

So, after using Arch for a couple of months, I've gained some valuable knowledge that might be of some use for someone new to or interested in Arch. After getting most of what I needed for a suitable system from Arch's repos, I decided to expand my horizons a bit and try installing some packages from the Arch User Repository or AUR. There are lots of packages available in the AUR. Most of them aren't what you'd consider required packages but rather ancillary programs that are nice to have around for convenience's sake.

Here's a list of just some of the apps I installed from the AUR:
Cairo Clock
As you can see, most of these programs aren't required for most users, with the possible exception of Skype, but they are nice to have around. If these programs, or another you've found by searching the AUR, are interesting to you I'll give you some tips on how to use the AUR. Keep in mind that the following aren't official directions (consult the many Arch Wiki entries for that), simply a collection of observations I've picked up by working my way through the AUR.

The first thing you'll want to do is enable the community repository in /etc/pacman.conf. This is a very simple step, just uncomment the entry for it. Then you'll want to install some tools that you'll need to create a suitable package for your system based on the tarball that's available in the AUR. Use pacman to install makepkg, fakeroot and versionpkg. You may also need subversion if you plan on installing things with svn.

Now that you've got the tools, go to the AUR's website and find the package that you'd like to install. Download the tarball and copy it to /var/abs/local. This will be your working directory for most AUR-related operations. You can also use ~/builds if you'd like but I like to keep /home separated from everything else whenever I can. You can use it if you'd like, it will prevent some annoying permissions problems when installing things.

The next step is to extract the package which will creaet a new directory that you will then "cd" into. Once there, check the PKGBUILD file for any malicious commands. If anything looks suspicious, DO NOT proceed. If everything's copasetic, then create a package for pacman to install by running makepkg. If successful, this will create a .pkg.tar.gz file that can then be instaleld by running:
#pacman -U package_name.pkg.tar.gz
Then, the program can be run just like any other. In fact, in most cases, if you're using Gnome, an entry will automatically be made to the menu. Basically, if makepkg doesn't fail, you're set. In some cases (if you're using an i686 processor), you'll get an error, something about an architecture not being described. If you get that, simply add a line to the PKGBUILD file that looks like this: "arch=('i686')".

This is the standard practice for installing packages from the AUR but if you are looking for a more streamlined approach you may want to try aurbuild. aurbuild is a tool that will essentially perform all of the steps described above for you. You can install it from the AUR with the method I described above and then install packages from the AUR with:
#aurbuild -sa package_name
You should read the man page on aurbuild to understand all of the command line options but that is the generic command to install something.

I should mention that I've only had about a 80% success rate when trying to install something from the AUR. I sometimes get an obscure error message that leaves me a little unsure of what to do next. Even when I install something successfully, I still have problems trying to run it. I've had a few segmentation faults which I don't really feel like sorting through. I had enough of debugging seg faults in college; it's not something I enjoy doing.
Anyways, I hope you've learned a little bit about arch and a little bit about the AUR from this article, at least enough so that you could install something from there if you so desired. Good luck.