Last active
March 26, 2020 16:21
-
-
Save kietoparao/3bf824dfce5c9e135a6b720815f95075 to your computer and use it in GitHub Desktop.
Installation and minimal setup of Arch Linux from live USB on an Intel laptop (BIOS mode) with 1GB swap partition
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
#!/bin/sh | |
set -euo pipefail | |
echo "########## Setting the keyboard to ES..." | |
loadkeys es | |
echo "########## Setting clock..." | |
timedatectl set-ntp true | |
echo "########## Checking internet connection..." | |
ip link | |
ping -c 3 archlinux.org | |
lsblk | |
echo "########## Type the '/dev/sdX' partition you want to format (e.g. '/dev/sda'):" | |
read target | |
fdisk $target << EOF | |
o | |
n | |
p | |
1 | |
-1000M | |
n | |
p | |
2 | |
t | |
2 | |
82 | |
w | |
EOF | |
mkfs.ext4 ${target}1 | |
mkswap ${target}2 | |
swapon ${target}2 | |
echo "########## Installing Arch Linux into $target..." | |
mount ${target}1 /mnt | |
echo "########## Installing minimum packages..." | |
pacstrap /mnt \ | |
acpi \ | |
base \ | |
dhcpcd \ | |
git \ | |
grub \ | |
htop \ | |
intel-ucode \ | |
iw \ | |
light \ | |
linux \ | |
linux-firmware \ | |
man-db \ | |
man-pages \ | |
net-tools \ | |
openssh \ | |
sudo \ | |
texinfo \ | |
vi \ | |
vim \ | |
wpa_supplicant \ | |
xkeyboard-config \ | |
zsh | |
echo "########## Generating the fstab file with the mounted partition where arch is installed..." | |
genfstab -U /mnt >> /mnt/etc/fstab | |
echo "########## Arch-chrooting into new installed system..." | |
arch-chroot /mnt |
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
#!/bin/sh | |
set -euo pipefail | |
echo "########## Start and enable dhcpcd at startup..." | |
systemctl enable dhcpcd.service | |
systemctl start dhcpcd.service | |
echo "########## Setting time zone and clock..." | |
ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime | |
hwclock --systohc | |
echo "########## Setting locales..." | |
sed -i "/^#en_US.UTF-8 UTF-8/ s/# *//" /etc/locale.gen | |
locale-gen | |
echo "LANG=en_US.UTF-8" > /etc/locale.conf | |
echo "KEYMAP=es" > /etc/vconsole.conf | |
echo "########## Making wheel group a sudoer..." | |
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
echo "########## Setting hostname and hosts file..." | |
echo "##### Write your desired hostname:" | |
read hstname | |
echo $hstname > /etc/hostname | |
echo "127.0.0.1 $hstname" >> /etc/hosts | |
echo "::1 $hstname" >> /etc/hosts | |
echo "127.0.0.1 $hstname.localdomain $hstname" >> /etc/hosts | |
echo "########## Setting root password..." | |
passwd | |
lsblk | |
echo "########## Choose the '/dev/sdX' to install GRUB (e.g. '/dev/sda'):" | |
read grubdir | |
grub-install --target=i386-pc $grubdir | |
grub-mkconfig -o /boot/grub/grub.cfg | |
echo "########## Adding desired user to the wheel group..." | |
echo "##### Choose your username:" | |
read username | |
useradd -m -G wheel -s /bin/bash $username | |
echo "##### Introduce password for user '$username':" | |
passwd $username | |
echo "FINISHED! Exit chroot with Ctrl+D or typing 'exit', and then 'reboot'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment