notebook/IT/linux/arch_install.md
vincent efbd8ba596
All checks were successful
continuous-integration/drone/push Build is passing
finish markdown linting
2021-04-20 23:13:14 +02:00

131 lines
4.0 KiB
Markdown

# arch install
![arch](../img/Arch_Linux_logo.svg.png)
The following is a brief installation tutorial for [Arch Linux][1]. It assumes
familiarity with the Arch [Beginner's Guide][2] and [Installation Guide][3].
It will provide a system using [LVM on LUKS][4].
Note that this guide assumes you are performing the install to `/dev/sda`. In
some cases, you may find that your USB install disk claimed `/dev/sda` and you
want to install to `/dev/sdb`. Confirm which disk is which before proceeding.
Boot into the Arch installer.
If your console font is tiny ([HiDPI][7] systems), set a new font.
setfont sun12x22
Connect to the Internet.
Verify that the [system clock is up to date][8].
timedatectl set-ntp true
(bios mode)
parted -s /dev/sda mklabel msdos
parted -s /dev/sda mkpart primary 1MiB 513MiB
parted -s /dev/sda mkpart primary 1024MiB 100%
mkfs.ext2 /dev/sda1
mkfs.ext4 /dev/sda2
(UEFI mode) Create partitions for EFI, boot, and root.
parted -s /dev/sda mklabel gpt
parted -s /dev/sda mkpart primary fat32 1MiB 513MiB
parted -s /dev/sda set 1 boot on
parted -s /dev/sda set 1 esp on
parted -s /dev/sda mkpart primary 513MiB 1024MiB
parted -s /dev/sda mkpart primary 1024MiB 100%
mkfs.ext4 /dev/sda2
mkfs.fat -F32 /dev/sda1
Create and mount the encrypted root filesystem. Note that for UEFI systems
this will be partition 3.
pvcreate /dev/sda3pc
vgcreate arch /dev/mapper/lvm
lvcreate -L 4G arch -n swap
lvcreate -L 30G arch -n root
lvcreate -l +100%FREE arch -n home
lvdisplay
mkswap -L swap /dev/mapper/arch-swap
mkfs.ext4 /dev/mapper/arch-root
mkfs.ext4 /dev/mapper/arch-home
mount /dev/mapper/arch-root /mnt
mkdir /mnt/home
mount /dev/mapper/arch-home /mnt/home
swapon /dev/mapper/arch-swap
(UEFI mode) Encrypt the boot partition using a separate passphrase from
the root partition, then mount the boot and EFI partitions.
mkdir /mnt/boot
mount /dev/sda2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi
Optionally [edit the mirror list][9].
vi /etc/pacman.d/mirrorlist
Install the [base system][10].
pacstrap -i /mnt base base-devel net-tools wireless_tools dialog wpa_supplicant openssh git grub ansible
(UEFI mode) $ pacstrap /mnt efibootmgr
Generate and verify [fstab][11].
genfstab -U -p /mnt >> /mnt/etc/fstab
less /mnt/etc/fstab
Change root into the base install and perform [base configuration tasks][12].
arch-chroot /mnt /bin/bash
systemctl enable dhcpcd.service
systemctl enable sshd.service
passwd
modifier /etc/ssh/sshd_config et mettre PermitRoorlogin yes
Set your mkinitcpio.
only for UEFI
sed -i 's/^HOOKS=.*/HOOKS="base udev autodetect modconf block keyboard lvm2 resume filesystems fsck"/' /etc/mkinitcpio.conf
for both
mkinitcpio -p linux
Configure GRUB.
# BIOS mode
$ grub-install /dev/sda
$ grub-mkconfig -o /boot/grub/grub.cfg
# UEFI mode
$ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck
$ grub-mkconfig -o /boot/grub/grub.cfg
$ chmod -R g-rwx,o-rwx /boot
Cleanup and reboot!
exit
umount -R /mnt
reboot
Run ansible!
[1]: https://www.archlinux.org/
[2]: https://wiki.archlinux.org/index.php/Beginners'_guide
[3]: https://wiki.archlinux.org/index.php/Installation_guide
[4]: https://wiki.archlinux.org/index.php/Encrypted_LVM#LVM_on_LUKS
[5]: http://www.pavelkogan.com/2014/05/23/luks-full-disk-encryption/
[6]: https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#Encrypted_boot_partition_.28GRUB.29
[7]: https://wiki.archlinux.org/index.php/HiDPI
[8]: https://wiki.archlinux.org/index.php/Beginners'_guide#Update_the_system_clock
[9]: https://wiki.archlinux.org/index.php/Beginners'_Guide#Select_a_mirror
[10]: https://wiki.archlinux.org/index.php/Beginners'_Guide#Install_the_base_system
[11]: https://wiki.archlinux.org/index.php/Beginners'_guide#Generate_an_fstab
[12]: https://wiki.archlinux.org/index.php/Beginners'_guide#Configure_the_base_system