This page looks best with JavaScript enabled

Installation

 ·  ☕ 5 min read

1. Preparation

Follow this for instructions to download the installation medium and methods for booting it to the target machine.

Once image is booted you can set the keyboard layout with:

root: bash
  • root# loadkeys [lang-code]

Where lang-code is the two character country locale:
i.e

  • es: Spanish
  • us: American English

2. Network

Usually network works out-of-the-box when booting from the installation medium. Nevertheless, if problems are found:

2.1. Wireless

Retrieve available network interfaces with:

root: bash
  • root# ip a
  • 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default
  • link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  • inet 127.0.0.1/8 scope host lo
  • valid_lft forever preferred_lft forever
  • inet6 ::1/128 scope host
  • valid_lft forever preferred_lft forever
  • 2: enp2s0: mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
  • link/ether 00:16:96:e3:13:f2 brd ff:ff:ff:ff:ff:ff
  • 3: wlp3s0: mtu 1500 qdisc mq state UP group default qlen 1000
  • link/ether b4:6d:83:9a:9e:53 brd ff:ff:ff:ff:ff:ff
  • inet 192.168.0.132/24 brd 192.168.0.255 scope global dynamic wlp3s0
  • valid_lft 84162sec preferred_lft 84162sec
  • inet6 fe80::b66d:83ff:fe9a:9e53/64 scope link
  • valid_lft forever preferred_lft forever

In this case the wireless interface is wlp3s0.

Run the following command to setup configure the wireless connection:

root: bash
  • root# wifi-menu wlp3s0

Do not forget to replace the interface name for the right one

2.2. Wired

It should be enough to start the DHCP client as:

root: bash
  • root# systemctl restart dhcpd.service

3. Storage devices (Partitions & LVM)

List all devices (hdd) available and make sure you choose the right one:

root: bash
  • root# lsblk
  • NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
  • sda 8:0 0 119.2G 0

Check boot mode

root: bash
  • root# ls /sys/firmware/efivars

3.1. BIOS (GPT) Boot Mode

Create BIOS boot partition:

root: bash
  • root# parted /dev/sdx
  • (parted) mklabel gpt
  • (parted) mkpart primary 1MiB 3MiB
  • (parted) name 1 grub
  • (parted) set 1 bios_grub on

Create the rest of partitions (boot, others )

root: (parted)
  • (parted) mkpart fat32 3MiB 515MiB
  • (parted) set 1 boot on

Set up data partition

root: (parted)
  • (parted) mkpart primary ext4 515MiB 100%

The next step is to format the partitions:

boot partition:

root: bash
  • root# mkfs.fat -F32 /dev/sdxY

data partition:

root: bash
  • root# mkfs.ext4 /dev/sdxY

Now it is turn to setup the LVM.

3.2. UEFI (GPT) Boot Mode

Create one partition for boot systems and another for data/swap/root system.

root: bash
  • root# parted /dev/sdx
  • (parted) mklabel gpt

Set up boot partition

root: (parted)
  • (parted) mkpart ESP fat32 1MiB 513MiB
  • (parted) set 1 boot on

Set up data partition

root: (parted)
  • (parted) mkpart primary ext4 513MiB 100%

The next step is to format the partitions:

boot partition:

root: bash
  • root# mkfs.fat -F32 /dev/sdxY

data partition:

root: bash
  • root# mkfs.ext4 /dev/sdxY

Now it is turn to setup the LVM.

4. LVM Set up

Three logical volumes will be created for:

  • root
  • user’s data
  • swap [optional]
root: bash
  • root# pvcreate /dev/sdax
  • root# vgcreate VolGroup00 /dev/sdax
  • root# lvcreate -L 25G VolGroup00 -n lroot
  • root# lvcreate -L 8G VolGroup00 -n lswap
  • root# lvcreate -l +100%FREE VolGroup00 -n lhome
  • root# modprobe dm_mod
  • root# vgscan
  • root# vgchange -ay

Format the logical volumes

root: bash
  • root# mkfs.ext4 /dev/mapper/VolGroup00-lroot
  • root# mkfs.ext4 /dev/mapper/VolGroup00-lhome
  • root# mkswap /dev/mapper/VolGroup00-lswap
  • root# swapon /dev/mapper/VolGroup00-lswap

5. Mount and create basic installation

root: bash
  • root# mount /dev/mapper/VolGroup00-lroot /mnt
  • root# mkdir /mnt/boot
  • root# mkdir /mnt/home
  • root# mount /dev/sdax /mnt/boot
  • root# mount /dev/mapper/VolGroup00-lhome /mnt/home

Install base system:

root: bash
  • root# pacstrap /mnt base base-devel

Generate fstab:

root: bash
  • root# genfstab -U /mnt > /mnt/etc/fstab

Configure the base system:

root: bash
  • root# arch-chroot /mnt /bin/bash

Install text editor:

root: bash
  • root# pacman -S vim

Set Locale: Uncomment en_US.UTF-8 and es_ES.UTF-8 from /etc/locale.gen and run:

root: bash
  • root# locale-gen
  • root# echo LANG=en_US.UTF-8 > /etc/locale.conf
  • root# echo KEYMAP=es > /etc/vconsole.conf

Set Time:

root: bash
  • root# ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
  • root# hwclock --systohc --utc

Enable NTP:

root: bash
  • root# timedatectl set-ntp true

Initramfs:

Install packages for mkinitpcio, lvm2:

root: bash
  • root# pacman -S linux lvm2

(optionally you can install ’linux-headers')

Edit the following lines in /etc/mkinitcpio.conf to add ’lvm2’ support

/etc/mkinitcpio.conf
1
HOOKS="base udev autodetect modconf block lvm2 filesystems keyboard fsck"

Then regenerate the Initramfs image:

root: bash
  • root# mkinitcpio -p linux

6. Boot loader

Now we need to create a boot loader. This depends if boot mode is EFI or BIOS

1.6.1. BIOS

Install grub packages

root: bash
  • root# pacman -S grub mstools fuse2 dosfstools os-prober

Setup grub

root: bash
  • root# grub-install --targe=i386-pc /dev/sdx

Generate grub config

root: bash
  • root# grub-mkconfig -o /boot/grub/grub.cfg

6.2. EFI

Finally create a boot loader (EFI/GPT):

root: bash
  • root# bootctl install

Create a boot entry in /boot/loader/entries/arch.conf:

/boot/loader/entries/arch.conf
1
2
3
4
title    Arch Linux
linux    /vmlinuz-linux
initrd   /initramfs-linux.img
options  root=/dev/mapper/VolGroup00-lroot rw

Choose the default entry on loader:

/boot/loader/loader.conf
1
2
timeout 3
default arch

Update bootloader:

root: bash
  • root# bootctl install && \
  • bootctl update && \
  • bootctl list && \
  • bootctl

7. Final steps

Set the hostname:

root: bash
  • root# echo slimarch > /etc/hostname

Set hostname

In below case I name my box as arch, you free to name as you wish

root: bash
  • root# hostnamectl status && \
  • hostnamectl set-hostname arch && \
  • hostnamectl status

Set locale

root: bash
  • root# localectl list-locales && \
  • localectl set-locale LANG=en_US.UTF-8

Set root password

root: bash
  • root# passwd

Install and Enable OpenSSH and DHCP Client

root: bash
  • root# pacman -S openssh dhcpcd
  • root# systemctl enable sshd
  • root# systemctl enable dhcpcd

Optionally install some basic linux tools

root: bash
  • root# pacman -S p7zip unzip python go git bash-completion keychain mlocate wget words lsof which lshw

Finally reboot

Ctrl+D -> To exit arch-root

root: bash
  • root# umount -R /mnt
  • root# shutdown -r now

Finally reboot

8. References

Share on

Avatar
WRITTEN BY