-
Installing
-
Configuration
-
Appearance
This is my first Arch install.
A few people have used/stared/forked my Xubuntu reference guide. I figure since Arch is much more involved I would write a reference guide alongside the install process.
I will be constantly updating this reference guide to add missing content, update current content, resolve inconsistencies, add additional resources, make annotations, etc.
Version:
release 2018.12.01 - kernel 4.19.4
Change the Font:
setfont sun12x22
Update Language & Keyboard layout:
TODO
Time & Date:
timedatectl set-ntp true
Verify Bootmode:
efivar -l
Set Mirrors
TODO
General Networking
ip address
ip link set INTERFACE up
Wireless Configuration
iw dev interface scan | less
wpa_passphrase "SSID" "Password" > /etc/wpa_supplicant/wpa_supplicant.conf
wpa_supplicant -B -i INTERFACE -c /etc/wpa_supplicant/wpa_supplicant.conf
dhcpcd INTERFACE
Drive Preparation
shred -v -z /dev/nvme0n1
OR
cryptsetup open --type plain -d /dev/urandom /dev/nvme0n1 to_be_wipedo
dd if=/dev/zero of=/dev/mapper/to_be_wiped status=progress
.
.
.
cryptsetup close to_be_wiped
Partitioning
gdisk /dev/nvme0n1
GPT fdisk (gdisk) version 1.0.1
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): Y
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-242187466, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-242187466, default = 242187466) or {+-}size{KMGTP}: +512M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): EF00
Changed type of partition to 'EFI System'
Command (? for help): n
Partition number (2-128, default 2):
First sector (34-242187466, default = 1050624) or {+-}size{KMGTP}:
Last sector (1050624-242187466, default = 242187466) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): p
Disk /dev/sda: 242187500 sectors, 115.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 9FB9AC2C-8F29-41AE-8D61-21EA9E0B4C2A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 242187466
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00 EFI System
2 1050624 242187466 115.0 GiB 8300 Linux filesystem
Command (? for help): w
LVM and LUKS
mkfs.vfat -F32 /dev/nvme0n1p1
cryptsetup luksFormat /dev/nvme0n1p2
cryptsetup open --type luks /dev/nvme0n1p2 lvm
pvcreate /dev/mapper/lvm
vgcreate vg0 /dev/mapper/lvm
lvcreate --size 8G vg0 --name swap
lvcreate --size 64G vg0 --name root
lvcreate -l 100%FREE vg0 --name home
disk-encryption
lvm
pvcreate man page
vgcreate man page
lvcreate man page
Create Filesystems on Encrypted Partitions
mkfs.ext4 /dev/mapper/vg0-root
mkfs.ext4 /dev/mapper/vg0-home
mkswap /dev/mapper/vg0-swap
Mount the Partitions
mount /dev/mapper/vg0-root /mnt
mkdir /mnt/boot
mount /dev/mapper/nvme0n1p1
mkdir /mnt/home
mount /dev/mapper/vg0-home /mnt/home
swapon /dev/mapper/vg0-swap
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:1 0 476.7M 1 loop /run/archiso/sfs/airootfs
sda 8:0 0 14.9G 0 disk
├─sda1 259:3 0 588M 0 part /run/archiso/bootmnt
└─sda2 259:2 0 64M 0 part
nvme0n1 259:0 0 477G 0 disk
├─nvme0n1p1 259:3 0 512M 0 part /mnt/boot
└─nvme0n1p2 259:2 0 476.4G 0 part
└─lvm 253:0 0 476.4G 0 crypt
├─vg0-swap 253:1 0 8G 0 lvm [SWAP]
├─vg0-root 253:1 0 64G 0 lvm /mnt
└─vg0-home 253:2 0 404.4G 0 lvm /mnt/home
Install base packages
pacstrap /mnt base base-devel dialog wpa_supplicant vim zsh git
Generate fstab
genfstab -pU /mnt >> /mnt/etc/fstab
Two optional fstab changes:
- You might want to change the
atimeoptions - These impact drive preformance and wear. By default our generated fstab file usesrelatime. This updates file access times if the previous access time was earlier than current modify/change time or access time is older than 24 hours. If using a SSD or NVMe and want to reduce wear on the drive, change all non-boot partitions to usenoatime. However this option doesn't work great with applications that need to know if a file has been read since the last time it was modified. - Change
/tmpdirectory to use the ramdisk instead of the drive. We accomplish this by appending a tmpfs entry to the file.
vim /mnt/ect/fstab
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/mapper/vg0-root
UUID=9a180980-d2bf-40d6-a09a-7a95a378f5e3 / ext4 rw,noatime,data=ordered 0 1
# /dev/mapper/vg0-home
UUID=01e98383-e71a-4319-a70c-348783b1fc4c /home ext4 rw,noatime,data=ordered 0 2
# /dev/mapper/vg0-swap
UUID=bd0fe84a-c662-4976-929f-e1b517c6531b none swap defaults,pri=-2 0 0
# /dev/nvme0n1p1
UUID=F679-59DA /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2
# /tmp ramdisk
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
Switch to Chroot:
arch-chroot /mnt
Update System Clock:
ln -sf /usr/share/zoneinfo/US/Mountain /etc/localtime
hwclock --systohc
Update Computer Hostname:
echo <computer-hostname> > /etc/hostname
Update Locale:
echo LANG=en_US.UTF-8 >> /etc/locale.conf
Set Root Password:
passwd
Add User:
useradd -m -g users -G wheel -s /bin/zsh <USERNAME>
passwd <USERNAME>
Update Sudoers File:
visudo
Find and uncomment this line:
%wheel ALL=(ALL) ALL
Update mkinitcpio:
We are using disk encryption so we need to update the mkinitcpio with modules for initramfs.
Update MODULES to use ext4.
Update HOOKS to include modules keymap, encrypt, lvm2 and resume before filesystems.
vim /etc/mkinitcpio.conf
MODULES="ext4"
.
.
.
HOOKS="base udev autodetect modconf block keymap encrypt lvm2 resume filesystems keyboard fsck"
Regenerate the initramfs:
mkinitcpio -p linux
Install bootloader:
bootctl --path=/boot install
Create bootloader entry:
vim /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID={UUID}:lvm:allow-discards resume=/dev/mapper/vg0-swap root=/dev/mapper/vg0-root rw quiet
To easily get the UUID, this Vim command adds a line to the current file that includes the UUID.
:read ! blkid /dev/nvme0n1p2
Update bootloader config:
vim /boot/loader/loader.conf
timeout 0
default arch
editor 0
Exit chroot:
exit
Unmount all drives and partitions:
umount -R /mnt
Reboot into new installation:
reboot
