- Install Arch Linux via Docker
- Pre-installation
- Prepare an installation medium
- Full disk partitions
- Volumes
- Mount the file systems
- Installation
- Launching the container
- Select the mirrors
- Install essential packages
- Reboot
- Post-installation
- User : Soloturn/Quick Installation guide UEFI
- Format disk and mount partitions
- Install Arch
- reboot and configure
- store pkglist to later install same packages from existing arch installation
- if windows is installed
- miscellaneous: network, firewall, time, date
- alternative: systemd netctl
- maintain
- regular commands
- add another user
- acl
- wipe data, ssd, disk
- podman
Install Arch Linux via Docker
This document is a guide for installing Arch Linux using the official Arch Linux Container Image from Docker Hub. For alternative means of installation, see Category:Installation process.
Before installing, it would be advised to view the FAQ. For conventions used in this document, see Help:Reading. In particular, code examples may contain placeholders (formatted in italics ) that must be replaced manually.
For more detailed instructions, see the respective ArchWiki articles or the various programs’ man pages, both linked from this guide. For interactive help, the IRC channel and the forums are also available.
Arch Linux should run on any x86_64-compatible machine with a minimum of 512 MiB RAM, though more memory is needed to boot the live system for installation [1]. A basic installation should take less than 2 GiB of disk space. As the installation process needs to retrieve packages from a remote repository, this guide assumes a working internet connection is available. Furthermore a working Docker setup on the host is required. While technically it is certainly possible to use any qemu supported host to install Arch with, this guide will not cover this however.
Pre-installation
This guide assumes that the host system is already pre-configured with regards to normally expected things. E.g. the time is setup correctly, internet connection is working normally, EFI mode if required is setup correctly etc.
Prepare an installation medium
The installation requires a target directory to which Arch Linux will be installed. Any writable directory can be used, but it is quite likely that the target directory has a partition or volume mounted that will server as the root disk.
Full disk partitions
If a full disk is being used as a target, it may need to be formatted. For details see Installation guide#Partition the disks as the same partitioning instructions and order can be followed from there. All the same restrictions and requirements as from there apply as well.
Likewise, the new disk will also needed to be formatted. The instructions from Installation guide#Format the partitions can be used for this as well.
Volumes
When using filesystems such as btrfs or zfs, filesystem volumes are an option to use. Depending on what filesystem is used, creating them uses their own list of commands. In this guide, btrfs will be used as an example.
First, a root volume for Arch Linux is created. This command assumes the current working directory is the btrfs root volume (subvolid=5), but anywhere could be used. If a different location is used, within an existing hierarchy, keep this in mind when later defining fstab and similar. Also note, that as the Arch Linux specific volume is created on a mounted (root) volume, it could be the case that the underlying stack is using (full)disk encryption.
# btrfs subvolume create "arch_root"
Mount the file systems
The following section assumes the location Arch Linux will be installed into /tmp/target. It is thus required that the partition is thus mounted there. Using a btrfs subvolume called arch_root, with autodefrag and LZO compression enabled would look as:
# mkdir -p /tmp/target # mount /dev/disk /tmp/target -o subvol=arch_root,compress=lzo,autodefrag
The instructions from Installation guide#Mount the file systems can be used for this as well.
Installation
Launching the container
The remainder of the installation will be done inside a docker container, abbreviated with ADC, Arch Docker Container.
# docker run \ --env PS1="ADC(\#)[\d \T:\w]\\$ " \ --interactive \ --privileged \ --rm \ --tty \ --volume "/tmp/target:/target" \ "index.docker.io/library/archlinux:latest" /bin/sh
Select the mirrors
Packages to be installed must be downloaded from mirror servers, which are defined in /etc/pacman.d/mirrorlist . In the docker container we first install reflector, which updates the mirror list by choosing 70 most recently synchronized HTTPS mirrors and sorting them by download rate. [2] First we have to install reflector in the docker container to be able to use it.
# reflector [--country ] \ --latest 5 \ --protocol http,https \ --save "/etc/pacman.d/mirrorlist" \ --sort rate
The higher a mirror is placed in the list, the more priority it is given when downloading a package. Ensure to inspect the file to see if it is satisfactory. If it is not, edit the file accordingly, and move the geographically closest mirrors to the top of the list, although other criteria should be taken into account.
This file will later be copied to the new system by pacstrap, so it is worth getting right.
Install essential packages
To be able to start the installation, the arch-install-scripts package must be installed into the Docker image first. Once completed, the official installation guide can be followed starting with the section Installation guide#Install essential packages.
Return to this guide before executing the Reboot step from the section Installation guide#Reboot to instead continue with the #Reboot below.
Reboot
Exit the docker container by typing exit or pressing Ctrl+d .
Optionally manually unmount all the partitions with umount -R «/target» : this allows noticing any «busy» partitions, and finding the cause with fuser(1) .
With a correctly setup boot loader, a reboot should now be possible into the freshly installed Arch Linux.
Post-installation
See General recommendations for system management directions and post-installation tutorials (like setting up a graphical user interface, sound or a touchpad).
For a list of applications that may be of interest, see List of applications.
User : Soloturn/Quick Installation guide UEFI
This installation guide installs Arch Linux on a System with three partitions EFI, root, and home. Dual boot with windows 10 is possible, as well install on a USB disk or memory stick. No legacy technologies are considered, please use Installation Guide in such a case.
Format disk and mount partitions
Best do it with GParted and create the following partitions or make sure they exist:
- the partition table is GPT
- the EFI partition is FAT32, around 250MB
- the root partition is ext4, around 50GB
- the home partition is ext4, rest of the disk
rEFInd is used to find existing kernels resp operating systems to boot. reuse the existing EFI partition created by microsoft windows is possible. mount the root partition and the EFI partition into it.
mount /dev/sda5 /mnt mkdir /mnt/efi mount /dev/sda3 /mnt/efi
Install Arch
a user is created which is «archie»
export myuser=archie export myhostname=hostn pacstrap /mnt base linux genfstab -U /mnt >> /mnt/etc/fstab arch-chroot /mnt/ pacman -S perl LANG=C perl -i -pe 's/#(de_CH.UTF)/$1/' /etc/locale.gen LANG=C perl -i -pe 's/#(en_US.UTF)/$1/' /etc/locale.gen LANG=C perl -i -pe 's/#(fr_CH.UTF)/$1/' /etc/locale.gen locale-gen echo 'LANG=en_US.UTF-8' > /etc/locale.conf echo 'KEYMAP=de_CH-latin1' > /etc/vconsole.conf localectl --no-convert set-x11-keymap ch ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime echo $myhostname > /etc/hostname pacman -S dialog wpa_supplicant refind mkdir -p /efi/EFI/Boot cp /usr/share/refind/refind_x64.efi /efi/EFI/Boot/bootx64.efi cp -r /usr/share/refind/drivers_x64/ /efi/EFI/Boot/ echo 'extra_kernel_version_strings linux,linux-hardened,linux-lts,linux-zen,linux-git;' > /efi/EFI/Boot/refind.conf echo 'fold_linux_kernels false' >> /efi/EFI/Boot/refind.conf echo 'default_selection "linux from"' >> /efi/EFI/Boot/refind.conf
passwd useradd -m -G wheel -s /bin/bash $myuser passwd $myuser pacman -S sudo git binutils perl -i -pe 's/# (%wheel ALL=\(ALL\) ALL)/$1/' /etc/sudoers
# swap dd if=/dev/zero of=/var/swap.img bs=1024k count=4000 mkswap /var/swap.img echo "/var/swap.img none swap sw 0 0" >> /etc/fstab
# clone dotfiles su - $myuser cd git init echo '.*' >> .git/info/exclude git remote add origin https://github.com/soloturn/dotfiles.git git fetch -p --all git checkout master git reset --hard origin/master git remote set-url origin git@github.com:soloturn/dotfiles.git exit
# install same packages as existing arch system pacman -S --needed - < /home/$/.config/pkglist-abs.txt cd /tmp git clone https://aur.archlinux.org/paru-bin.git cd paru-bin makepkg -si paru -S --needed - < /home/$/.config/pkglist-aur.txt
groupadd android-sdk gpasswd -a $myuser android-sdk mkdir /opt/android-sdk setfacl -R -m g:android-sdk:rwX /opt/android-sdk setfacl -m d:g:android-sdk:rwX /opt/android-sdk
# this is for node.js, npm, and does not work # because of https://npm.community/t/linux-setfacl-is-defeated-by-npm/9156 paru -S npm setfacl -d -m g:root:rX /usr/lib/node_modules/
reboot and configure
store pkglist to later install same packages from existing arch installation
become your user, check and update the package lists from repo if necessary
cd pacman -Qqen > ~/.config/pkglist-abs.txt pacman -Qqem > ~/.config/pkglist-aur.txt git diff
if windows is installed
If windows is installed it might take precedence, so add an entry for the UEFI partitions rEFInd boot loader and set it after the USB device boot as second option. in the order just take the last number listed by efibootmgr:
# efibootmgr # efibootmgr -v # efibootmgr --create --disk /dev/sda --part 3 --loader /EFI/Boot/bootx64.efi --label "rEFInd local boot" # efibootmgr -o 0,4,1
in case the bios does not let the order change via efibootmgr, go to the bios and alter the boot order there.
miscellaneous: network, firewall, time, date
set uncomplicated Firewall rules, network config for netctl, show week number, activate network time protocol, show hide button on right side of windows.
sudo systemctl enable gdm sudo ufw default deny sudo ufw allow from 192.168.0.0/24 sudo ufw limit ssh sudo ufw enable sudo systemctl enable NetworkManager gsettings set org.gnome.desktop.interface clock-show-date true gsettings set org.gnome.desktop.calendar show-weekdate true timedatectl set-ntp true gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,close"
alternative: systemd netctl
# wifi-menu $ sudo systemctl enable netctl-auto@wlp4s0.service
maintain
regular commands
upgrade, delete everything not installed from package cache, delete orphans
$ paru -Syu $ paru -Sc $ pacman -Qdtq | xargs paru -Rsn --noconfirm $ sudo pacman -Sy archlinux-keyring $ paru -S archlinux-keyring
> pacman -Qdtq | xargs paru -Rsn --noconfirm
add another user
add an admin user. if not admin, do not put into group wheel. also add group to do android development:
useradd -m -G wheel -s /bin/bash $myuser passwd $myuser gpasswd -a $myuser android-sdk
acl
remove acl and default acl for group android-sdk, recursive:
setfacl -R -x d:g:android-sdk /opt/android-sdk setfacl -R -x g:android-sdk /opt/android-sdk
setfacl -R -b /opt/android-sdk
open up an existing directory for a group, e.g. users, set actual and default acl recursive:
setfacl -R -m g:users:rwX /home/groupdrive setfacl -R -m d:g:users:rwX /home/groupdrive
wipe data, ssd, disk
nonzero lsblk disc-gran shows TRIM support. especially for external ssd, check if TRIM is supported, see Solid_state_drive#External_SSD_with_TRIM_support.
lsblk --discard sg_readcap -l /dev/sdX sg_vpd -a /dev/sdX
podman
sudo usermod --add-subuids 100000-150000 --add-subgids 100000-150000 username podman system migrate
in /etc/containers/storage.conf comment so overlay is not used
podman --storage-driver overlay system reset
- This page was last edited on 20 February 2023, at 18:06.
- Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.
- Privacy policy
- About ArchWiki
- Disclaimers