Installing Archlinux

Modern linux distributions are really easy to install, every almost flavor has a guided process that helps an user setup a linux box with a series of steps that deploy almost automatically the system. That is really helpful but if don't have real control about whats is really happen. Archlinux is a linux distribution that have a different philosofy where the user has all the control of your system. This post is a simple resume about my personal experience installing an archlinux box following the Official documentacion.

Making a bootable usb

    sudo dd bs=4M if=/home/manuel/Downloads/archlinux-2013.10.01-dual.iso of=/dev/sdx && sync

Loading keyboard layout

    loadkeys us
    loadkeys es

Setting up the hard drive

Partitioning hard drive

The complete instructions to make the partitions are here

    check hard disk size
    fdisk -l | grep Disk

    /boot 300MB
    SWAP 2GB
    /var 22GB
    / 24 GB
    /home 280GB

    gdisk /dev/sda

    ? for help

    o to create a new empty GUID partition table
    n to add new partition
    i show info
    w write disk partition table

    lsblk to check all partitions

    https://wiki.archlinux.org/index.php/File_Systems#Step_2:_create_the_new_file_system

    mkfs -t ext2 /dev/sda1
    mkfs -t ext4 /dev/sda2
    mkfs -t ext4 /dev/sda3
    mkfs -t ext4 /dev/sda4
    mkswap /dev/sda5

Encrypting hard drive

https://wiki.archlinux.org/index.php/Disk_Encryption https://wiki.archlinux.org/index.php/Dm-crypt_with_LUKS

Secure wipe of the hard disk drive

https://wiki.archlinux.org/index.php/Securely_wipe_disk

dd if=/dev/zero of=/dev/sdX iflag=nocache oflag=direct bs=4096
Encrypting and mapping a system partition

https://wiki.archlinux.org/index.php/Dm-crypt_with_LUKS#Encrypting_a_system_partition

cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random --verify-passphrase luksFormat /dev/sda2
cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random --verify-passphrase luksFormat /dev/sda3
cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random --verify-passphrase luksFormat /dev/sda4
Open encrypted partitions:
cryptsetup open --type luks /dev/sda2 root
cryptsetup open --type luks /dev/sda3 var
cryptsetup open --type luks /dev/sda4 home
Format partitions:
mkfs -t ext4 /dev/mapper/root
mkfs -t ext4 /dev/mapper/var
mkfs -t ext4 /dev/mapper/home
Mounting Partitions
mount -t ext4 /dev/mapper/root /mnt
mount -t ext4 /dev/mapper/var /mnt
mount -t ext4 /dev/mapper/home /mnt

Note: /boot partition can not be encrypted

Encrypting the Swap partition

Edit/etc/crypttab

swap         /dev/hdx4        /dev/urandom            swap,cipher=aes-cbc-essiv:sha256,size=256
Mounting /boot Partition:
mkdir /mnt/boot
mount -t ext2 /dev/sda1 /mnt/boot

Connect provisionally to the internet

wifi-menu

Install the base system

Edit/etc/pacman.d/mirrorlist and configure your mirror, then run:

pacstrap /mnt base

Generate an fstab:

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

Install chroot

arch-chroot /mnt

Timezone configuration

Symlink /etc/localtime to /usr/share/zoneinfo/Zone/SubZone. Replace Zone and Subzone to your liking.

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

Uncomment the selected locale in /etc/locale.gen and generate it with locale-gen Set locale preferences in /etc/locale.conf https://wiki.archlinux.org/index.php/Locale#Setting_system-wide_locale

Edit /etc/locale.conf LANG=EN_IE.UTF-8 LANGUAGE="en_IE:es_CO:en" LC_COLLATE="C"

The last step is uptade the system locale-gen

Configure initramfs

Edit /etc/mkinitcpio.conf and uncomment the next line: HOOKS="base udev ... encrypt ... filesystems ..." Then execute mkinitcpio -p linux

Set a root password with passwd

Setting wireless connection

Complete informatin at this link

check the driver status with lspci -k Also check the output of ip link command to see if a wireless interface (e.g. wlan0, wlp2s1, ath0) ip link set wlan0 up

Wireless setup

Install iw tool
pacman -S iw
Get wireless device name
   $ iw dev
    phy#0
    Interface wlp5z1
		ifindex 4
		wdev 0x1
		addr 6c:88:14:6e:d9:90
		type managed
		channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz 
Check device status
$ iw dev  wlp5z1 link
Not connected.
Check what access points are available:
    iw dev wlp5z1 scan | less
install wpa_supplicant:
pacman -S wpa_supplicant
Connection to wpa/wpa2 network

Edit /etc/wpa_supplicant.conf according the options obtained at the scan process

Detailed info can be viewed at https://wiki.archlinux.org/index.php/Wireless_Setup

Install and configure Syslinux boot loader

    pacman -S syslinux
    pacman -S gptfdisk
    syslinux-install_update -i -a -m

    /boot/syslinux/syslinux.cfg

     PROMPT 1
     TIMEOUT 50
     DEFAULT arch
     
     LABEL arch
             LINUX ../vmlinuz-linux
             APPEND root=/dev/sda2 rw
             INITRD ../initramfs-linux.img
     
     LABEL archfallback
             LINUX ../vmlinuz-linux
             APPEND root=/dev/sda2 rw
             INITRD ../initramfs-linux-fallback.img

Install video driver

Check video driver chipset lspci | grep VGA and install the proper driver, in this example, an intel driver pacman -S xf86-video-intel

Install network manager

https://wiki.archlinux.org/index.php/NetworkManager pacman -S networkmanager

Install Gnome and graphical login screen

https://wiki.archlinux.org/index.php/GNOME

pacman -S gnome gnome-extra network-manager-applet
pacman -S gstreamer
pacman -S --force gst-libav
pacman -S vlc
pacman -S flashplugin
pacman -S ttf-dejavu

Basic development Libraries and utils

pacman -S linux-headers
pacman -S gcc make automake

Adding an user and setting sudo

useradd -m -g users -s /bin/bash manuel
pacman -S sudo

Edit configuration file using visudo Add the user relevant information:

manuel ALL=(ALL) ALL