How To Use ArchLinux’s Pacman Package Manager In Other Unix-like OSs

Pacapt

Pacman and Arch User Repository – These are the two things that holds 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, Zypper and many. Using Pacapt, you can use Pacman as the way you use it under Arch Linux to install, update, upgrade, remove software 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.

I hope the developers will extend the support to many other package managers in future.

Installing Pacapt

Please remember that Pacapt shouldn’t 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

Pacapt has been installed now.

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

Right?

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 commands in place of Apt, DNF, Zypper and Yum, 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 -Sy

To update package database, then upgrade the system:

# pacman -Syu

To remove package:

# pacman -R <packages>

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

And, that’s all for now folks. Hope this helps. More good stuffs to come. Stay tuned!

Cheers!

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...

2 Responses

  1. Lyr3 says:

    I miss Arch. Portage and Pacman are easily the most interesting packages managers out there.

  2. jet says:

    Pacman is the most fragile package manager. It is weaker even than yum. A lot of times cannot resolve dependencies with Arch own repos.
    It asks questions what to do and a lot of times none of the answers fixes the issue and just quits and leaves OS in broken stage. I’ve seen that many times in both Arch and Manjaro.
    When you try apt in Debian you will never look back (even in Debian unstable repos).

Leave a Reply

Your email address will not be published. Required fields are marked *