Laptop setup
Posted on Sat 04 June 2016 in Linux
Pretty much everything here is from Mattias Lundberg's notes and binaerbaum's changes, kudos to them both :)
Download the Arch Linux installation ISO and write it to your choice of installation medium.
BIOS settings
We need to disable secure boot and make sure the SATA operation mode is not "RAID On" or the installer won't find the hard drive.
When booting your laptop, press F12 and select "BIOS Setup" from the menu. In BIOS, expand the "Secure Boot" menu item, select "Secure Boot Enable" from the submenu and change the setting to "Disabled". Apply.
Expand the "System Configuration" menu item and select "SATA Operation" from the submenu and change the setting to "AHCI". Apply.
Exit BIOS to reboot.
Boot the Arch Linux installer
When booting your laptop, press F12 and select your installation medium from the boot menu.
Key map and WIFI
Unless you have a english keyboard layout you will probably want to load another key map, for instance:
loadkeys sv-latin1
To install over WIFI we need to connect to a network:
wifi-menu
Setting up disks
First off we partition the hard drive into two partitions, one for the /boot filesystem and one for the encrypted root filesystem.
cgdisk /dev/nvme0n1
1 512MB EFI partition # Hex code ef00
2 100% size partiton # (to be encrypted) Hex code 8300
Create the filesystem for partition we will use for /boot:
mkfs.vfat -F32 /dev/nvme0n1p1
Encrypt the partition we will use for the root filesystem:
cryptsetup -c aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 3000 -y --use-random luksFormat /dev/nvme0n1p2
cryptsetup luksOpen /dev/nvme0n1p2 luks
Next we will use LVM on our encrypted block device:
pvcreate /dev/mapper/luks
vgcreate vg00 /dev/mapper/luks
lvcreate --size 16G vg00 --name swap
lvcreate -l +100%FREE vg00 --name root
Finally we create the filesystems:
mkfs.xfs /dev/mapper/vg00-root
mkswap /dev/mapper/vg00-swap
Mount the filesystems
mount /dev/mapper/vg00-root /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
Prepare for chroot
Install some packages:
pacstrap /mnt base base-devel vim git sudo efibootmgr dialog wpa_supplicant
Create fstab in the new root filesystem:
genfstab -pU /mnt >> /mnt/etc/fstab
Edit the /mnt/etc/fstab file:
vim /mnt/etc/fstab
#Add the below line to make /tmp a RAM disk
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
#Use noatime instead of relatime in the options
#for / and /boot
Configure the system
First we enter chroot in the new root filesystem:
arch-chroot /mnt /bin/bash
Set system clock:
ln -s /usr/share/zoneinfo/Europe/Stockholm /etc/localtime
hwclock --systohc --utc
Set the hostname:
echo MYHOSTNAME > /etc/hostname
Generate locale by uncommenting the locales you want in /etc/locale.gen:
vim /etc/locale.gen
locale-gen
localectl set-locale LANG=en_US.UTF-8
echo LANG=en_US.UTF-8 >> /etc/locale.conf
echo LC_ALL= >> /etc/locale.conf
Set up root and user account:
passwd #To set password for the root account
useradd -m -g users -G wheel,storage,power -s /bin/bash MYUSERNAME
passwd MYUSERNAME
Configure mkinitcpio to support encrypted filesystems and resuming from sleep:
vim /etc/mkinitcpio.conf
#Edit the line starting with HOOKS= by adding "encrypt lvm2 resume"
#after "udev" in the list. Resulting in something like:
HOOKS="base udev encrypt lvm2 resume autodetect modconf block filesystems keyboard fsck"
#Generate the new initrd image
mkinitcpio -p linux
Install and configure the boot loader to the /boot partition:
bootctl --path=/boot install
echo 'default arch' >> /boot/loader/loader.conf
echo 'timeout 5' >> /boot/loader/loader.conf
Grab the UUID for your encrypted partition:
blkid /dev/nvme0n1p2
Create the boot loader entry for booting Arch Linux:
vim /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=YOUR_UUID_FROM_ABOVE:vg00 root=/dev/mapper/vg00-root resume=/dev/mapper/vg00-swap rw
Final steps
exit #from the chroot
umount -R /mnt
reboot
Install and configure KDE
Once you have rebooted into your new installation of Arch Linux we start by setting up our graphical environment:
pacman -Syy
pacman -S xorg-server xf86-video-intel sddm plasma-meta kde-applications-meta
#You can skip kde-applications-meta if you want a lighter installation
#Enable the display manager so it starts at boot
systemctl enable sddm
#Configure SDDM with the KDE Breeze theme
vim /etc/sddm.conf
[Theme]
Current=breeze
#Now lets launch SDDM and all the fancy stuff
systemctl start sddm
DPI settings
If all went well and you are now in KDE, the first thing you probably want to do is configure DPI to have text and elements be larger and easier to read.
To do this open "System Settings", "Font" and use "Force font dpi" with a suitable number, for me it is 125. The higher number, the larger text and interface elements will appear.
Chrome / Chromium is a bit messy - but essentially what you have to do is run "kmenuedit", navigate to Chromium in the "Internet" category and edit the command field to something like:
chromium --force-device-scale-factor=1.5 %U
Now when you open chrome from the application menu the UI will be larger.