Arch linux and pacman

pacman

pacman -S: Installing and updating packages

pacman -S (sync) is family of commands

to refresh packages and upgrade (u upgrade, y, download database from remote)

pacman -Syu

install it

pacman -Syu my_package

This syncs as installing, which is safer. The following is less safe but can also be done:

pacman -S my_package

You can search for packages:

pacman -Ss string_in_package

pacman -S: Managing the cache

cache is stored in pacman in /var/cache/pacman/pkg/

/etc/pacman.conf

can clear cache of uninstalled packages with

pacman -Sc

double clean to be more aggressive (remove cache of installed packages)

pacman -Scc

pacman -Q

Query

Info on a package, including what installed packages depends on it.

pacman -Qi <package>

list of explicitly installed:

pacman -Qe

To see packages installed without the official repository (eg AUR) use

pacman -Qm

Packages which were installed as dependencies

pacman -Qd

Packages which are dependencies and orphans

pacman -Qdt

list of local files associated with package:

pacman -Ql <package_name>

pacman -R

remove it

pacman -Rns my_package

The -s flag removes dependencies which are no longer needed.

The -n flag removes config files.

Can just remove the package and not dependencies:

pacman -R my_package

Manually installing packages using the Arch Build System (ABS) and makepkg

Getting the build instructions

git clone https://gitlab.archlinux.org/archlinux/packaging/packages/apache.git

makepkg

From the folder with the PKGBUILD, can run makepkg

/etc/makepkg.conf

makepkg -si to sync dependencies and install

Running "pacman -syu" will replace these packages with the repository ones. The PKGBUILD file can be amended to prevent that.

The Arch User Repository (AUR)

Introduction

Can pull from AUR.

git clone https://aur.archlinux.org/gzdoom.git

And then build as before.

As these packages are not in the official repositories, running pacman -Syu will not replace them.

Packages can be updated by pulling the git repo and rerunning makepkg as before.

Can see explicitly installed non-pacman using

pacman -Qm

Yet another yogurt (yay)

Yet another yogurt (yay)

Can use as a wrapper around pacman, and to download and update packages from the AUR.

Can update yay pacakges with

yay -Syu

Or just running:

yay

To just update AUR packages:

yay -Sau

Can search eg for firefox by doing

yay firefox

If you know the exact name you can do

yay -Syu firefox

Can uninstall

yay -Rns firefox

to remove unneeded dependencies.

yay -Yc

to remove cache, on both yay and pacman

yay -Sc

See status of installed packages

yay -Ps

Other tools

paccache

paccache is a separate package. Not available by default.

can remove all but last 3 with either of:

paccache -r
paccache -rk3

To remove all uninstalled:

paccache -rk0 remove all uninstalled

asp

Not installed by default. Alternative. to get build instructions:

asp export <package>

to get code:

asp checkout <package>