2014-07-28

ArchLinux Installation Tutorial

ArchLinux is top 10 major Linux binary-based distribution, but in my opinion, it has the easiest source-based installation process. Here's my past experience of minimal installation process:

First, download latest .iso from https://www.archlinux.org/download/
You may want to burn it or dump to USB flashdrive using this command:

dd bs=4M if=/path/to/archlinux-yyyy.mm.dd-dual.iso of=/dev/your_usb_disk

the /dev/your_usb_disk could be found using dmesg or lsblk or gparted command, for example /dev/sdg

Things to do after preparing the boot CD/USB:

1. Boot your PC using that USB or CD/DVD.

2. Find out which partition or disk to be the installation target, normally I only create 1 or 2 partition that is / (root) for software and /home.

lsblk # find disk name
disk=/dev/vda

Create partition using cfdisk command, set bootable, set partition type (83), write and quit.

cfdisk $disk 

Format partitions and mount it:

part=/dev/vda1
mkfs.ext4 $part
mount $part /mnt

3. Update repository, bootstrap and chroot, this process requires internet, make sure you're connected to the internet using DHCP cable connection.

pacman -Syy
pacstrap -i /mnt base base-devel vim bash openssh curl
genfstab -U -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt

4. Configure language, I always prefer Canada and Indonesia, not US.

bash
loadkeys us

Uncomment en_CA.UTF-8 and id_ID.UTF-8, using vim or nano

vim /etc/locale.gen 
locale-gen
export LANG=en_CA.UTF-8

5. Configure time, for example: Jakarta, Indonesia

location=/usr/share/zoneinfo/Asia/Jakarta
ln -s $location /etc/localtime
hwclock --systohc --utc

Clock correction:

current="2014-07-28 21:15:00"
date -s "$current"

6. Change name, use Google DNS, configure network and enable SSH

echo 'your_hostname' > /etc/hostname
echo nameserver 8.8.8.8 > /etc/resolv.conf
systemctl enable sshd

Uncomment PermitRootLogin yes:

vim /etc/ssh/sshd_config 

Check your network device name, could be eno11, eth0, enp1s0, wlp2s1, or anything else.

ip link
dev=eno1

6a. For permanent DHCP

systemctl enable dhcpcd@$dev

6b. For static address

addr=192.168.20.41
nmask=24
bcast=192.168.20.255
gw=192.168.20.1

6b1. for permanent static address

echo "address=$ipaddr
netmask=$nmask
broadcast=$bcast
gateway=$gw
" > /etc/conf.d/network@interface
curl -L 'http://goo.gl/X8d8k9' > /etc/systemd/system/network@.service
systemctl enable network@$dev

6b2. For temporary static address (gone when reboot)

ip link set dev $dev up
ip addr add $addr/$nmask broadcast $bcast dev $dev
ip route add default via $gw

7. Enable 32-bit repository and set password

vim /etc/pacman.conf # uncomment multilib section
pacman -Sy
passwd # remember!

8. Install and configure bootloader, this part really complicated when you're using UEFI BIOS

pacman -S grub-bios os-prober
grub-install --recheck /dev/vda
grub-mkconfig -o /boot/grub/grub.cfg

9. reboot

exit
exit
reboot


Things to do after reboot:

1. Install yaourt, easy way to use AUR

echo '
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
' >> /etc/pacman.conf
pacman -Syy
pacman -Sy yaourt

2. Install desktop environment, one of the lightest DE is Xfce4

pacman -S xfce4 xfce4-goodies gvim gnome-tweak-tool xfwm4 metacity firefox yakuake

3. Install graphic card drivers, this part not required when using intel

# for Nvidia
pacman -Sy xf86-video-nouveau nouveau-dri lib32-nouveau-dri
modprobe nouveau 

# for AMD/ATI
yaourt -Sy catalyst-hook catalyst-libgl catalyst-utils lib32-catalyst-utils lib32-opencl-catalyst opencl-catalyst 

For intel graphic cards mostly you don't need to install additional things other than xorg.
Then reboot or try to start Xserver, see the /var/log/Xorg.0.log file when error

echo exec startxfce4 > ~/.xinitrc
startx

4. Add another admin user

usrnm=your_username
useradd -m -g users -G wheel -s /bin/bash $usrnm
passwd your_username
echo "
%wheel ALL=(ALL) ALL
Defaults:$usrnm timestamp_timeout=86400
" >> /etc/sudoers

5. Install browsers, tools, etc

yaourt --needed --noconfirm -S --force google-chrome chromium traceroute net-tools vlc smplayer sshfs meld gedit bash-completion htop

And so on~ :3