These are some guides for various use.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

193 lines
7.2 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. # Arch installation with LUKS encryption and LVM
  2. This is the English version of the [German installation guide on rvbg.eu](https://wiki.rvbg.eu/#arch/installation.md).
  3. This guide is based upon a [german arch wiki entry](https://wiki.archlinux.de/title/Moderne_Installation_mit_UEFI_und_Verschlüsselung).
  4. At the end of this guide a fully functional Arch Linux will be installed.
  5. ## 1. Preparation
  6. Ahead of the installation an Arch boot-stick has to be created. The iso-file can
  7. be found on the [official website](https://www.archlinux.org/download/).
  8. The iso can be written on an USB-stick using `dd`.
  9. After that the USB can be plugged in the system on which Arch should be installed.
  10. Boot the target system and select `Boot Arch Linux (x86_64)`.
  11. If you need to set the keyboard layout to anything other than english you can
  12. temporarily do so by using the `loadkeys` command.
  13. This has to be followed by your country id (for example a german keyboard layout
  14. would be `de`,`de-latin1` or `de-latin1-nodeadkeys`.
  15. ## 2. Formatting of the target drive
  16. Using `lsblk` you can list all the drives and partitions.
  17. Select a drive to install Arch on.
  18. In this step you can see if old partitions need to be deleted.
  19. For reasons of simplicity the following guide will assume the selected drive to
  20. be `/dev/sda`.
  21. ### Clear disk completely
  22. This step can take quite a while especially for large drives.
  23. - `dd status=progress if=/dev/zero of=/dev/sda`
  24. Now all partitions should be removed.
  25. ### Create new partitions
  26. If you miss click during the progress of the following commands you can press
  27. `CTRL+C` to close the program.
  28. No changes will be made until the confirmation at the end.
  29. The swap partition will be created later under lvm.
  30. - `gdisk /dev/sda`
  31. - `N` - Create a new empty partition table
  32. - `↵ Enter` - Create a partition
  33. - `↵ Enter` - Confirm first sector
  34. - `+512M` - Assign size of 512 MB for the first partition
  35. - `ef00` - Make the partition bootable
  36. - `n` - Create a second partition
  37. - `↵ Enter` - Confirm creation of partition
  38. - `↵ Enter` - Confirm first sector
  39. - `↵ Enter` - Confirm last sector
  40. - `↵ Enter` - Confirm partition type
  41. - `P` - Show created partitions
  42. - `W` - Save all changes
  43. - `Y` - Confirm saving changes
  44. ## 3. Encryption
  45. We need to find out which partitions is the one we want to encrypt.
  46. Using `blkid | grep /dev/sda` all partitions we created get listed.
  47. The right partition has the label `Linux filesystem`.
  48. For this guide this partition is assumed to be `/dev/sda2`.
  49. - `modprobe dm-crypt` - load kernelmodule for encryption
  50. - `cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/sda2` - encryption
  51. - confirm with `YES`
  52. - Now you can assign a passphrase.
  53. The passphrase has to be entered at boot to decrypt the system.
  54. Recovering of this passphrase is **not** possible.
  55. ## 4. Setup LVM
  56. - `cryptsetup luksOpen /dev/sda2 lvm` - Opening encrypted partition and mapping
  57. it to `/dev/mapper/lvm`
  58. - `pvcreate /dev/mapper/lvm` - Create a LVM physical volume
  59. - `vgcreate main /dev/mapper/lvm` - Create LVM Volume Group
  60. - `lvcreate -L 16G -n swap main` - Create Swap in LVM (recommended: swap size
  61. is equal to ram size)
  62. - `lvcreate -l 100%FREE -n root main` - Create LVM Logical Volume for /
  63. ## 5. Create filesystems and mounting them temporarily
  64. We have to find out which partition is our boot-partition.
  65. Using `blkid | grep /dev/sda` once again, we can identify it by looking for the
  66. `EFI system partition` label.
  67. The guide assumes this partition to be at `/dev/sda1`.
  68. - `mkfs.fat -F 32 -n UEFI /dev/sda1` - Assign filesystem of EFI partition
  69. - `mkfs.ext4 -L root /dev/mapper/main-root` - Assign filesystem of root partition
  70. - `mkswap /dev/mapper/main-swap` - Assign swap filesystem
  71. Now the created filesystems will be mounted for the installation.
  72. - `mount /dev/mapper/main-root /mnt` - Mounting root partition
  73. - `mkdir /mnt/boot`
  74. - `mount /dev/sda1 /mnt/boot` - Mount EFI partition
  75. - `swapon /dev/mapper/main-swap` - Mounting swap partition
  76. ## 6. Prepare base installation (optional)
  77. In this step the country specific mirrorserver for the installation will be configured.
  78. This will improve the download speed.
  79. - `cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak` - Create a backup
  80. of mirrorlist
  81. - `grep -E -A 1 ".*Germany.*$" /etc/pacman.d/mirrorlist.bak | sed '/--/d' > /etc/pacman.d/mirrorlist`
  82. - Example command to only use _German_ mirrors
  83. - `cat /etc/pacman.d/mirrorlist` - Check if the file is to your liking. If it is
  84. not, you can just recover by using `mirrorlist.bak`
  85. ## 7. Starting base installation
  86. Now you need a working internet connection.
  87. Plug in your lan cable or use `wifi-menu` to get a wireless connection.
  88. - `pacstrap /mnt base base-devel dosfstools gptfdisk lvm2 linux linux-firmware vim networkmanager`
  89. - Installation of main system with needed tools
  90. - `genfstab -Up /mnt > /mnt/etc/fstab` - creation of fstab
  91. - `arch-chroot /mnt` - Switch into the newly installed system
  92. - `echo ArchLinux > /etc/hostname` - Assign hostname. `ArchLinux` can be changed
  93. for any name of your preference.
  94. ## 8. Set Region and Language
  95. - `echo LANG=en\_US.UTF-8 > /etc/locale.conf` - Assign system Language to be
  96. english (you can use other languages, look into the `/etc/locale.gen` for a list of all available languages)
  97. - `vim /etc/locale.gen` - Assigning system language by uncomment the lines
  98. depending on your needs.
  99. In this example:
  100. ```txt
  101. en_US.UTF-8 UTF-8
  102. ```
  103. - `locale-gen` - Generate languages
  104. - `echo KEYMAP=de-latin1-nodeadkeys > /etc/vconsole.conf` - set the keymap
  105. - `tzselect` - Set region
  106. ## 9. Configure and create kernel-image
  107. - `vim /etc/mkinitcpio.conf`
  108. - Search the line `MODULES=()` and change it to:
  109. `MODULES=(ext4)`
  110. - Search the line `HOOKS=([...])` and change it to:
  111. `HOOKS=(base udev autodetect modconf block keyboard keymap encrypt lvm2 filesystems fsck shutdown)`
  112. - `mkinitcpio -p linux` - generate Kernel-Image
  113. ## 10. Install and configure UEFI bootloader
  114. - `bootctl install` - Prepare bootloader
  115. - `ls -l /dev/disk/by-uuid` - find out the UUID
  116. - `lsblk -no UUID /dev/sda2 | head -n1 > /boot/loader/entries/arch.conf` - print
  117. the UUID in your configuration file
  118. - `vim /boot/loader/entries/arch.conf` - Create configuration
  119. - Change the config to look similar to this:
  120. ```txt
  121. title Arch Linux
  122. linux /vmlinuz-linux
  123. initrd /initramfs-linux.img
  124. options cryptdevice=UUID=<enter your uuid here>:lvm:allow-discards root=/dev/mapper/main-root resume=/dev/mapper/main-swap rw quiet
  125. ```
  126. - `cp /boot/loader/entries/arch.conf /boot/loader/entries/arch-fallback.conf`
  127. - Create a fallback
  128. - `vim /boot/loader/loader.conf` - Create loader configuration
  129. - Insert the following text
  130. ```txt
  131. timeout 0
  132. default arch
  133. ```
  134. ## 11. Finishing base installation
  135. - `passwd` - set password for the root account
  136. - `exit` - exit the installed system
  137. - `umount /mnt/{boot,}` - unmount all partitions
  138. - `shutdown now` - shutdown device
  139. - Now remove the Arch boot-stick
  140. - Start the device again
  141. If the system is installed in a virtual environment or a system with deactivated
  142. UEFI, don't forget to enable the EFI option, otherwise the system won't boot.
  143. Now you can follow my larbs installation script
  144. (`curl -o larbs.sh https://raw.githubusercontent.com/tiyn/larbs/master/larbs.sh`
  145. or go on to other guides.