paapereira.xyz

Adventures in Arch (Part I): Installing

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.

1sudo 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:

1sudo blkid

Create the USB Arch boot disk:

1sudo 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:

1loadkeys pt-latin9
2setfont Lat2-Terminus16

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

1nano /etc/locale.gen

Also:

1locale-gen
2export LANG=pt_PT.UTF-8

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

1ping -c 3 www.google.com

If at some point you don’t, try:

1dhcpcd

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:

1lsblk

I used cgdisk to partition the SSD and HDD drives:

1cgdisk /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.

1cgdisk /dev/sdd

Now format the partitions:

1mkfs.vfat /dev/sda1
2mkfs.ext4 /dev/sda2
3mkfs.ext4 /dev/sda3
4mkfs.ext4 /dev/sdd1

And mount them:

1mount /dev/sda3 /mnt
2mkdir -p /mnt/boot/efi
3mount /dev/sda2 /mnt/boot
4mount /dev/sda1 /mnt/boot/efi
5mkdir /mnt/home
6mount /dev/sdd1 /mnt/home

Select a mirror for installing the system:

1nano /etc/pacman.d/mirrorlist

Copy your preferred mirror to the first line.

Tips:

Refresh the packages list:

1pacman -Syy

Install the base system:

1pacstrap -i /mnt base

Generate an fstab:

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

Check if it’s correct:

1nano /mnt/etc/fstab

Chroot to the system:

1arch-chroot /mnt

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

1nano /etc/locale.gen
2locale-gen

Create the /etc/locale.conf file:

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

Console font and keymap:

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

Time zone:

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

Hardware clock:

1hwclock --systohc --utc

Hostname:

1echo myhostname > /etc/hostname

List your available network interfaces:

1ip link

Enable the interface at boot time and enable the NetworkManager:

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

Set the root password:

1passwd

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

1pacman -S syslinux

As I used GPT partitions I also need:

1pacman -S gptfdisk

Install the bootloader:

1syslinux-install_update -i -a -m

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

1nano /boot/syslinux/syslinux.cfg

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

1mkdir -p /boot/efi/EFI/arch/
2cp /boot/vmlinuz-linux /boot/efi/EFI/arch/vmlinuz-arch.efi
3cp /boot/initramfs-linux.img /boot/efi/EFI/arch/initramfs-arch.img
4cp /boot/initramfs-linux-fallback.img /boot/efi/EFI/arch/initramfs-arch-fallback.img
1pacman -S refind-efi efibootmgr
2mkdir -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

1cp /usr/share/refind/refind_x64.efi /boot/efi/EFI/refind/refind_x64.efi
2cp /usr/share/refind/refind.conf-sample /boot/efi/EFI/refind/refind.conf
3cp /usr/share/refind/icons /boot/efi/EFI/refind/icons
4cp /usr/share/refind/drivers_x64 /boot/efi/EFI/refind/drivers
1nano /boot/efi/EFI/refind/refind.conf
1"Boot to X"       "root=/dev/sda3 ro rootfstype=ext4 systemd.unit=graphical.target"
2"Boot to console"   "root=/dev/sda3 ro rootfstype=ext4 systemd-unit=multi-user.target
1nano /boot/efi/EFI/arch/refind_linux.conf
1"Boot to X"      "root=/dev/sda3 ro rootfstype=ext4 systemd.unit=graphical.target"
2"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’

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

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

1exit
2umount /mnt/{boot,home,boot/efi,}
3reboot

Log in as root.

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

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

Create a new group to match your user:

1groupadd yourgroup
2gpasswd -a youruser yourgroup

Add your user as a sudoer:

1pacman -S sudo
2vi /etc/sudoers

Add:

1youruser  ALL=(ALL) ALL

Install ALSA for sound (more on Sound here):

1pacman -S alsa-utils

Unmute the channels:

1alsamixer

Install the X Window System:

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

Install mesa for 3D support:

1pacman -S mesa

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

1lspci | grep VGA

In my case I have a NVIDIA card:

1pacman -S nvidia

Test X by installing the default environment:

1pacman -S xorg-twm xorg-xclock xterm

Start the test Xorg session:

1startx

To exit back into the shell prompt:

1exit

Install a set of TrueType fonts:

1pacman -S ttf-dejavu

Install a Desktop Environment. Choose here.

I chose GNOME:

1pacman -S gnome gnome-extra

Install a Display Manager. Choose here.

I chose GDM:

1pacman -S gdm

Enable GDM at startup:

1systemctl enable gdm.service

Reboot and enjoy:

1reboot

And that is it. Arch with GNOME is installed.

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

#Linux #Arch Linux