Adventures in Arch (Part I): Installing

2013/06/09 by Paulo Pereira

~/categories/Linux #Linux #Arch Linux

Inspired by the recent Linux Action Show experience with Arch, I decided to give it a try.

I have now completely changed from Ubuntu to Arch.

Any tips or advises please let me know.

Arch Linux

Resources

Backups

Since I will format and install Arch I need to backup my /home partition.

I created a Ubuntu USB Live Disk, rebooted into the live environment and backed up all my files.

sudo rsync -axS --exclude='/*/.gvfs' --exclude='lost+found' /media/home/. /media/externaldrive/home/.

Download Arch

I rebooted again into Ubuntu and went to the Arch Download Page and downloaded the latest Arch iso.

Create an Arch USB boot disk

Check what your usb device is:

sudo blkid

Create the USB Arch boot disk:

sudo dd bs=4M if=/home/myuser/archlinux-2013.06.01-dual.iso of=/dev/sde

Install Arch

Before starting read the Arch Beginners Guide. During the installation you should have this guide handy. I used my Nexus 7.

Reboot into the USB disk.

You will start at a shell prompt.

Changing the keyboard to Portuguese (check your layout here) and the terminal font:

loadkeys pt-latin9
setfont Lat2-Terminus16

If you want to change the language uncomment the UTF-8 entry of that language:

nano /etc/locale.gen

Also:

locale-gen
export LANG=pt_PT.UTF-8

At this point I have Internet. Check if you have too:

ping -c 3 www.google.com

If at some point you don’t, try:

dhcpcd

Also check the Arch Beginners Guide for more information, especially if you have a wireless connection.

Now it’s time to prepare the hard drives.

I have a SSD drive for the system and a HDD drive for my /home partition.

I will use GPT partitioning. Check Arch Beginners Guide for the different options.

Check your available drives:

lsblk

I used cgdisk to partition the SSD and HDD drives:

cgdisk /dev/sda

In this drive I created 3 partitions, one for /boot/efi (1GB), another for /boot (1GB) and another for /.

I used the following options in cgdisk to create the partitions:

For the HDD drive I did the same, but created only one partition.

cgdisk /dev/sdd

Now format the partitions:

mkfs.vfat /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
mkfs.ext4 /dev/sdd1

And mount them:

mount /dev/sda3 /mnt
mkdir -p /mnt/boot/efi
mount /dev/sda2 /mnt/boot
mount /dev/sda1 /mnt/boot/efi
mkdir /mnt/home
mount /dev/sdd1 /mnt/home

Select a mirror for installing the system:

nano /etc/pacman.d/mirrorlist

Copy your preferred mirror to the first line.

Tips:

Refresh the packages list:

pacman -Syy

Install the base system:

pacstrap -i /mnt base

Generate an fstab:

genfstab -U -p /mnt >> /mnt/etc/fstab

Check if it’s correct:

nano /mnt/etc/fstab

Chroot to the system:

arch-chroot /mnt

Uncomment the languages of the system (choose the UTF-8 entries):

nano /etc/locale.gen
locale-gen

Create the /etc/locale.conf file:

echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8

Console font and keymap:

nano /etc/vconsole.conf
KEYMAP=pt-latin9
FONT=Lat2-Terminus16

Time zone:

ln -s /usr/share/zoneinfo/Europe/Lisbon /etc/localtime

Hardware clock:

hwclock --systohc --utc

Hostname:

echo myhostname > /etc/hostname

List your available network interfaces:

ip link

Enable the interface at boot time and enable the NetworkManager:

sudo systemctl enable dhcpcd@enp2s0.service
sudo systemctl enable NetworkManager.service

Set the root password:

passwd

For the bootloader I used Syslinux. Check the Arch Beginners Guide for other options, like GRUB.

pacman -S syslinux

As I used GPT partitions I also need:

pacman -S gptfdisk

Install the bootloader:

syslinux-install_update -i -a -m

Check if the root partition is correct in the bootloader configuration file:

nano /boot/syslinux/syslinux.cfg

As I have a EFI motherboard I need to use EFISTUB.

mkdir -p /boot/efi/EFI/arch/
cp /boot/vmlinuz-linux /boot/efi/EFI/arch/vmlinuz-arch.efi
cp /boot/initramfs-linux.img /boot/efi/EFI/arch/initramfs-arch.img
cp /boot/initramfs-linux-fallback.img /boot/efi/EFI/arch/initramfs-arch-fallback.img
pacman -S refind-efi efibootmgr
mkdir -p /boot/efi/EFI/refind

cp /usr/lib/refind/refind_x64.efi /boot/efi/EFI/refind/refind_x64.efi

cp /usr/lib/refind/config/refind.conf /boot/efi/EFI/refind/refind.conf

cp -r /usr/share/refind/icons /boot/efi/EFI/refind/icons

cp /usr/share/refind/refind_x64.efi /boot/efi/EFI/refind/refind_x64.efi
cp /usr/share/refind/refind.conf-sample /boot/efi/EFI/refind/refind.conf
cp /usr/share/refind/icons /boot/efi/EFI/refind/icons
cp /usr/share/refind/drivers_x64 /boot/efi/EFI/refind/drivers
nano /boot/efi/EFI/refind/refind.conf
"Boot to X"       "root=/dev/sda3 ro rootfstype=ext4 systemd.unit=graphical.target"
"Boot to console"   "root=/dev/sda3 ro rootfstype=ext4 systemd-unit=multi-user.target
nano /boot/efi/EFI/arch/refind_linux.conf
"Boot to X"      "root=/dev/sda3 ro rootfstype=ext4 systemd.unit=graphical.target"
"Boot to console" "root=/dev/sda3 ro rootfstype=ext4 systemd.unit=multi-user.target"

efibootmgr -c -d /dev/sda -p 1 -w -L “rEFInd” -l ‘\EFI\refind\refind_x64.efi’

efibootmgr -c -d /dev/sda -p Y -1 /EFI/refind/refind_x64.efi -L "rEFInd"

Exit from the chroot environment, unmount the partitions and reboot.

exit
umount /mnt/{boot,home,boot/efi,}
reboot

Log in as root.

Now it’s time to create a your user (more on user Management here):

useradd -m -g users -s /bin/bash youruser
chfn youruser
passwd youruser

Create a new group to match your user:

groupadd yourgroup
gpasswd -a youruser yourgroup

Add your user as a sudoer:

pacman -S sudo
vi /etc/sudoers

Add:

youruser  ALL=(ALL) ALL

Install ALSA for sound (more on Sound here):

pacman -S alsa-utils

Unmute the channels:

alsamixer

Install the X Window System:

pacman -S xorg-server xorg-server-utils xorg-xinit

Install mesa for 3D support:

pacman -S mesa

Install a video driver. To know what chipset you have:

lspci | grep VGA

In my case I have a NVIDIA card:

pacman -S nvidia

Test X by installing the default environment:

pacman -S xorg-twm xorg-xclock xterm

Start the test Xorg session:

startx

To exit back into the shell prompt:

exit

Install a set of TrueType fonts:

pacman -S ttf-dejavu

Install a Desktop Environment. Choose here.

I chose GNOME:

pacman -S gnome gnome-extra

Install a Display Manager. Choose here.

I chose GDM:

pacman -S gdm

Enable GDM at startup:

systemctl enable gdm.service

Reboot and enjoy:

reboot

And that is it. Arch with GNOME is installed.

Next I will create a series of other post with post install tips and tricks.