-
Notifications
You must be signed in to change notification settings - Fork 0
Setting up Arch Linux
A secure Arch linux setup with UEFI, encrypted LVM LUKS and hardened system. Download the current version of Arch Linux which can be downloaded at archlinux.org/download. If Arch is being setup on a virtual machine make sure to change settings to UEFI.
- An internet connection throughout the installation
- UEFI is required
- Arch Linux ISO
- Patience
Check if your system is running UEFI by entering the following:
# ls /sys/firmware/efiSetup wifi or ethernet so the packages can be downloaded from the mirrors later on.
Check the connectivity by pinging Google:
# ping -c 3 8.8.8.8Get mirrorlists from your location and add them to configuration file.
# vim /etc/pacman.d/mirrorlistGdisk can be used to identity the partitions currently on your system and create new partitions
gdisk /dev/sda
gdisk -o
gdisk -n
gdisk -w
Encrypt the partitions (LUKS) To encrypt the our entire system we will be using LUKS. This will encrypt the LVM /dev/sda2 with LUKS.
# cryptsetup luksFormat /dev/sda2The name you choose for your LVM is the last step will be used for the "lvm" here.
# cryptsetup open —type luks /dev/sda2 lvmSetup phsical volume:
# pvcreate /dev/mapper/lvmSetup volume and volume name
# vgcreate volume /dev/mapper/lvmLogical volume setup. The swap lvcreate is optional depending on if you need / want swap space. The swap space does not require a large amount of space, 4GB is used.
# lvcreate -L4G volume -n swapThe root size will depend on how big your disk space is, in my example i am going with 20G.
# lvcreate -L20G volume -n rootThe home lvcreate will allocate any other space available to home.
# lvcreate -l FREE100% volume -n homeFormat the partitions with ex54 and swap if used in previous steps.
# mount /dev/mapper/volume-root /mnt
# mkdir /mnt/home
# mkdir /mnt/boot
# mount /dev/mapper/volume-home /mnt/home
# mount /dev/sda1 /mnt/boot
# swapon /dev/mapper/volume-swap
Now that we have setup the partiitons, LVM and mounted them. We can begin installing the base system and setup configuration files. Start by installing base and base-devl. In addition to installing the base system we are installing some wifi tools, Vim and sudo.
# pacstrap /mnt base base-devel wireless_tools dialog wpa_supplicant wpa_actiond vim sudoFstab is the file system table used to decide how each partition is used. To generate fstab we type the following line:
# genfstab -p /mnt >> /mnt/etc/fstab# arch-chroot /mntEdit the locale.gen file and uncomment your country
# vim /etc/locale.genOnce your location is uncommented, enter the following commands:
# locale-gen
# locale > /etc/locale.conf
Enter hostname:
# vim /etc/hostnameSetup the timezone:
# ln -s /usr/share/zoneinfo/Europe/London /etc/localtimeSetup the clock:
# hwclock —systohc —utcEnable the 32 bit repositories (optional), this allows you to install extra packages if needed. Allows both 64 and 32bit programs to be installed. To enable this edit the configuration file and uncomment [multilib].
# vim /etc/pacman.conf
# pacman -Sy
Setup a root password:
# passwdAdd a user: (NAME is the user)
# useradd -m -g users -G wheel, storage,power -s /bin/bash NAMESetup users password:
# passwd NAMEConfigure the sudoers file:
# vim /etc/sudoersUncomment the line to allow the new user to use 'sudo':
%wheel ALL=(ALL) ALL# vim /etc/mkinitcpio.confAdd encrypt and lvm2 to the line below after keyboard. This will allow you to use the keyboard to enter your password before 'encrypt' is run. If this is not entered, the keyboard will not work when entering the password.
# base udev autodetect modconf block keyboard encrypt lvm2 filesystem fsck. # mkinitcpio -p linuxSetup the boot loader path:
# bootctl —path=/boot/ installEdit the config file with following lines:
# vim /boot/loader/loader.conf
default arch
timeout 5
editor 0
Setup the boot loader UUID:
# vim /boot/loader/entries/arch.confGet the UUID in Vim:
:read ! blkid /dev/sda2Enter the following code in this configuration file:
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=1234-566-67-80:volume root=/dev/mapper/volume-root quiet rw
To finish off the installation we need to exit chroot, umount all the partitions, and reboot the machine.
# exit
# umount -R /mnt
# reboot
Once the machine has been rebooted, a login prompt will appear.