notebook/IT/linux/arch_install.md

131 lines
4.0 KiB
Markdown
Raw Normal View History

2021-04-20 21:13:14 +00:00
# arch install
2021-01-24 16:52:22 +00:00
![arch](../img/Arch_Linux_logo.svg.png)
2020-11-26 17:38:25 +00:00
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.
2021-04-20 21:13:14 +00:00
setfont sun12x22
2020-11-26 17:38:25 +00:00
Connect to the Internet.
Verify that the [system clock is up to date][8].
2021-04-20 21:13:14 +00:00
timedatectl set-ntp true
2020-11-26 17:38:25 +00:00
(bios mode)
2021-04-20 21:13:14 +00:00
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
2020-11-26 17:38:25 +00:00
(UEFI mode) Create partitions for EFI, boot, and root.
2021-04-20 21:13:14 +00:00
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
2020-11-26 17:38:25 +00:00
Create and mount the encrypted root filesystem. Note that for UEFI systems
this will be partition 3.
2021-04-20 21:13:14 +00:00
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
2020-11-26 17:38:25 +00:00
(UEFI mode) Encrypt the boot partition using a separate passphrase from
the root partition, then mount the boot and EFI partitions.
2021-04-20 21:13:14 +00:00
mkdir /mnt/boot
mount /dev/sda2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi
2020-11-26 17:38:25 +00:00
Optionally [edit the mirror list][9].
2021-04-20 21:13:14 +00:00
vi /etc/pacman.d/mirrorlist
2020-11-26 17:38:25 +00:00
Install the [base system][10].
2021-04-20 21:13:14 +00:00
pacstrap -i /mnt base base-devel net-tools wireless_tools dialog wpa_supplicant openssh git grub ansible
2020-11-26 17:38:25 +00:00
(UEFI mode) $ pacstrap /mnt efibootmgr
Generate and verify [fstab][11].
2021-04-20 21:13:14 +00:00
genfstab -U -p /mnt >> /mnt/etc/fstab
less /mnt/etc/fstab
2020-11-26 17:38:25 +00:00
Change root into the base install and perform [base configuration tasks][12].
2021-04-20 21:13:14 +00:00
arch-chroot /mnt /bin/bash
systemctl enable dhcpcd.service
systemctl enable sshd.service
passwd
2020-11-26 17:38:25 +00:00
modifier /etc/ssh/sshd_config et mettre PermitRoorlogin yes
Set your mkinitcpio.
2021-04-20 21:13:14 +00:00
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
2020-11-26 17:38:25 +00:00
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!
2021-04-20 21:13:14 +00:00
exit
umount -R /mnt
reboot
2020-11-26 17:38:25 +00:00
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