Installing An Arch Desktop
Arch Linux is quite different from other distributions. It focuses on minimalism, ease of configuration, and keeping a hand-off approach. This can be daunting for those accustomed to other Linux distributions.
- Rather than maintaining fixed releases, Arch uses a rolling release system. There is no "Arch n.n"
- There is no branding whatsoever outside of the boot-up screen. And even then, it's only the unique way in which Arch brings up the system.
- The Arch installer presents only a base system. There are no pre-sets for common server types or desktop environments.
- Choices for piecing together your own system can be staggering.
One of the side-benefits from Arch's KISS approach is that it is relatively trivial to install Arch from an existing Arch system, including the installation ISO. For the sake of simplicity, this article will only cover the setup of an Arch system using LXDM and Compiz + Emerald. These are by no means the only choice for a desktop system.
Pre-Installation
Arch Install Scripts
If you are using the Arch Installation Media, the arch-install-scripts package is already installed. If you are installing from an existing installation, you can use pacman to install this script to the host machine.
pacman -Sy arch-install-scripts
The remmainder of this wiki article will assume that you have theses script installed.
Networking
By default, the Arch installation ISO will bring up and try to get a DHCP lease for all detected network devices. PXE boot will give the adapter an IP but no routing information. A fresh install of Arch does absolutely nothing with networking interfaces by default.
dhcpcd [interface]
If you do not use DHCP, you will have to use these commands to use static addressing:
ip addr [ip-address]/[net-mask] broacast [broadcast] dev eth0 ip route add default via $GTWY ip link set dev $NDIF up
If you are using wifi, the Arch Installation Media has wifi-menu installed for easy CLI configuration of wifi.
Remote Setup Via SSH
If you are using the Arch Installation Media, you may want to use SSH to set up the machine remotely. The most common reason for this is so you can use another machine to look things up for you new installation, and so you can do other work while the Arch is being installed. If you are using an existing Arch system to set up another Arch system, there is no need for SSH.
By default, SSH will not allow password-less logins. The simplest fix is to run passwd and set one before enabling SSH
passwd && systemctl start sshd.service
Pacman Repository Selection
Once networking is up, you'll want to be sure you are using the fastest mirror. To do this, install reflector. You can safely skip upgrading pacman (for now -- this may change in the future.)
pacman -Sy reflector
You can now use reflector to automatically choose the fastest mirrors for you.
reflector -l 5 -c "[country]" --sort rate --save /etc/pacman.d/mirrorlist
Creating Target Filesystem
Use parted and/or fdisk to create the target partition(s) for your installation. Then format and mount the partition(s).
mkfs -t [fs-type] [device] && mount [device] /mnt/system
Swap Space
dd if=/dev/zero of=/mnt/system/swapfile bs=1M count=[megabytes] chmod 600 /mnt/system/swapfile mkswap /mnt/system/swapfile swapon /mnt/system/swapfile
Installing The Base System
PKGS+=" base acpid dcfldd iotop ix ncdu parted rsync sudo tmux" # General Utilities PKGS+=" dosfstools mtools ntfs-3g smbclient nfs-utis" # Filesystem Utilities PKGS+=" cpupower dmidecode hddtemp hdparm hwdetect lm_sensors lshw inxi smartmontools" # Hardware Utilities PKGS+=" dnsutils net-tools nfs-utils ntp openssh reflector whois wget" # Network Utilities PKGS+=" arj lzop p7zip unrar zip" # Compression Utilities pacstrap /mnt/system $PKGS
Configuring The Base System
fstab
genfstab -pL /mnt/system >> /mnt/system/etc/fstab echo -e "/swapfile\tnone\tswap\tdefaults\t0 0" >> /mnt/system/etc/fstab
Host Name
echo [hostname] > /mnt/system/etc/hostname
Time Zone
ln -s /usr/share/zoneinfo/[Country]/[City] /mnt/system/etc/localtime
NB: You can use [TAB] completion to help yourself out.
Hardware Clock
It is usually best to have the hardware clock set to UTC. If you aboslutely must have the hardware clock set to local time:
/etc/adjtime
0.0 0 0 0 LOCAL
Locale
cat << EOF > /mnt/system/etc/locale.conf LANG=en_US.UTF-8 LANGUAGE=en_US LC_COLLATE=POSIX EOF cat << EOF > /mnt/system/etc/locale.gen en_US.UTF-8 UTF-8 EOF
Console
cat << EOF > /mnt/system/etc/vconsole.conf KEYMAP=us FONT=Lat2-Terminus16 EOF
Enabling [multilib] on 64-bit systems
[[ $(uname -m) == x86_64 ]] && sed -i ':a;N;$!ba;s/#\[multilib\]\n#/\[multilib\]\n/g' /mnt/system/etc/pacman.conf
Sudo
This will configure sudo to give members of the wheel group access and also configure it to request root's password instead of your own. (So you don't have to use a very strong password for your primary login and worry about it being an access point for hackers.)
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g' /mnt/system/etc/sudoers echo 'Defaults rootpw' >> /mnt/system/etc/sudoers
NFS
echo -e "[nfs-ip]:/\t[nfs-mount]\tnfs4\tnoatime,user,exec,soft,timeo=14\t0 0" >> /mnt/system/etc/fstab
mkinitcpio
The default HOOKS should work fine. Just need to add the consolefont and keymap hooks.
sed -i 's/^HOOKS="(.*)"/HOOKS="\1 consolefont keymap"/g' /mnt/system/etc/mkinitcpio.conf
If you are using software RAID, you will also need to add the mdadm_udev
hook.
sed -i 's/^HOOKS="(.*)autodetect(.*)"/HOOKS="\1autodetect mdadm_udev\2"/g' /mnt/system/etc/mkinitcpio.conf
makepkg
If you do not plan on compiling your own packages, you can skip this section.
The first thing to do to optimize compiled code is to specify that we're using the PC architecture.
sed -i 's/-unknown-linux-gnu/-pc-linux-gnu/g' /mnt/system/etc/makepkg.conf
Next, allow GCC to auto-detect CPU features.
sed -i 's/-march=\S* -mtune=generic/-march=native/g' /mnt/system/etc/makepkg.conf
Lastly, take advantage of SMP if available.
sed -i 's/#MAKEFLAGS="-j."/MAKEFLAGS="-j[cores + 1]"/g' /mnt/system/etc/makepkg.conf
Networking
DHCP
The easiest way is to just rely on DHCP
arch-chroot /mnt/system systemctl enable dhcpcd exit
NetworkManager
If you're using a laptop or other computer with no guaranteed connection, you may prefer Network Manager
pacstrap /mnt/system networkmanager arch-chroot /mnt/system systemctl enable NetworkManager exit
Network Manger works best with a complimentary GUI applet.
netctl
For ethernet connections that connect to a local LAN that does not have an internet connection
cp /mnt/etc/netctl/examples/ethernet-static /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet sed -i "s/^ADDR=.*/ADDR='[ip-address]'/g" /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet
If your ethernet connection can connect to the internet
sed -i 's/^GATEWAY=.*/GATEWAY="[gateway-address]"/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet sed -i 's/^DNS=.*/DNS=\("[dns-address]"\)/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet
Otherwise:
sed -i 's/^GATEWAY=/#GATEWAY=/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet sed -i 's/^DNS=/#DNS=/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-ethernet
For network connections that connect to a wireless AP
cp /mnt/etc/netctl/examples/wireless-wpa-static /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless sed -i 's/^GATEWAY=.*/GATEWAY="[gateway-address]"/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless sed -i 's/^DNS=.*/DNS=\("[dns-address]"\)/g' /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless sed -i "s/^ADDR=.*/ADDR='[ip-address]'/g" /etc/netctl/$(cat /mnt/system/etc/hostname)-wireless sed -i 's/^ESSID=.*/ESSID='[esid]'/g' /etc/network.d/$(cat /mnt/system/etc/hostname)-wireless sed -i 's/^KEY=.*/KEY='[wpsk]'/g' /etc/network.d/$(cat /mnt/system/etc/hostname)-wireless
Finally, to enable the network connection(s) at boot time:
arch-chroot /mnt/system netctl enable [profile] exit
Generate initramfs
arch-chroot /mnt/system mkinitcpio -P exit
Boot Loader
Sylinux
pacstrap /mnt/system syslinux arch-chroot /mnt/system syslinux-install_update -iam exit
Grub
pacstrap /mnt/system grub arch-chroot /mnt/system grub-mkconfig -o /boot/grub/grub.cfg grub-install [device] exit
Daemon Setup
arch-chroot /mnt/system for daemon in acpid cronie smartd ntpd nfs-wait-online lm_sensors spupower cups; do systemctl enable $daemon done
Finish System Setup
umount /mnt/system reboot
Post-Installation
Sensors
Sensors cannot be configured in chroot. It must be done once the target installation machine has booted the new system.
sensors-detect
GUI Configuration
GTK Themes
The defaults are not going to be pretty outside of the GNOME desktop environment. You may want to install some packages and set some defaults for GTK.
echo 'gtk-theme-name="Clearlooks" gtk-icon-theme-name="elementary" gtk-font-name="Droid Sans 10"' > ~/.gtkrc-2.0 echo '[Settings] gtk-application-prefer-dark-theme = false gtk-theme-name = Clearlooks-Phenix gtk-icon-theme = elementary' > ~/.config/gtk-3.0/settings.ini
Fixes
Nautilus Video Previews
The default setting for Nautilus is to use the GStreamer backend for previews. However, if you don't have the full-fledged GNOME desktop, nothing is set up. Instead of trying to mess around with GStreamer plugins, you can use ffmpegthumbnailer.
Make use you have the requirements
pacman -Sy --needed gconf ffmpegthumbnailer
Now run this script (can be copy-pasted into a terminal):
VIDEO_EXTENSIONS="video@flv video@webm video@mkv video@mp4 video@mpeg \ video@avi video@ogg video@quicktime video@x-avi video@x-flv video@x-mp4 \ video@x-mpeg video@x-webm video@x-mkv application@x-extension-webm \ video@x-matroska video@x-ms-wmv video@x-msvideo video@x-msvideo@avi \ video@x-theora@ogg video@x-theora@ogv video@x-ms-asf video@x-m4v" THUMBNAIL_COMMAND="/usr/bin/ffmpegthumbnailer -s %s -i %i -o %o -c png -f -t 10" for i in $VIDEO_EXTENSIONS; do gconftool-2 -s "/desktop/gnome/thumbnailers/$i/command" -t string "$THUMBNAIL_COMMAND" gconftool-2 -s "/desktop/gnome/thumbnailers/$i/enable" -t boolean 'true' done
Pacman Cleanup
To clear out orphaned packages (useful for purging stuff needed to build but not run AUR packages):
pacman -Rcss $(pacman -Qtdq)
To clear the cache of all packages save the ones that are currently installed on the machine:
pacman -Sc