Arch Linux quick start guide

Posted by Sven Kiljan on in Arch Linux, Linux, Getting Started

Installing Arch Linux is not really that lengthy as the wiki makes it seem to be. What makes the official installation guide daunting is that it tries to keep track of every little aspect that could be relevant in obscure or rare situations. It provides a good reference manual for those who already have some experience with Arch Linux, but this puts those who lack experience in an uncomfortable position. To learn more about the installation process to understand the official guide better it is required to finish an installation at least once.

That is where this quick start guide comes into play. Instead of looking at all possible scenarios the scope is much more narrow, limited to a virtual machine. It makes the whole installation process more clear by limiting all the executed commands to a single overview.

This quick start guide assumes the use of a 'Other Linux 4.x or later kernel 64-bit' VMWare virtual machine. With a small bit of effort it is easy to adopt it to a 'Linux, Other Linux (64-bit)' VirtualBox virtual machine. The machine has two Ethernet adapters: one connected to a NAT-based internet connection, the other to a bridged network on a physical network interface. This is to clarify the difference between using DHCP and using a static IP address.

Boot using the latest Arch Linux ISO image.

Run:

# Partition and format local storage, and install Arch Linux
echo -ne "o\nn\n\n\n\n\na\nw\n" | fdisk /dev/sda
mkfs.btrfs /dev/sda1
mount /dev/sda1 /mnt
btrfs subvolume create /mnt/root
umount /mnt
mount -o subvol=root /dev/sda1 /mnt
pacstrap /mnt base grub btrfs-progs sudo open-vm-tools openssh

# Make the system bootable
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

# Configure date/time and localization settings
ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
systemctl enable systemd-timesyncd.service

sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
locale-gen

# Configure network settings
echo "archlinux" > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.1.1 archlinux.localdomain archlinux" >> /etc/hosts

echo "[Match]" > /etc/systemd/network/ens32-nat.network
echo "Name=ens32" >> /etc/systemd/network/ens32-nat.network
echo "" >> /etc/systemd/network/ens32-nat.network
echo "[Network]" >> /etc/systemd/network/ens32-nat.network
echo "DHCP=yes" >> /etc/systemd/network/ens32-nat.network

echo "[Match]" > /etc/systemd/network/ens33-bridge.network
echo "Name=ens33" >> /etc/systemd/network/ens33-bridge.network
echo "" >> /etc/systemd/network/ens33-bridge.network
echo "[Network]" >> /etc/systemd/network/ens33-bridge.network
echo "Address=192.168.1.1/24" >> /etc/systemd/network/ens33-bridge.network
echo "#Gateway=" >> /etc/systemd/network/ens33-bridge.network
echo "#DNS=" >> /etc/systemd/network/ens33-bridge.network

systemctl enable systemd-networkd
systemctl enable systemd-resolved

# Configure local user accounts
passwd
sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
useradd -m -G wheel -s /bin/bash myusername
passwd myusername

# Enable virtual machine guest tools and SSH daemon
systemctl enable vmtoolsd.service
systemctl enable vmware-vmblock-fuse.service
systemctl enable sshd

# Create a snapshot of the freshly installed system
mkdir /.snapshots
btrfs subvolume snapshot -r / /.snapshots/system-installed

# Wrap up and restart
history -c && exit
sync
umount /mnt
reboot

Change the time zone, network configuration and 'myusername' to what suits you best. Also double check the names of the network interfaces, for example by using ip addr.

At the time of writing the total download size (aside of the ISO image) is around 280 MB for 162 packages, and the total installation size is around 1100 MB.

Hints:

  • If you install the operating system bare-metal, the open-vm-tools package can be skipped, of course.
  • If you need wireless network support, add the packages wpa_supplicant and dialog to the pacstrap command, which make initial configuration easier by offering wifi-menu in the freshly installed operating system. Make sure to stop systemd-networkd and systemd-resolved, and start netctl when using it.
  • A quick one-liner to get a graphical user-interface on a system with an Intel graphics adapter: pacman -S xorg xf86-vide-intel mesa sddm plasma-meta && systemctl enable sddm && systemctl start sddm. Note that this can increase your installation size by 1700 MB or more. Add package kdebase-meta to install some common graphical applications (a file manager, a terminal emulator, a text editor, etc.).
  • To support easy network configuration in a graphical user environment and using nmcli, disable systemd-networkd and systemd-resolved. Enable and start NetworkManager. Add the required widget to the taskbar through Panel options -> Add Widgets -> Networks.

Comments