Browse to archlinux.org/download and get a bootable ISO file.
# journalctl -lf
If you are running Linux, find the pendrive’s device name and burn the ISO to it
# dd if=archlinux-2018.08.01.iso of=/dev/sdx status=progress # sync
In any other case, try a burning tool such as Rufus to achieve the same:
http://rufus.akeo.ie/
Once you got a bootable pendrive, boot the target computer «the UEFI way»
- Insert the pendrive,
- Power on
- Press the «boot menu» key, which -unfortunately- is hardware dependent
- In my computer, this key is F8
- Wait until you get a shell prompt
root@archiso [~]
Set keyboard layout
# loadkeys es
Check network
# ip address # ip route # cat /etc/resolv.conf
If you did not get a valid IP configuration, try finding the network device name in the output of «ip address show». In my computer is: enp3s0
# ip address show # ip address add 192.168.1.37/24 dev enp3s0 # ip link set dev enp3s0 up # ip route add default via 192.168.1.1
Check disk
# fdisk -l /dev/sda
Partition disk. This is a destructive operation. You should NOT use it if you need to preserve existing data. This is a sample layout for a 30 GiB disk:
- Partition 1 – 150 MiB – FAT32 – «EFI System» stuff
- Partition 2 – 600 MiB – EXT2 – boot
- Partition 3 – 26 GiB – LVM EXT4 – root
- Partition 4 – 3.3. GiB – LVM – swap
These are the common fdisk subcommands that will be used step by step below:
- «g» for new GPT table
- «n» for new partition
- «t» to change partition type
- «p» prints current layout
- «w» to save and exit
Enter fdisk and create GPT table
# fdisk /dev/sda g
Create first partition and change type to 1 «EFI System»
n 1 2048 +150M t 1 1
Second partition
n 2 (Enter accepts creating the second partition after the first one) +600M (No need to change type. "Linux filesystem" is the default)
Third and fourth partitions
n 3 (Enter creates after the second one) +26G t 3 31 (LVM physical volume) n 4 (Enter for suggested beginning) (Enter to span to the end of the disk) t 4 31 (LVM physical again)
Write and exit
w
Check messages and reboot if requested.
(If you do, ensure booting from USB UEFI again)
Create LVM physical volumes
# pvcreate /dev/sda3 /dev/sda4 # vgcreate vgroot /dev/sda3 # vgcreate vgswap /dev/sda4 # lvcreate -l 100%FREE -n lvroot vgroot # lvcreate -l 100%FREE -n lvswap vgswap
Print what you got
# pvs # vgs # lvs
Create filesystems
# mkfs -t msdos -F32 /dev/sda1 # mkfs -t ext2 /dev/sda2 # mkfs -t ext4 /dev/mapper/vgroot-lvroot # mkswap /dev/mapper/vgswap-lvswap
Mount all filesystems in temporary location
# mount /dev/mapper/vgroot-lvroot /mnt # mkdir /mnt/boot # mount /dev/sda2 /mnt/boot # mkdir /mnt/boot/efi # mount /dev/sda1 /mnt/boot/efi # swapon /dev/mapper/vgswap-lvswap
Strap base OS to temporary
# pacstrap /mnt base base-devel grub-efi-x86_64 zsh vim git efibootmgr dialog wpa_supplicant sudo
Generate fstab (Suggestion: change relatime to noatime in all non-noot partitions of ssd)
# genfstab -pU /mnt >> /mnt/etc/fstab
Add ramdisk for tmp
# echo "tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=2G" >> /mnt/etc/fstab
Chroot to temporary
# arch-chroot /mnt /bin/bash
Setup timezone and clock
# ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime # hwclock --systohc --utc
Set hostname and locale
# echo "yourHostNameHere" > /etc/hostname # echo "127.0.0.1 localhost localhost.localdomain" > /etc/hosts # echo "127.0.1.1 yourHostNameHere.yourDomain yourHostNameHere" >> /etc/hosts
Edit /etc/locale.gen and uncomment es_ES and en_US entries. Run locale-gen:
# locale-gen
Create or update locale.conf
# echo "LANG=es_ES.UTF-8" > /etc/locale.conf # echo "LANGUAGE=es_ES.utf8" >> /etc/locale.conf # echo "LC_ALL=es_ES.UTF-8" >> /etc/locale.conf
Create or update vconsole.conf
# echo "KEYMAP=es" > /etc/vconsole.conf # echo "FONT=Lat2-Terminus16" >> /etc/vconsole.conf
In /etc/mkinitcpio.conf
- Add ‘ext4’ to MODULES
- Add ‘lvm2’ to HOOKS before ‘filesystems’
Generate initial ramdisk.
# mkinitcpio -p linux
Add the following line to /etc/default/grub.
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
Install grub to the hard disk.
# grub-install --recheck /dev/sda # grub-mkconfig -o /boot/grub/grub.cfg
Create at least an admin user, and change root password
# useradd -m -s /bin/bash -c "Admin User" -G wheel yourUserNameHere # echo "YourUserNameHere:YourUserPasswordHere" | chpasswd # echo "root:yourRootPasswordHere" | chpasswd
Uncomment the line that grants admin privileges to the «wheel» group
# visudo
Install a network helper as your newly created system won’t connect by default:
# pacman -S networkmanager # systemctl enable NetworkManager
Exit the jail and reboot
# exit # umount -R /mnt # swapoff -a # reboot
That’s all folks! OH NO! You want a desktop environment… but that’s another story.
Addendum: Things I forgot.
localectl set-x11-map es sudo ip addr add 192.168.122.33/24 dev ens33 sudo ip link set dev ens33 up sudo ip route add default via 192.168.122.2 echo "nameserver 192.168.122.2" >> /etc/resolv.conf