How To Use ArchLinux’s Pacman Package Manager In Other Unix-like OSs
Pacman and Arch User Repository(AUR) – These are the two main reasons for me to stick with Arch Linux for the past few years. From the day I started to use Arch Linux, I don’t often use other Linux distros. I will try other Linux distros only on Virtualbox from time to time to test different applications/tools. Since I use Arch LInux all day and everyday, sometimes I forget or confuse Pacman usage with other distro’s package managers such as APT, DNF, and YUM etc. If you’re anything like me, I’ve got a good news for you. Say hello to Pacapt, an Arch’s pacman-like package manager for some Unices.
Pacapt is actually a wrapper script for different package managers such as YUM, DNF, APT, and Zypper etc. Using Pacapt, you can use the pacman commands as the way you use it under Arch Linux to install, update, upgrade, remove packages in other Unix-like operating systems. That said, you don’t need to remember various commands/options of different OSs. Pacapt brings most-commonly used Pacman commands to many other Unix-like operating systems. Please be mindful that not all options of the native package manager are ported. Pacapt tool only provides a very basic interface to search, install, remove packages, and/or update the system.
Pacapt currently supports the following package managers:
- pacman by Arch Linux, ArchBang, Manjaro, etc.
- dpkg/apt-get by Debian, Ubuntu, etc.
- homebrew by Mac OS X
- macports by Mac OS X
- yum/rpm by Redhat, CentOS, Fedora, etc.
- portage by Gentoo
- zypper by OpenSUSE
- pkgng by FreeBSD
- cave by Exherbo Linux
- pkg_tools by OpenBSD
- sun_tools by Solaris(SunOS)
- apk by Alpine Linux
- tazpkg by SliTaz Linux
- swupd by Clear Linux
- tlmgr by TeX Live
- conda by Conda
Let us hope the developers will extend the support to many other package managers in future.
Please remember that Pacapt should not be installed on an Arch-based system. Also, on FreeBSD and Alpine Linux, please install bash package first.
Pacapt can be installed in two ways. Download the stable script from GitHub and put it in your PATH like below.
$ sudo wget -O /usr/local/bin/pacapt https://github.com/icy/pacapt/raw/ng/pacapt
$ sudo chmod 755 /usr/local/bin/pacapt
$ sudo ln -sv /usr/local/bin/pacapt /usr/local/bin/pacman || true
On some systems, /usr/local/bin is not in the search paths when the command is executed by sudo. In such cases, you may want to use /usr/bin/pacman or /usr/bin/pacapt instead.
Alternatively, we can install Pacapt from Pival81 repository as shown below.
On CentOS 7 run the following commands as root:
# cd /etc/yum.repos.d/ # wget https://download.opensuse.org/repositories/home:Pival81/CentOS_7/home:Pival81.repo # yum install pacapt
On CentOS 6 run the following as root:
# cd /etc/yum.repos.d/ # wget https://download.opensuse.org/repositories/home:Pival81/CentOS_6/home:Pival81.repo # yum install pacapt
For Debian 8.0 run the following as root:
# wget -nv https://download.opensuse.org/repositories/home:Pival81/Debian_8.0/Release.key -O Release.key # apt-key add - < Release.key # echo 'deb http://download.opensuse.org/repositories/home:/Pival81/Debian_8.0/ /' > /etc/apt/sources.list.d/pacapt.list # apt-get update # apt-get install pacapt
On Fedora 25 run the following as root:
# dnf config-manager --add-repo https://download.opensuse.org/repositories/home:Pival81/Fedora_25/home:Pival81.repo # dnf install pacapt
On Fedora 24 run the following as root:
# dnf config-manager --add-repo https://download.opensuse.org/repositories/home:Pival81/Fedora_24/home:Pival81.repo # dnf install pacapt
On openSUSE Tumbleweed run the following as root:
# zypper addrepo https://download.opensuse.org/repositories/home:Pival81/openSUSE_Tumbleweed/home:Pival81.repo # zypper refresh # zypper install pacapt
On openSUSE Leap 42.2 run the following as root:
# zypper addrepo https://download.opensuse.org/repositories/home:Pival81/openSUSE_Leap_42.2/home:Pival81.repo # zypper refresh # zypper install pacapt
On RHEL 7 run the following as root:
# cd /etc/yum.repos.d/ # wget https://download.opensuse.org/repositories/home:Pival81/RHEL_7/home:Pival81.repo # yum install pacapt
On RHEL 6 run the following as root:
# cd /etc/yum.repos.d/ # wget https://download.opensuse.org/repositories/home:Pival81/RHEL_6/home:Pival81.repo # yum install pacapt
On xUbuntu 16.04 run the following:
$ wget -nv https://download.opensuse.org/repositories/home:Pival81/xUbuntu_16.04/Release.key -O Release.key $ sudo apt-key add - < Release.key $ sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Pival81/xUbuntu_16.04/ /' > /etc/apt/sources.list.d/pacapt.list" $ sudo apt-get update $ sudo apt-get install pacapt
Use ArchLinux’s Pacman Package Manager In Other Linux Distributions
The typical syntax to use pacapt is:
$ pacapt <option(s)> <operation(s)> <package(s)>
You can also use “pacman” instead of “pacapt” like below.
$ pacman <option(s)> <operation(s)> <package(s)>
Now let us see some examples.
To install a package, for example vim, on RHEL, CentOS, we use:
# yum install vim
And, to install vim on Debian-based systems, we use:
$ sudo apt-get install vim
Indeed! This is how we perform the installation with the native package manager. Now, it is not necessary!
For instance, to install vim package CentOS server, just run:
# pacman -S vim
This command will automatically invoke “yum install vim” command and install vim editor on your CentOS system. To put this simply, the pacapt script allows you to use pacman in place of Apt, DNF, Zypper, Yum and other popular package managers, so installing packages is quite easy! You don’t need to memorize commands for different distros. The same command can be used to install vim editor on any Linux system that has pacapt installed. Got it? great! If you are already familiar with Pacman, you know how to use it to install, update, upgrade and remove packages.
Here are the list of currently supported options.
To list all installed packages, run:
# pacman -Q
To show package’s changelog:
# pacman -Qc <package>
To print print package status:
# pacman -Qi <package>
To list package’s files:
# pacman -Ql <package>
To list installed packages that aren’t available in any installation source:
# pacman -Qm
To query package that provides a specific file:
# pacman -Qo <file>
To query a package file (don’t use package database):
# pacman -Qp <file>
To search for an installed package:
# pacman -Qs <package>
To install a package, run:
# pacman -S <package-name>
To search for packages:
# pacman -Ss <package>
To upgrade the system:
# pacman -Su
To update package database:
# pacman -Syy
To update package database and then upgrade the system:
# pacman -Syu
To remove packages:
# pacman -R <package>
To delete old downloaded packages:
# pacman -Sc
To delete all downloaded packages:
# pacman -Scc
To clean variant files.
# pacman -Sccc
To download packages but don’t install them:
# pacman -Sw <package>
To view all available operations, run:
# pacman -P pacapt: available operations: Q Qi Qs Ql Qo Qp Qc Qu Qm Rs R Si Suy Su Sy Ss Sc Scc Sccc S U Sii
For more details, refer the help section.
# pacman -h
- Sysget – A Front-end For Popular Package Managers
- Deb-pacman : A Pacman-style Frontend For APT Package Manager