This article provides instructions on installing Arch Linux on a system without an Internet connection. To do this, another system with a working Internet connection is required.
First, follow the Installation guide, skipping the Installation guide#Connect to the internet section, until the Installation guide#Install essential packages step.
airootfs.sfs
) from the ISO or copying the live environment's root file system is not a supported installation method.Prepare local repository
Follow Pacman/Tips and tricks#Installing packages from a CD/DVD or USB stick for instructions on preparing a local repository with the necessary files on a separate host installation.
At the very least, for a functioning system, the following packages are recommended:
# pacman -Syw --cachedir . --dbpath /tmp/blankdb base base-devel linux linux-firmware mkinitcpio vim
Create your custom offline repository
# repo-add ./custom.db.tar.gz ./*[^sig]
Mount and configure
Once the repository is prepared, connect the external media to the new installation, and mount it on the newly created root filesystem:
# mount --mkdir /dev/sdxy /mnt/repo
Edit your archiso /etc/pacman.conf
and add a new section:
/etc/pacman.conf
[custom] SigLevel = Optional Server = file:///mnt/repo/
Comment out [core]
, [extra]
and [community]
so that pacman does not fail on the default repositories.
Pacstrap
You can now continue to pacstrap your locally-available packages to the new installation:
# pacstrap -K /mnt base base-devel linux linux-firmware mkinitcpio vim
Offline installation of packages
Install from file
In case the offline installation process was only temporary, but requires manual installation of some packages before being able to access a network, see pacman#Additional commands to learn how to install local packages.
Shell globbing can be used to install many packages at once:
# pacman -U /package/folder/*.tar.zst
Offline cache
You can put the required files into /var/lib/pacman/sync
and /var/cache/pacman/pkg
, so as to make pacman
think it has everything it needs to do searches, updates, and installs. The following method is based on two forum threads: [1][2].
The steps are:
- downloading the up to date package databases on a computer with internet access,
- transferring them to the offline computer,
- generating the list of packages required from the offline computer to update it,
- downloading them with their signature on a computer with internet access,
- transferring them to the pacman cache of the offline computer,
- installing the updates.
/etc/pacman.conf
file.The following script will download the updated package databases. If needed, change MIRROR
to any mirror from the mirror status list.
download_databases.sh
#!/bin/sh ARCH="x86_64" MIRROR="https://mirrors.kernel.org/archlinux/" wget "${MIRROR}/core/os/${ARCH}/core.db" wget "${MIRROR}/extra/os/${ARCH}/extra.db" wget "${MIRROR}/community/os/${ARCH}/community.db" wget "${MIRROR}/multilib/os/${ARCH}/multilib.db" # and possibly -uncomment- (if customized in /etc/pacman.conf or pacman.conf.d): #wget "${MIRROR}/testing/os/${ARCH}/testing.db" #wget "${MIRROR}/community-testing/os/${ARCH}/community-testing.db" #wget "${MIRROR}/multilib-testing/os/${ARCH}/multilib-testing.db" # and -additionaly- debug and staging packages.
Make the script executable and run it. You will obtain multiple .db files.
The following steps will be transferring the .db files to the offline PC, making it so you are working with up-to-date package lists (as if you ran pacman -Sy
), then generating a list of package required for the update:
# cp *.db /var/lib/pacman/sync/ # pacman -Sup --noconfirm > pkglist
/etc/pacman.d/mirrorlist
file. Otherwise, all what you get is a misleading error message: error: no database for package: package-name
.You will also need to download the corresponding package signatures, so prepare the list of signatures to download:
# sed -e 's/\.zst$/.zst.sig/' ../pkglist > ../siglist
Next, bring the two lists with you to a place where you have internet and download the listed packages in an empty directory:
# wget -nv -i ../pkglist # wget -nv -i ../siglist
wget --restrict-file-names=unix
.Take all the *.pkg.tar.zst
and *.pkg.tar.zst.sig
files back home, put them in /var/cache/pacman/pkg
and finally run
# pacman -Su
Local repository
In case the new system is expected to remain offline or airgapped, it should be configured to expect only local repositories.
Complete repository
After chrooting into your new installation, edit the new /etc/pacman.conf
in the same way as previously (but without the /mnt
prefix):
/etc/pacman.conf
[custom] SigLevel = Optional Server = file:///repo/
Comment out all other repositories and save. Continue configuring the new system as usual.
From now on any updates to the offline system can be made by bringing an up to date copy of the local repository, mounting it to /repo
and running pacman commands as usual.
Partial repository
The following will describe a situation with two Arch Linux machines, 'Al' (with internet connection) and 'Bob' (without internet connection), where one needs to install some NVIDIA packages and their dependencies on 'Bob'.
In this example, the wanted packages are nvidia, nvidia-utils, and xf86-video-nouveau, but it uses a dedicated directory instead of /var/cache/pacman/pkg/
and a dedicated repository called [nvidia] (instead of the usual [core], [extra] etc...)
Generate a list of packages to download
This can be done on any Arch Linux machine which has up-to-date repository data bases (see above for links to database files); to create the list of links to the required packages, use:
# pacman -Sp nvidia nvidia-utils xf86-video-nouveau > /path/to/nvidia.list
The file nvidia.list
will contain links to the listed packages and any others which they depend on which are not already installed on 'Al'. Unless you have cleared your cache, the packages you have installed will be in your cache location. You can check /etc/pacman.conf
for the location. It is probably something like /var/cache/pacman/pkg/
.
Download/copy the packages and their dependencies
Obviously, this requires an internet connection, so on 'Al', create a directory called /path/to/nvidia
for the files and run:
# wget -P /path/to/nvidia/ -i /path/to/nvidia.list
Then copy the dependencies you have already installed from the cache. Either find them manually by browsing https://archlinux.org/packages/ or if the total size of all your packages is not too large, just copy them all
# cp /var/cache/pacman/pkg/* /path/to/nvidia/
Create a repository database just for these packages
This can be done on either 'Al' or 'Bob' using the repo-add
command which comes with pacman (from version 3?); first, change to the /path/to/nvidia
directory where the packages were downloaded, then create database file called nvidia.db.tar.gz
:
$ cd /path/to/nvidia # repo-add nvidia.db.tar.gz *.pkg.tar.zst
Transfer the packages
Now that all the packages have been downloaded, you do not need 'Al' anymore. Copy the contents of /path/to/nvidia
to a the temporary NVIDIA packages cache directory on 'Bob'. In this example, this folder is called /home/me/nvidia
:
$ cp /path/to/nvidia/* /home/me/nvidia
Next, pacman must be made aware of this new repository of packages. First, copy your current pacman.conf
:
# cp /etc/pacman.conf /etc/pacman.conf.old
Now, in /etc/pacman.conf
, make sure that your SigLevel
is set to Never
as your repository will not provide signatures
SigLevel = Never
and add the following lines at the bottom of pacman.conf
:
[nvidia] Server = file:///home/me/nvidia
You may also need to comment out the other repositories so stale defaults do not cause failed attempts to download from online Now, instruct pacman to synchronize with the dedicated NVIDIA repository we created:
# pacman -Sy
This command finds the nvidia.db.tar.gz
file in /home/me/nvidia
and expands it to /var/lib/pacman/sync/nvidia
to create a database of packages contained in the NVIDIA repository.
Install the packages
Finally, install the packages:
# pacman -S nvidia nvidia-utils xf86-video nouveau
Restoring online sources
Should Bob ever be put online, we can restore access to the online sources by replacing /etc/pacman.conf
with the previously created /etc/pacman.conf.old
.