Notes on installing archlinux from scratch

1 After booting on archlinux ISO file

Start loading the french keymap

loadkeys fr

2 Create and format the partitions :

First look if any partition is already present

fdisk -l

If yes, then either use them and go directly to the "Mounting" part or, format the disk using fisk or cfdisk utility.

Different strategies can then be adopted (see https://wiki.archlinux.org/index.php/Partitioning). For the time being, I have adopted the following and pretty simple one :

  • a 20 Gb root partition
  • all the other bytes for the /home partition

To do a fresh install, enter into fdisk utility. Inside fisk prompt, delete all previous partition by typing d several times until there are no more partition. Then create a new one by typing n, use default number value as well as starting block and then set the 20 Gb size by writing +20G. Repeat the operation for the /home partition. Finally, write the new table partition using w letter.

Example of fdisk partition :

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 39063551 19530752 83 Linux
/dev/sda2   39063551 500118191 230527320 83 Linux

Format partition is done with mkfs utility

mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2

3 Mount the partitions

mount /dev/sda1 /mnt
mkdir /mnt/home && mount /dev/sda2 /mnt/home

4 Connect to the internet

Use the wifi-menu utility, choose the wifi name and set the WPA key. To use eduroam network, first create a wlp12s0-eduroam file inside /etc/netctl directory. Edit it and add the following lines

Interface=wlp12s0
Connection=wireless
Security=wpa-configsection
IP=dhcp
WPAConfigSection=(
    'ssid="eduroam"'
    'proto=RSN'
    'key_mgmt=WPA-EAP'
    'pairwise=CCMP'
    'auth_alg=OPEN'
    'eap=PEAP'
    'identity="XXXX.XXXX@u-psud.fr"'
    'password="XXXX"'
)

Finally, start the connection with the above profile by doing

netctl start wlp12s0-eduroam

5 Install the base system

pacstrap /mnt base base-devel

If you get errors like

error: could not open file /mnt/var/lib/pacman/sync/core.db: Unrecognized archive format

just remove the corresponding file i.e. /mnt/var/lib/pacman/sync/core.d. These errors mainly come from broken download links and thus corrupted database.

6 Configure the system

6.1 Generate a fstab

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

6.2 Next chroot into our newly installed system

arch-chroot /mnt

6.3 Symlink /etc/localtime

ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
hwclock --systohc --utc

6.4 Generate locale-gen

Uncomment the lines starting with fr_FR in /etc/locale.gen and then do

locale-gen

6.5 Finally do

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

6.6 Configuring the Console Keymap

cd /usr/share/kbd/keymaps/i386/azerty

Copy your default keymap (fr-pc.map.gz) to a new file fr-pc-personal.map.gz Gunzip the new map file. Edit fr-pc-personal.map using your favorite editor.

  • Swap CapsLock with Escape (Vim)

make keycode 1 = CapsLock and keycode 58 = Escape Gzip the map file Change the default keyboard layout file that will be used by editing /etc/vconsole.conf and adding KEYMAP=fr-pc-personal

6.7 Create a user account

First set the root password

passwd

and install sudo command

pacman -S sudo

Once you've installed sudo, you can allow your new user to run it by editing your sudoers file:

EDITOR=nano visudo

Scroll down until you find this line and uncomment it:

%wheel ALL=(ALL) ALL

Before creating a user account, install zshell

pacman -S zsh

Create a user account

useradd -m -g users -G wheel,storage,power -s /bin/zsh garrido
passwd garrido

6.8 Set the hostname

To set a hostname to the machine different from localhost (laptop machines are recognized as garrido-laptop, do

echo "garrido-laptop" > /etc/hostname

6.9 Install your GRUB bootloader

pacman -S grub-bios
grub-install --target=i386-pc --recheck /dev/sda
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

Target is always i386-pc even if the laptop/pc is a 64 bits machine

Run

grub-mkconfig -o /boot/grub/grub.cfg

6.10 Setup your network

pacman -S wirelesstools wpasupplicant wpaactiond dialog wifi-menu systemctl enable net-auto-wireless.service #+ENDSRC

6.11 Exit, unmount partitions and reboot

exit
umount /mnt/home
umount /mnt
reboot

7 Setting sound, video, X window and package manager

7.1 Network setup

Event if you generate a profile via the 4 section, you may need to generate again your network profile. To do that just copy-paste the configuration given in 4 section into /etc/netctl (with root privilege i.e. using sudo) and then start the network by doing

sudo netctl start wlp12s0-eduroam

7.2 Sound, video and mouse drivers

  • Get sound

    sudo pacman -S alsa-utils
    alsamixer
    speaker-test -c 2
    

    To deactivate the PC speaker beeps, you can do temporarly sudo rmmod pcspkr. To apply it globally follow this page and try one of the recommending method.

  • Install video driver (Intel)

    sudo pacman -S xf86-video-intel
    
  • Install mouse driver

    sudo pacman -S xf86-input-synaptics
    

7.3 X window

  • Install X window system
sudo pacman -S xorg-server xorg-xinit xorg-server-utils
  • Test default X environnement
sudo pacman -S xorg-twm xorg-xclock xterm
startx

7.4 Package managers

7.4.1 yaourt

yaourt is a pacman front-end which support arch user repository aka AUR. To use it as default package manager, add the following line into /etc/pacman.conf

[archlinuxfr]
Server = http://repo.archlinux.fr/$arch

Then do

sudo pacman -Sy yaourt

7.4.2 python-pip

Some python applications can be installed through pacman/yaourt but others are easily installed using pip manager. To install pip, just do

yaourt -S python-pip

By the way, this will automatically installed the latest version of python (currently the 3.5 version).

8 Package installation

yaourt -S openssh rsync wget

Install git and subversion

yaourt -S git subversion

Install ubuntu font

yaourt -S ttf-ubuntu-font-family

Install terminator

yaourt -S terminator

Install emacs

yaourt -S emacs

Install chromium

yaourt -S chromium

Install thunderbird

yaourt -S thunderbird

Install xfce4 stuff

yaourt -S xfce4-notifyd thunar xfce4-volman file-roller

Misc.

yaourt -S unzip mlocate flashplugin

9 Install Openbox and set-up the working environment

9.1 Openbox

Openbox is a lightweight with respect to other window environment, powerful, and highly configurable stacking window manager with extensive standards support.

yaourt -S openbox

In addition to openbox, obconf allows to easily configure the window manager. tint2, hsetroot and dunst are respectively used as windows/applications panel, desktop wallpaper and popup notification.

yaourt -S obconf tint2 hsetroot dunst

9.2 dotfiles

Most of the configuration parameters are stored through dotfiles that stay in the home directory. To handle this set of files, we use the dotfiles tool to sync a given repository of files with the home directory. To install dotfiles, you need to have python-pip installed (see 7.4)

pip install --user dotfiles

dotfiles binary is installed within ~/.local/bin directory. Either export this directory to your path and run dotfiles by typing ~/.local/bin/dotfiles.

Then, you need to checkout the repository of dotfiles that you can find https://github.com/xgarrido/dotfiles.

mkdir -p ~/Development/dotfiles
git clone https://github.com/xgarrido/dotfiles ~/Development/dotfiles

Finally install dotfiles by doing

~/.local/bin/dotfiles -R ~/Development/dotfiles --sync

Some directories are not linked so you have to do it

mkdir -p ~/.config
ln -sf ~/Development/dotfiles/openbox ~/.config/
ln -sf ~/Development/dotfiles/terminator ~/.config/

9.3 myrepos

The myrepos application a tool to manage all your version control repositories given a ~/.mrconfig file. To ensure everything will be checkout, you will need to install subversion VCS.

yaourt -S subversion

Checkout the myrepos repository and install it

git checkout https://github.com/joeyh/myrepos ~/Development/github/myrepos
cd ~/Development/github/myrepos && sudo make install

Finally run the mr binary within the home directory i.e.

cd ~ && mr checkout

10 Running openbox

Given you have successfully fill the previous item, openbox can be run through tty terminal by typing startx.

File under version control - commit 1b7d8a5 - 2015-10-19