Arch Linux in 20 minutes

EDIT: Updated as of 21st June 2015.

Arch Linux is a fantastic operating system. From bleeding edge rolling release packages to a stripped back and industrial feel to the design, Arch grants a feeling of empowerment to the user that is unmatched by most.

Around two years ago I became somewhat tired of the distro hopping and configuration tweaking that had been engaging me previously, and I decided to opt for the quieter and a more stable Debian system in order to be able to focus more of my attention on software development. More recently I decided to give Arch another chance after being convinced by a couple of my colleagues, and was delighted to find that the distro has come along way from when we last parted, the days of System V init and handwritten xorg.conf files.

As always, the installation process for Arch is significantly more involved than most (though not all) distros, so I decided to write up my installation approach for the latest (2014.09.03) release, which should result in a complete development machine in around 20 minutes.

Disclaimer: This guide assumes that the reader has a reasonable working knowledge of Linux OSs, and chooses a selection of packages which may not be to everyone’s taste. The authoritative source of installation instructions is the Arch wiki. Assumed hardware is a desktop machine with a wired ethernet connection and UK keyboard.

# Check that you’re not using UEFI (this command will fail):
efivar -l

loadkeys uk

# Check that DHCP internet is working:
ping -c 3

# Nuke your disk:
sgdisk --zap-all /dev/sda

# Create partition table (interactive application):
cgdisk /dev/sda

# Make file systems (assuming single root partition):
mkfs.ext4 /dev/sda1
mount /dev/sda1 /mnt

# Base install:
pacstrap /mnt base base-devel

# Create fstab:
genfstab -U -p /mnt >> /mnt/etc/fstab

# Verify the generated file and make any desired changes.
# To host /tmp in memory, add:
# tmpfs /tmp tmpfs nodev,nosuid,size=2G 0 0
nano /mnt/etc/fstab

# Chroot into new env:
arch-chroot /mnt /bin/bash

# Generate Locales:
export LANG=en_GB.UTF-8
echo$LANG UTF-8” > /etc/locale.gen
echo LANG=$LANG > /etc/locale.conf

# Set time zone:
ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
hwclock --systohc --utc

# Edit hosts file to add your hostname to the end of this line:
#	localhost.localdomain	localhost	<hostname>
nano /etc/hosts
export HOSTNAME=cec
echo $HOSTNAME > /etc/hostname

# Find out the name of your LAN device:
ip link show

# Enable dhcpcd for that device:
systemctl enable dhcpcd@[internet-device].service

# Determine and install video driver:
lspci | grep -e VGA -e 3D
pacman -Ss xf86-video
pacman -S # [video-driver]

# Install some useful packages:
pacman -S gptfdisk syslinux vim xorg-server xorg-xinit xterm zsh \
         wget rsync openssh emacs

# Uncomment appropriate line to enable sudo access to wheel group:
EDITOR=nano visudo

# Install bootloader:
syslinux-install_update -iam

# Change LABEL from /dev/sda3 to /dev/sda1 for LABELs:
# And set: TIMEOUT 1
nano /boot/syslinux/syslinux.cfg

# Set keymap:
echo KEYMAP=uk > /etc/vconsole.conf

# Set root password:

# Create user and set password:
useradd -G wheel -s /bin/zsh chris
passwd chris


# Login as root

# Check that DHCP internet is still working. If not, revert to
# `ip link show` command):
ping -c 3

# For virtualbox guests:
pacman -S virtualbox-guest-utils
# Load virtualbox kernel modules:
depmod $(uname -r)
modprobe -a vboxguest vboxsf vboxvideo
echo -e “vboxguest\nvboxsf\nvboxvideo” > /etc/modules-load.d/virtualbox.conf
# Launch virtualbox client scripts:
systemctl enable vboxservice
# End of virtualbox commands

# Test that X is working (you should see some terminals and a mouse):

# Install graphic environment (YMMV):
pacman -S gdm gnome-shell nautilus gedit file-roller gthumb evince \
        gnome-control-center gnome-terminal gnome-system-monitor
systemctl enable gdm


# Log in to graphical environment as user
# Set input type (UK) and open gnome-terminal

# Install yaourt
mkdir -p /tmp/yaourt
cd !$
tar -xf package-query.tar.gz
tar -xf yaourt.tar.gz
cd package-query
makepkg -s
sudo pacman -U package-query-*.tar.xz
cd ../yaourt
makepkg -s
sudo pacman -U yaourt-*.tar.xz

# Install web browser (YMMV):
yaourt google-chrome

# Install dropbox:
yaourt dropbox
yaourt nautilus-dropbox

# Install office & media tools:
sudo pacman -S thunderbird libreoffice-fresh vlc

# Install programming tools & runtimes:
sudo pacman -S gcc-fortran texlive-most git aspell aspell-en ruby openmpi \
        jre7-openjdk jdk7-openjdk nodejs npm python2-numpy python-numpy \
        python2-setuptools python-setuptools ipython ipython2 clojure
gem install bundler

# Setup SSH keys

# Install emacs config:
git clone [email protected]:ChrisCummins/prelude.git ~/.emacs.d

AI researcher specializing in compilers and code optimization.