… in UNATTENDED mode
PRE-INSTALL download Archlinux ISO 1aria2c 'https://archlinux.org/releng/releases/2021.01.01/torrent/' 2sha1sum archlinux-2021.01.01-x86_64.iso 3gpg --receive-keys 0x4AA4767BBC9C4B1D18AE28B77F2D434B9741E8AC 4gpg --verify archlinux-2021.01.01-x86_64.iso.sig INSTALL FROM LIVECD ! CAUTION !
IT WILL DELETE ALL DATA FROM YOUR FIRST HDD DEVICE ( SATA or SSD )
1MY_DEVICE="$(awk '/ sd| vd| nvme/{print $4}' /proc/partitions | head -1)" 2 3timedatectl set-ntp true 4 5parted /dev/${MY_DEVICE} -s mklabel gpt mkpart ESP fat32 1M 128M set 1 boot on mkpart primary ext4 128M 100% 6 7mkfs.vfat -n ESP /dev/${MY_DEVICE}1 8mkfs.btrfs -f -L ROOT /dev/${MY_DEVICE}2 9 10mount -t btrfs /dev/${MY_DEVICE}2 /mnt/ 11btrfs subvolume create /mnt/@root 12btrfs subvolume create /mnt/@var 13btrfs subvolume create /mnt/@home 14btrfs subvolume create /mnt/@snapshots 15 16umount /mnt 17mount -o subvol=@root /dev/${MY_DEVICE}2 /mnt 18mkdir /mnt/{var,home,.snapshots} 19mount -o subvol=@var /dev/${MY_DEVICE}2 /mnt/var 20mount -o subvol=@home /dev/${MY_DEVICE}2 /mnt/home/ 21mount -o subvol=@snapshots /dev/${MY_DEVICE}2 /mnt/.snapshots 22 23mkdir /mnt/boot 24mount /dev/${MY_DEVICE}1 /mnt/boot 25 26pacstrap /mnt base linux linux-firmware base-devel make binutils btrfs-progs zsh vim git sudo efibootmgr wpa_supplicant dialog iw bash-completion 27 28genfstab -L /mnt >> /mnt/etc/fstab INSTALL FROM CHROOT 1HOST_NAME='archlinux' 2MY_PUBKEY='<my_ssh_pubkey>' 3MY_USER='<my_user>' 4MY_USER_PASS='<my_password>' 5ROOT_PASS='<root_password>' 6arch-chroot /mnt /bin/bash <<EOF 7ln -sv /usr/share/zoneinfo/Europe/Paris /etc/localtime 8hwclock --systohc 9sed -i '/^#fr_FR.UTF-8\|^#en_US.UTF-8/{s/^#//}' /etc/locale.gen 10locale-gen 11echo 'LANG=en_US.UTF-8' > /etc/locale.conf 12echo 'KEYMAP=us' > /etc/vconsole.conf 13echo 'FONT=latarcyrheb-sun32' >> /etc/vconsole.conf 14echo ${HOST_NAME} > /etc/hostname 15cat <<HOSTS>> /etc/hosts 16127.0.0.1 localhost 17::1 localhost 18127.0.1.1 ${HOST_NAME}.localdomain ${HOST_NAME} 19HOSTS 20 21echo 'root:${ROOT_PASS}' | chpasswd 22useradd -m -g users -G wheel -s /bin/bash ${MY_USER} 23echo '${MY_USER}:${MY_USER_PASS}' | chpasswd 24sed -i.BKP '/HOOKS=/{s/=.*/=(base systemd autodetect modconf block keyboard sd-vconsole sd-encrypt filesystems)/}' /etc/mkinitcpio.conf 25grep HOOKS /etc/mkinitcpio.conf 26mkinitcpio -p linux 27bootctl --path=/boot install 28 29pacman-key --init 30pacman-key --populate archlinux 31 32pacman -Syu --noconfirm 33pacman -S base-devel gnu-netcat intel-ucode ncdu openssh --noconfirm 34 35timedatectl set-ntp true 36 37systemctl enable sshd systemd-networkd systemd-resolved systemd-timesyncd 38 39git clone https://aur.archlinux.org/yay.git /usr/src/yay 40chmod -R ${MY_USER}: /usr/src/yay 41su - ${MY_USER} -c 'cd /usr/src/yay/ && makepkg -si' 42 43cat <<BOOT_ARCH> /boot/loader/entries/arch.conf 44title Arch Linux 45linux /vmlinuz-linux 46initrd /intel-ucode.img 47initrd /initramfs-linux.img 48options rw root=/dev/${MY_DEVICE}2 rootflags=subvol=@root 49BOOT_ARCH 50 51cat <<BOOT_LOAD> /boot/loader/loader.conf 52default arch 53BOOT_LOAD 54 55networkctl list 56 57cat <<NETWORKD_LAN> /etc/systemd/network/lan.network 58[Match] 59Name=e* 60[Network] 61DHCP=ipv4 62NETWORKD_LAN 63 64cat <<RESOLVED> /etc/systemd/resolved.conf.d/dns_servers.conf 65[Resolve] 66DNS=9.9.9.9 67Domains=~. 68RESOLVED 69 70# USERS # 71 72cat <<USER_SUDO> /etc/sudoers.d/${MY_USER} 73${MY_USER} ALL=(ALL) NOPASSWD: ALL 74USER_SUDO 75 76mkdir /root/.ssh /home/${MY_USER}/.ssh 77 78cat <<ROOT_AUTH> /root/.ssh/authorized_keys 79${MY_PUBKEY} 80ROOT_AUTH 81 82cat <<USER_AUTH> /home/${MY_USER}/.ssh/authorized_keys 83${MY_PUBKEY} 84USER_AUTH 85 86chmod -Rc 0700 /root/.ssh /home/${MY_USER}/.ssh 87chown -Rc ${MY_USER}: /home/${MY_USER}/.ssh/ 88 89# VIRTUALIZATION # 90 91pacman -S dmidecode dnsmasq docker-compose ebtables libvirt qemu vagrant --noconfirm 92 93systemctl enable docker libvirtd 94 95usermod -aG docker,libvirt,kvm ${MY_USER} 96 97su - ${MY_USER} -c 'vagrant plugin install vagrant-libvirt' 98 99exit 100EOF 101reboot SOURCES Official ArchLinux Installation Main references for this article: Archlinux install on XPS 13 9360 ArchLinux step-by-step installation on btrfs See more… Minimal instructions for installing ArchLinux Archlinux install from Artizirk Efficient Encrypted UEFI-Booting Arch Installation