Aller au contenu

arch install

arch The following is a brief installation tutorial for Arch Linux. It assumes familiarity with the Arch Beginner's Guide and Installation Guide.

It will provide a system using LVM on LUKS.

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 systems), set a new font.

setfont sun12x22

Connect to the Internet.

Verify that the system clock is up to date.

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.

vi /etc/pacman.d/mirrorlist

Install the base system.

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.

genfstab -U -p /mnt >> /mnt/etc/fstab
less /mnt/etc/fstab

Change root into the base install and perform base configuration tasks.

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!