If you are an Arch Linux user, you may have noticed that package downloads and installation can sometimes be slow. Fortunately, there are a few simple steps you can take to speed up the process. In this post, we’ll cover three tips for making package installation faster on Arch Linux.
Using a Faster Pacman Mirror
The speed of package downloads can be greatly affected by the mirror being used. Changing to a faster mirror can improve download times. To do this, open the /etc/pacman.d/mirrorlist
file in a text editor with root privileges and move faster mirrors to the top of the list.
Enabling Parallel Downloads in Pacman
By default, Pacman downloads packages one at a time, which can slow down the installation process. To speed things up, you can enable parallel downloading by adding the following lines to the /etc/pacman.conf
file:
[options]
...
ParallelDownloads = 5
This allows up to five packages to be downloaded simultaneously, which can significantly reduce download times.
Making the Build Process Faster for AUR Packages
For AUR packages, you can edit the /etc/makepkg.conf
file to set the number of CPU cores used by package managers like yay
and paru
for building packages. To do this, open the /etc/makepkg.conf
file in a text editor with root privileges, locate the MAKEFLAGS
variable, and uncomment it. Then, set it to use all available CPU cores by adding the following line:
MAKEFLAGS="-j$(nproc)"
This sets MAKEFLAGS
to use the -j
option with the number of CPU cores on your system, as determined by the nproc
command.
You can also set the number of CPU cores to a specific value by replacing $(nproc)
with the desired number. For example, if you want to use four CPU cores for building packages, you can set MAKEFLAGS
as follows:
MAKEFLAGS="-j4"
After making this change, save the file and exit the text editor. Package managers that use makepkg
under the hood, such as yay
and paru
, will now use the specified number of CPU cores for building packages, which can significantly speed up the build process.
Note that changes to /etc/makepkg.conf
will affect all package builds on your system, not just those performed by yay
. If you want to use different settings for yay
specifically, you can use the MAKEFLAGS
and BUILDENV
environment variables as described in the previous section.
It’s worth noting that these tips only apply to package builds from source code. Pre-built binary packages from the official repositories or from third-party sources are not affected by these changes.