Last active
February 12, 2020 17:51
-
-
Save angristan/7e0d2b0f5786c8b1d18470f0a008affe to your computer and use it in GitHub Desktop.
Install Arch Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prepare env | |
timedatectl set-ntp true | |
timedatectl set-timezone Europe/Paris | |
# Partition disk | |
parted /dev/sda mklabel gpt | |
parted -a optimal /dev/sda mkpart primary fat32 0% 512MB | |
parted /dev/sda set 1 esp on | |
parted -a optimal /dev/sda mkpart primary linux-swap 512MB 2560MB | |
parted -a optimal /dev/sda mkpart primary ext4 2560MB 100% | |
# Prepare partitions | |
mkfs.ext4 /dev/sda3 | |
mount /dev/sda3 /mnt | |
mkfs.fat -F32 /dev/sda1 | |
mkdir /mnt/boot | |
mount /dev/sda1 /mnt/boot | |
mkswap /dev/sda2 | |
swapon /dev/sda2 | |
# Install base system | |
echo 'Server = http://mirror.archlinux.ikoula.com/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist | |
pacstrap /mnt base base-devel linux linux-firmware | |
genfstab -U /mnt > /mnt/etc/fstab | |
echo '#!/bin/bash | |
# Setup env | |
ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime | |
hwclock --systohc | |
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen | |
locale-gen | |
echo "LANG=en_US.UTF-8" > /etc/locale.conf | |
echo "arch" > /etc/hostname | |
echo "127.0.0.1 localhost | |
::1 localhost | |
127.0.1.1 arch.localdomain arch" >> /etc/hosts | |
# Set password for root | |
echo "Please enter a password for the root user:" | |
passwd | |
# Install bootloader | |
bootctl install | |
echo "title Arch Linux | |
linux /vmlinuz-linux | |
initrd /initramfs-linux.img | |
options root=UUID=$(blkid -s UUID -o value /dev/sda3) rw" > /boot/loader/entries/arch.conf | |
# Allow user to use sudo | |
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers | |
# Add new user | |
read -p "Enter username for new user: " username | |
useradd -m -g wheel $username | |
passwd $username | |
# Install desktop env | |
pacman --noconfirm -S networkmanager | |
systemctl enable NetworkManager | |
pacman --noconfirm -S gnome | |
systemctl enable gdm | |
pacman --noconfirm -S nano firefox | |
# Quit chroot | |
exit' > /mnt/root/part2.sh | |
read -p "Press enter to continue" | |
chmod +x /mnt/root/part2.sh | |
# Enter new system | |
arch-chroot /mnt /root/part2.sh | |
umount -R /mnt | |
echo "You can reboot now." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment