How do I install packages from the AUR?

  • Arch Linux has the AUR (Arch User Repository), a collection of user-built packages. How do I install these packages on Arch Linux ARM though?

    Looks like there are many aur packages already provided through the "aur" repo. I found it by accident. pacman -S yourpackage might actually work. It works with cower and gmrender-resurrect-git, for instance.

  • Correct answer

    8 years ago

    According to the Building Packages page from the Arch Linux ARM, you need to.

    1. Install the build essentials. These are needed to compile packages on Arch Linux ARM.

      $ sudo pacman -S kernel26-headers file base-devel abs
      
    2. Obtain the PKGBUILD. You need to download the tarball that you want. You can find the tarballs for programs at the AUR.

    3. Make the packages. Next you need to run makepkg in order to generate a package that pacman can install.

      $ makepkg -Acs
      

      The -A option ignores the target Arch architecture. The -c option cleans up the directory after makepkg is done, and -s installs the needed dependencies.

      It is advised that you do NOT run makepkg as root as it can cause permanent damage to your system. If you really need to run it as root though, use the --asroot option.

    4. Install the package. makepkg should have create a file in the directory with the filetype .pkg.tar.xz. You should install this package by using the -U option with pacman.

      $ sudo pacman -U x.pkg.tar.xz
      

      Make sure you replace x.pkg.tar.xz with the actual package name.

    Building packages manually is definitely not recommended for novice users. In fact, everyone should use Yaourt. It makes the whole process simple.

    You still need those packages and to edit the PKGBUILD to compile for armv6h arch.

    @Jivings Actually, the whole reason yaourt and other AUR helpers aren't in the official repo is that you are supposed to learn how to install foreign packages manually before using an automated tool.

    'abs' package is not present in the repository

    is the `kernel26-headers` still actual? Did not find anything about it with google. And the group `base-devel` contains `file`.

  • The easiest solution is to use Yaourt (Yet AnOther User Repository Tool).

    You can install with:

    pacman -S yaourt
    

    And then sync with the AUR:

    yaourt -Syy
    

    You can then search AUR packages:

    yaourt package-name
    

    Which will provide interactive prompts for installation.

    Or if you know the package name exactly:

    yaourt -S package-name
    

    Most pacman commands are the same for yaourt.

    What is the difference between `pacman` and `yaourt`?

    Yaourt also checks the AUR as well as the official repositories. AUR packages have more customization possibilities too.

    This does not work anymore. What is the official solution?

    @tekknolagi Which bit doesn't work?

    `pacman -S yaourt` doesn't work and I cannot add `archlinuxfr` as apparently they don't host `armv6h`

    @tekknolagi `yaourt` used to be in the main repository for Arch Arm. Perhaps they removed it....But you can still build it from source, which is explained in the AUR article on the Arch Wiki. And there's a package file for it here. I hope that helps!

    You can now install yaourt from here https://archlinux.fr/yaourt-en

  • All of the above answers are outdated. My answer is not very good, but hopefully avoids the issue of becoming outdated.

    The official wiki explains, in detail, how one goes about installing/building a package that is not part of pacman (packer and yaourt as of this date).

    Both packer and yaourt are flagged as out of date in AUR. (this may change in the future).

    Good answer! I recommend using makepkg -si as well (after checking the PKGBUILD file)

  • I use packer for this purpose which in my opinion is a faster alternative to yaourt.

    Just add these two lines to your /etc/pacman.conf:

    [archlinuxfr]
    Server = http://repo.archlinux.fr/$arch
    

    Then you can install/update packer via pacman:

    # pacman -Sy packer
    

    And use packer in pretty much the same way you use pacman:

    $ packer -S some_aur_package
    

    Also if you wan't to upgrade all packages including ones from the AUR:

    $ packer -Syu
    

    Packer will first run pacman -Syu to upgrade the packages from official repositories, then it will upgrade all AUR packages.

  • IMPORTANT! yaourt is insecure and deprecated according to the wiki: https://wiki.archlinux.org/index.php/AUR_helpers

    While @Jivings answer was best back in `12, I would recommend installing one of the more secure and feature rich arch package managers (and I suggest someone update @Jivings answer as it has the most visibility).

    I am using aurman and dig it. Has all the features, is secure, and the cli works almost exactly like pacman. To install:

    cd ~/Downloads
    git clone https://aur.archlinux.org/aurman.git
    cd aurman
    makepkg -Acs
    # Change xxx below to downloaded version
    sudo pacman -U aurman-xxx.pkg.tar.xz
    

    Then you can then follow a pacman guide almost exactly but using aurman instead of pacman. The following guide was taken from https://www.digitalocean.com/community/tutorials/how-to-use-arch-linux-package-management and got me started:


    Getting Started

    Arch Linux provides package management facilities similar to those found in other modern Linux distributions. This is a guide to common package management operations.

    Before proceeding further, make sure your package databases are up to date with:

    sudo pacman -Sy
    

    Searching

    Favoring brevity over intuitiveness, most package management operations in Arch Linux appear in the format:

    pacman -<a-z><a-z>.
    

    For example, the normal command for searching pacman repositories is

    pacman -Ss <package> 
    

    ...

    Alternatively, you can use pacman -Qs with the downside of no color highlighting.

    pacman -Qs linux
    

    If you want color highlighting with pacman -Ss, you can uncomment Color from /etc/pacman.conf. It highlights different things than pacsearch, though, so you might want to try both and see which one you like better.

    sudo vi /etc/pacman.conf
    
    ...
    # Misc options
    #UseSyslog
    Color
    #TotalDownload
    CheckSpace
    #VerbosePkgLists
    ...
    

    Getting Information

    pacman -Qi displays basic information about an installed package.
    
    pacman -Qi linux
    
    Name           : linux
    Version        : 3.8.4-1
    Description    : The linux kernel and modules
    Architecture   : x86_64
    URL            : http://www.kernel.org/
    Licenses       : GPL2
    Groups         : base
    Provides       : kernel26=3.8.4
    Depends On     : coreutils  linux-firmware  kmod  mkinitcpio>=0.7
    Optional Deps  : crda: to set the correct wireless channels of your country
    Required By    : None
    Optional For   : None
    Conflicts With : kernel26
    Replaces       : kernel26
    Installed Size : 64728.00 KiB
    Packager       : Tobias Powalowski <[email protected]>
    Build Date     : Wed Mar 20 21:16:17 2013
    Install Date   : Fri Mar 29 01:02:14 2013
    Install Reason : Explicitly installed
    Install Script : Yes
    Validated By   : Unknown
    

    If pacman -Qi is passed no arguments, it returns all packages in the system. You can search this output to get specialized information about installed packages.

    For example, if you wanted to get each package and its size:

    pacman -Qi | grep -e "Name" -e "Installed Size"
    
    Name           : a52dec
    Installed Size : 244.00 KiB
    Name           : aalib
    Installed Size : 768.00 KiB
    

    ...

    While pacman -Qi provides information about installed packages, pacman -Si queries the database for the most recently retrieved information about a package.

    pacman -Si linux
    

    pacman -Ql lists all files associated with a package.

    pacman -Ql vi
    
    vi /usr/
    vi /usr/bin/
    vi /usr/bin/edit
    vi /usr/bin/ex
    vi /usr/bin/vedit
    vi /usr/bin/vi
    

    ...

    The package name on each line can make the output more difficult to use in a script. pacman -Qlq (i.e. "pacman query list, quiet") will not print the package name.

    pacman -Qlq vi
    
    /usr/
    /usr/bin/
    /usr/bin/edit
    /usr/bin/ex
    /usr/bin/vedit
    /usr/bin/vi
    

    ...

    You can use pacman -Qlq | grep bin to find all files in that package that are in a bin folder (and thus are likely executable files). This is handy when the command associated with a package is different from the package name.

    pacman -Qql pacman | grep bin
    

    Installing

    The typical way to install or upgrade a standard package is pacman -S.

    sudo pacman -S <package>
    

    Packages often have a similar pattern in their names. Brackets can be used as a shortcut.

    sudo pacman -S lua-{sec,socket,zlib}
    

    Sometimes you might want to just download a package for archival purposes without installing it. pacman -Sw will download a package to the cache folder.

    sudo pacman -Sw <package>
    

    If a package has been downloaded, or if you know the url, you can install it directly.

    sudo pacman -U <package_path>
    

    Upgrades

    Since pacman revolves around the idea of "syncing" a package with the remote repository, pacman -S will upgrade a package if it is already installed.

    Pacman can list packages that are out of date.

    pacman -Qu
    

    Unfortunately, it doesn't display the version of the package in the repository, so you won't be able to tell how out of date each package is. If this is important to you, you might want to look into 3rd party package managers or write a script that ties together the package version obtained from pacman -Qi and pacman -Si.

    You can get the version from pacman -Qi or pacman -Si using a regular expression.

    pacman -Qi linux | grep "Version" | sed 's/^Version\s*:\s//'
    
    3.8.4-1
    

    And then write a script that shows the versions side by side.

    for i in $(pacman -Qqu)
    do
      printf "$i: "
      printf "$(pacman -Qi "$i" | grep 'Version' | sed 's/^Version\s*:\s//') "
      echo   "$(pacman -Si "$i" | grep 'Version' | sed 's/^Version\s*:\s//')"
    done
    

    Pacman provides a way to upgrade all of your packages at once, but it is not recommended because Arch is a rolling release distribution. If problems arise, it can take time to determine what the causes are.

    sudo pacman -Syu
    

    Downgrades

    Arch Linux does not officially maintain deprecated packages. Instead, you will need to rely on your package cache and places like the Arch Rollback Machine. Cache

    Every package downloaded with pacman is stored in /var/cache/pacman/pkg.

    ls /var/cache/pacman/pkg | grep linux
    
    linux-3.11.6-1-x86_64.pkg.tar.xz
    linux-3.9.7-1-x86_64.pkg.tar.xz
    

    ...

    If you would like to revert to a package in your cache, just install it directly.

    pacman -U <path_to_cached_file>
    

    Arch Rollback Machine

    The Arch Rollback Machine is a collection of snapshots of the official Arch Linux mirror. As of this writing, it goes back four months. The ARM is currently hosted at http://seblu.net/a/arm, though this could change in the future.

    ARM packages can be installed remotely using pacman -U .

    pacman -U http://seblu.net/a/arm/2013/08/31/extra/os/x86_64/apache-2.2.25-1-x86_64.pkg.tar.xz
    

    It isn't exactly convenient to browse the ARM for older packages. Fortunately, there are tools that make this easier:

    downgrade
    downgrader
    

    They search for older versions in the cache and the ARM. Their usage is what you would expect.

    downgrade <package>
    downgrader <package>
    

    Both tools are in the AUR, so the easiest way to install them will be with a helper like yaourt.

    Note: The ARM is an unofficial project and has been closed in the past, so it might be a good idea to avoid clearing your cache in case the ARM goes down or changes locations again. If you would like to roll your own ARM, there appears to be a NodeJS project on github. Removal

    Remove a package, provided nothing is depending on it. Leave its dependencies installed.

    sudo pacman -R <package>
    

    Remove a package, provided nothing is depending on it. Remove its dependencies that aren't required by anything else.

    sudo pacman -Rs <package>
    

    Force removal of a package. This is the command you will reach for to just wipe the package from your system and reinstall when reinstalling alone isn't enough.

    sudo pacman -Rdd <package>
    

    To completely *remove* a package: `aurman -Rsn `

  • The first thing you need to do is download the package from the AUR. To do that run: git clone http://aur.archlinux.org/package.git Even though it looks like you're downloading a .git file, the output will be a directory.

    cd package to find a PKGBUILD file. This will be used in the next step.

    Finally, run this command to compile and install the package you've just downloaded. makepkg -Sri. If you want a comprehensive explaination of what each of those letters mean, you can run makepkg -h where they will all be explained.

    Welcome to Stack Exchange, Ashish .. can you elaborate a little bit on your answer - why would the above need to be done, what do the statements do, etc.?

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM