Offline installation

If you wish to install the Archiso (e.g. the official monthly release) as it is without an Internet connection, or, if you do not want to download the packages you want again:

First, follow the Installation guide, skipping the Installation guide#Connect to the internet section, until the Installation guide#Install essential packages step.

There are two main methods to enable bootstrapping the new installation: preparing a local pacman repository with all the required files, and manually copying the files from the archiso. The first version is highly recommended.

Local Repository Method (Recommended)

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 systemd mkinitcpio vim

Create your custom offline repository

# repo-add ./custom.db.tar.gz ./*

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:

# mkdir /mnt/repo
# mount /dev/sdX /mnt/repo

Edit your archiso /etc/pacman.conf and add a new section:

[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 /mnt base base-devel linux linux-firmware mkinitcpio systemd vim

Chroot

In case the new system is expected to remain offline or airgapped, it should be configured to expect local repositories only.

After chrooting into your new installation, edit the new /etc/pacman.conf in the same way as previously (but without the /mnt prefix):

[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.

File Copy Method

Install the archiso to the new root

Instead of installing the packages with pacstrap (which would try to download from the remote repositories), copy everything in the live environment to the new root:

# cp -ax / /mnt

Then, copy the kernel image to the new root, in order to keep the integrity of the new system:

# cp -vaT /run/archiso/bootmnt/arch/boot/$(uname -m)/vmlinuz /mnt/boot/vmlinuz-linux

After that, generate a fstab as described in Installation guide#Fstab.

Chroot and configure the base system

Next, chroot into your newly installed system:

# arch-chroot /mnt /bin/bash

Restore the configuration of journald

This customization of archiso will lead to storing the system journal in RAM, it means that the journal will not be available after reboot:

# sed -i 's/Storage=volatile/#Storage=auto/' /etc/systemd/journald.conf

Remove special udev rule

This rule of udev starts the dhcpcd automatically if there are any wired network interfaces.

# rm /etc/udev/rules.d/81-dhcpcd.rules

Disable and remove the services created by archiso

Some service files are created for the Live environment, please disable pacman-init.service, and remove the file as they are unnecessary for the new system:

# rm -r /etc/systemd/system/{choose-mirror.service,pacman-init.service,etc-pacman.d-gnupg.mount,getty@tty1.service.d}
# rm /etc/systemd/scripts/choose-mirror

Remove special scripts of the Live environment

There are some scripts installed in the live system by archiso scripts, which are unnecessary for the new system:

# rm /etc/systemd/system/getty@tty1.service.d/autologin.conf
# rm /root/{.automated_script.sh,.zlogin}
# rm /etc/mkinitcpio-archiso.conf
# rm -r /etc/initcpio

Importing archlinux keys

In order to use the official repositories, we need to import the archlinux master keys (pacman/Package signing#Initializing the keyring). This step is usually done by pacstrap but can be achieved with

# pacman-key --init
# pacman-key --populate archlinux
Note: Keyboard or mouse activity is needed to generate entropy and speed-up the first step.

Configuring Initramfs

Since you have copied the filesystem from the archiso, the needs to be edited in order for the proper initramfs to be installed. Open up in a text editor of your choice and comment/remove the only uncommented and replace with:

# HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)

Configure the system

Now you can follow the skipped steps of the Installation guide#Configure the system section (setting a locale, timezone, hostname, etc.) and finish the installation by creating an initial ramdisk as described in Installation guide#Initramfs.

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.