Guest User

Untitled

a guest
Feb 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. # Create bootable USB
  2.  
  3. ```bash
  4. dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync
  5. ```
  6.  
  7. # Boot from USB and set prepare system
  8.  
  9. ```bash
  10. loadkeys <your-keymap>
  11. timedatectl set-ntp true
  12. ```
  13.  
  14. # Connect to wifi
  15.  
  16. ```bash
  17. wifi-menu
  18. ```
  19.  
  20. # Partition the disk with gdisk
  21.  
  22. We will create 2 partitions, one for boot partition and one for LUKS encrypted partition
  23.  
  24. ```bash
  25. gdisk /dev/sda
  26. ```
  27.  
  28. ```
  29. GPT fdisk (gdisk) version 1.0.1
  30.  
  31. Partition table scan:
  32. MBR: protective
  33. BSD: not present
  34. APM: not present
  35. GPT: present
  36.  
  37. Found valid GPT with protective MBR; using GPT.
  38.  
  39. Command (? for help): o
  40. This option deletes all partitions and creates a new protective MBR.
  41. Proceed? (Y/N): Y
  42.  
  43. Command (? for help): n
  44. Partition number (1-128, default 1):
  45. First sector (34-242187466, default = 2048) or {+-}size{KMGTP}:
  46. Last sector (2048-242187466, default = 242187466) or {+-}size{KMGTP}: +512M
  47. Current type is 'Linux filesystem'
  48. Hex code or GUID (L to show codes, Enter = 8300): EF00
  49. Changed type of partition to 'EFI System'
  50.  
  51. Command (? for help): n
  52. Partition number (2-128, default 2):
  53. First sector (34-242187466, default = 1050624) or {+-}size{KMGTP}:
  54. Last sector (1050624-242187466, default = 242187466) or {+-}size{KMGTP}:
  55. Current type is 'Linux filesystem'
  56. Hex code or GUID (L to show codes, Enter = 8300):
  57. Changed type of partition to 'Linux filesystem'
  58.  
  59. Command (? for help): p
  60. Disk /dev/sda: 242187500 sectors, 115.5 GiB
  61. Logical sector size: 512 bytes
  62. Disk identifier (GUID): 9FB9AC2C-8F29-41AE-8D61-21EA9E0B4C2A
  63. Partition table holds up to 128 entries
  64. First usable sector is 34, last usable sector is 242187466
  65. Partitions will be aligned on 2048-sector boundaries
  66. Total free space is 2014 sectors (1007.0 KiB)
  67.  
  68. Number Start (sector) End (sector) Size Code Name
  69. 1 2048 1050623 512.0 MiB EF00 EFI System
  70. 2 1050624 242187466 115.0 GiB 8300 Linux filesystem
  71.  
  72. Command (? for help): w
  73. ```
  74.  
  75. # Format, encrypt and mount partitions
  76.  
  77. I will create only swap and root partitions, but here you can create home, var and other partitions if you wish.
  78.  
  79. ```bash
  80. mkfs.vfat -F32 /dev/sda1
  81.  
  82. cryptsetup -v luksFormat /dev/sda2
  83. cryptsetup luksOpen /dev/sda2 luks
  84.  
  85. pvcreate /dev/mapper/luks
  86. vgcreate vg0 /dev/mapper/luks
  87. lvcreate -L 4G vg0 -n swap
  88. lvcreate -l +100%FREE vg0 -n root
  89.  
  90. mkfs.ext4 /dev/mapper/vg0-root
  91. mkswap /dev/mapper/vg0-swap
  92.  
  93. mount /dev/mapper/vg0-root /mnt
  94. swapon /dev/mapper/vg0-swap
  95.  
  96. mkdir /mnt/boot
  97. mount /dev/sdX1 /mnt/boot
  98. ```
  99.  
  100. # Install base system
  101.  
  102. ```bash
  103. pacstrap /mnt base base-devel
  104. ```
  105.  
  106. # Generate fstab
  107.  
  108. ```bash
  109. genfstab -pU /mnt >> /mnt/etc/fstab
  110.  
  111. cat /mnt/etc/fstab
  112. #
  113. # /etc/fstab: static file system information
  114. #
  115. # <file system> <dir> <type> <options> <dump> <pass>
  116. # /dev/mapper/vg0-root
  117. UUID=44bc2285-0443-44d6-8208-e914638ee1b1 / ext4 rw,noatime,data=ordered 0 1
  118.  
  119. # /dev/sda1
  120. UUID=AEF3-11A1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2
  121.  
  122. # /dev/mapper/vg0-swap
  123. UUID=708a05f7-633c-4f0f-a16b-3abce7def965 none swap defaults 0 0
  124.  
  125. ```
  126. If you have SSD change relatime on all non-boot partitions to noatime.
  127.  
  128. # chroot into new system and prepare it
  129.  
  130. ```bash
  131. arch-chroot /mnt
  132.  
  133. ln -s /usr/share/zoneinfo/Europe/Helsinki /etc/localtime
  134. hwclock --systohc
  135.  
  136. echo <your-hostname> > /etc/hostname
  137.  
  138. pacman -S fish
  139. pacman -S dialog wpa_supplicant
  140.  
  141. passwd
  142. useradd -m -G wheel -s /usr/bin/fish <username>
  143. passwd <username>
  144.  
  145. ```
  146. # Set locales
  147. Uncomment en_US.UTF-8 UTF-8 and other needed localizations in /etc/locale.gen
  148. ```bash
  149. echo LANG=en_US.UTF-8 > /etc/locale.conf
  150. echo KEYMAP=<your-keymap> > /etc/vconsole.conf
  151. locale-gen
  152. ```
  153.  
  154. # mkinitcpio
  155.  
  156. ```bash
  157. bootctl --path=/boot install
  158. ```
  159.  
  160. Edit /etc/mkinitcpio.conf
  161.  
  162. ```
  163. MODULES="ext4"
  164. .
  165. .
  166. .
  167. HOOKS="base udev autodetect modconf block keymap encrypt lvm2 resume filesystems keyboard fsck"
  168. ```
  169.  
  170. ```bash
  171.  
  172. ```
  173. # Configure bootloader
  174.  
  175. Create /boot/loader/entries/arch.conf
  176.  
  177. ```
  178. title Arch Linux
  179. linux /vmlinuz-linux
  180. initrd /initramfs-linux.img
  181. options cryptdevice=UUID=<YOUR-PARTITION-UUID>:lvm:allow-discards resume=/dev/mapper/vg0-swap root=/dev/mapper/vg0-root rw quiet
  182. ```
  183.  
  184. Edit /boot/loader/loader.conf
  185.  
  186. ```
  187. timeout 0
  188. default arch
  189. editor 0
  190. ```
  191.  
  192. # Finish installation and boot to new system
  193.  
  194. ```bash
  195. mkinitcpio -p linux
  196. exit
  197. umount -R /mnt
  198. reboot
  199. ```
Add Comment
Please, Sign In to add comment