Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
f4abf2692a |
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
This installation script aims for a simple (read minimal) Arch Linux installation, which is modern in the way that it uses UEFI, systemd-boot and Wayland, secure in the way that it uses full-disk encryption using LUKS as well as flexibility by using Btrfs subvolumes for the root and home partition.
|
This installation script aims for a simple (read minimal) Arch Linux installation, which is modern in the way that it uses UEFI, systemd-boot and Wayland, secure in the way that it uses full-disk encryption using LUKS as well as flexibility by using Btrfs subvolumes for the root and home partition.
|
||||||
|
|
||||||
Tested and working as of **May 2025**.
|
Tested and working as of **February 2025**.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
173
install.sh
173
install.sh
@ -8,6 +8,12 @@ exec 2>&1
|
|||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
|
# Check root
|
||||||
|
if [[ $(id -u) -ne 0 ]]; then
|
||||||
|
echo "This script needs to be run as root!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Friendly introduction.
|
# Friendly introduction.
|
||||||
echo "0. WELCOME"
|
echo "0. WELCOME"
|
||||||
echo "Welcome to the Arch Linux installation script!"
|
echo "Welcome to the Arch Linux installation script!"
|
||||||
@ -46,6 +52,21 @@ IFS=' '
|
|||||||
array=(${dev})
|
array=(${dev})
|
||||||
dev="${array[0]}"
|
dev="${array[0]}"
|
||||||
|
|
||||||
|
# TODO Check disk size
|
||||||
|
# Disk auswählen (Variable `dev` muss gesetzt sein)
|
||||||
|
#disk="/dev/${dev}"
|
||||||
|
|
||||||
|
# Festplattengröße in Gigabyte berechnen
|
||||||
|
#disk_size=$(lsblk -b -n -o SIZE "$disk" | awk '{print $1 / 1024 / 1024 / 1024}')
|
||||||
|
|
||||||
|
# Prüfen, ob die Festplatte größer als 10 GB ist
|
||||||
|
#if (( $(echo "$disk_size >= 10" | bc -l) )); then
|
||||||
|
# echo "✅ Die Festplatte hat $disk_size GB und ist größer als 10 GB."
|
||||||
|
#else
|
||||||
|
# echo "❌ Fehler: Die Festplatte ist zu klein ($disk_size GB). Bitte eine größere auswählen."
|
||||||
|
# exit 1
|
||||||
|
#fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
echo "2. ENCRYPTION"
|
echo "2. ENCRYPTION"
|
||||||
@ -53,14 +74,14 @@ echo
|
|||||||
|
|
||||||
# Setting encryption password.
|
# Setting encryption password.
|
||||||
echo "Choose a strong password for encrypting the primary partition:"
|
echo "Choose a strong password for encrypting the primary partition:"
|
||||||
pwcr=""
|
password_encrypt=""
|
||||||
while [[ -z "${pwcr}" ]]; do
|
while [[ -z "${password_encrypt}" ]]; do
|
||||||
echo "Please enter a password: "
|
#echo "Please enter a password: "
|
||||||
read -rs pwfr
|
read -rs -p "Please enter a password: " password_first
|
||||||
read -rs -p "Retype a password: " pwsc
|
read -rs -p "Retype a password: " password_second
|
||||||
if [[ "${pwfr}" == "${pwsc}" ]];
|
if [[ "${password_first}" == "${password_second}" ]];
|
||||||
then
|
then
|
||||||
pwcr="${pwfr}"
|
password_encrypt="${password_first}"
|
||||||
echo
|
echo
|
||||||
echo "Both passwords are the same. Continuing.."
|
echo "Both passwords are the same. Continuing.."
|
||||||
break
|
break
|
||||||
@ -76,25 +97,29 @@ clear
|
|||||||
echo "3. HOSTNAME"
|
echo "3. HOSTNAME"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Setting hostname.
|
# Setting hostname
|
||||||
echo "Before installing the system, please enter a hostname:"
|
#echo "Before installing the system, please enter a hostname:"
|
||||||
read -r host
|
read -r -p "Before installing the system, please enter a hostname: " host
|
||||||
|
while [[ -z "${host}" ]]; do
|
||||||
|
echo "Hostname can not be empty!"
|
||||||
|
read -r -p "Please enter a hostname: " host
|
||||||
|
done
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
echo "4. ROOT PASSWORD"
|
echo "4. ROOT PASSWORD"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Setting root password.
|
# Setting root password
|
||||||
echo "Choose a password for the root account:"
|
echo "Choose a password for the root account:"
|
||||||
pwr=""
|
password_root=""
|
||||||
while [[ -z "${pwr}" ]]; do
|
while [[ -z "${password_root}" ]]; do
|
||||||
echo "Please enter a password: "
|
#echo "Please enter a password: "
|
||||||
read -rs pwfr
|
read -rs -p "Please enter a password: " password_first
|
||||||
read -rs -p "Retype a password: " pwsc
|
read -rs -p "Retype a password: " password_second
|
||||||
|
|
||||||
if [[ "${pwfr}" == "${pwsc}" ]]; then
|
if [[ "${password_first}" == "${password_second}" ]]; then
|
||||||
pwrt="${pwfr}"
|
password_root="${password_first}"
|
||||||
echo
|
echo
|
||||||
echo "Both passwords are the same. Continuing.."
|
echo "Both passwords are the same. Continuing.."
|
||||||
break
|
break
|
||||||
@ -111,21 +136,26 @@ echo "4. USER"
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
# Setting username
|
# Setting username
|
||||||
echo "Please enter a username:"
|
#echo "Please enter a username:"
|
||||||
read -r user
|
read -r -p "Please enter a username: " user
|
||||||
|
while [[ -z "${user}" ]]; do
|
||||||
|
echo "Benutzername darf nicht leer sein!"
|
||||||
|
read -r -p "Please enter a username: " user
|
||||||
|
done
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Setting user password.
|
# Setting user password.
|
||||||
echo "Also please choose a password for your user:"
|
echo "Also please choose a password for your user:"
|
||||||
pwu=""
|
password_user=""
|
||||||
while [[ -z "${pwu}" ]]; do
|
while [[ -z "${password_user}" ]]; do
|
||||||
echo "Please enter a password: "
|
#echo "Please enter a password: "
|
||||||
read -rs pwfr
|
read -rs -p "Please enter a password: " password_first
|
||||||
read -rs -p "Retype a password: " pwsc
|
read -rs -p "Retype a password: " password_second
|
||||||
|
|
||||||
if [[ "${pwfr}" == "${pwsc}" ]];
|
if [[ "${password_first}" == "${password_second}" ]];
|
||||||
then
|
then
|
||||||
pwur="${pwfr}"
|
password_user="${password_first}"
|
||||||
echo
|
echo
|
||||||
echo "Both passwords are the same. Continuing.."
|
echo "Both passwords are the same. Continuing.."
|
||||||
break
|
break
|
||||||
@ -180,14 +210,14 @@ fi
|
|||||||
# Encrypting partition.
|
# Encrypting partition.
|
||||||
echo "Encrypting system partition. This might take a while."
|
echo "Encrypting system partition. This might take a while."
|
||||||
echo
|
echo
|
||||||
echo -en "${pwcr}\n${pwcr}" | cryptsetup -c aes-xts-plain -s 512 luksFormat /dev/$main
|
echo -en "${password_encrypt}\n${password_encrypt}" | cryptsetup -c aes-xts-plain -s 512 luksFormat "/dev/${main}"
|
||||||
echo "Partition successfully encrypted."
|
echo "Partition successfully encrypted."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Opening encrypted partition and mounting at /dev/mapper/main.
|
# Opening encrypted partition and mounting at /dev/mapper/main.
|
||||||
echo "Decrypting.. This also might take a while."
|
echo "Decrypting.. This also might take a while."
|
||||||
echo
|
echo
|
||||||
echo -en "${pwcr}\n${pwcr}" | cryptsetup luksOpen "/dev/${main}" main
|
echo -en "${password_encrypt}\n${password_encrypt}" | cryptsetup luksOpen "/dev/${main}" main
|
||||||
echo "Partition successfully opened."
|
echo "Partition successfully opened."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@ -214,6 +244,7 @@ mount "/dev/mapper/main" "/mnt"
|
|||||||
btrfs subvolume create "/mnt/root"
|
btrfs subvolume create "/mnt/root"
|
||||||
btrfs subvolume create "/mnt/home"
|
btrfs subvolume create "/mnt/home"
|
||||||
|
|
||||||
|
sync
|
||||||
umount "/mnt"
|
umount "/mnt"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@ -246,53 +277,53 @@ echo
|
|||||||
# Installing base system.
|
# Installing base system.
|
||||||
echo "Installing basic packages.."
|
echo "Installing basic packages.."
|
||||||
|
|
||||||
# Base packages
|
# Basis-Pakete
|
||||||
base_packages=(
|
base_packages=(
|
||||||
base # Arch Linux Base
|
base
|
||||||
btrfs-progs # Btrfs
|
btrfs-progs
|
||||||
firefox
|
firefox
|
||||||
konsole # Terminal
|
konsole
|
||||||
linux
|
linux
|
||||||
linux-firmware
|
linux-firmware
|
||||||
linux-zen
|
linux-zen
|
||||||
nano # Editor
|
nano
|
||||||
networkmanager
|
networkmanager
|
||||||
sddm # Display Manager
|
sddm
|
||||||
sddm-kcm # KConfig module
|
sddm-kcm
|
||||||
sudo
|
sudo
|
||||||
xorg-xwayland
|
xorg-xwayland
|
||||||
plasma-desktop
|
plasma-desktop
|
||||||
plasma-nm # Network manager applet
|
plasma-nm
|
||||||
)
|
)
|
||||||
|
|
||||||
# Necessary Plasma integrations
|
# Notwendige Plasma-Integrationen
|
||||||
plasma_integrations=(
|
plasma_integrations=(
|
||||||
plasma-pa # Audio applet
|
plasma-pa
|
||||||
breeze-gtk # Widget theme
|
breeze-gtk
|
||||||
kde-gtk-config # Syncs KDE settings to GTK applications
|
kde-gtk-config
|
||||||
kdeplasma-addons # Misc addons: https://github.com/KDE/kdeplasma-addons
|
kdeplasma-addons
|
||||||
kscreen # Adds screen management to settings
|
kscreen
|
||||||
plasma-browser-integration
|
plasma-browser-integration
|
||||||
powerdevil # Power management
|
powerdevil
|
||||||
)
|
)
|
||||||
|
|
||||||
# KDE Utilities
|
# KDE Utilities
|
||||||
kde_utils=(
|
kde_utils=(
|
||||||
ark # Archiving tool
|
ark
|
||||||
bluedevil # Bluetooth
|
bluedevil
|
||||||
discover # GUI package management
|
discover
|
||||||
dolphin # File browser
|
dolphin
|
||||||
filelight # Disk usage analyzer
|
filelight
|
||||||
gwenview # Image viewer
|
gwenview
|
||||||
kate # Text editor
|
kate
|
||||||
kcalc # Calculator
|
kcalc
|
||||||
kdeconnect # Mobile synchronisation tool
|
kdeconnect
|
||||||
kinfocenter # System information
|
kinfocenter
|
||||||
#kmag # Doesn't work on Wayland
|
kmag
|
||||||
plasma-systemmonitor
|
plasma-systemmonitor
|
||||||
okular # PDF viewer
|
okular
|
||||||
partitionmanager # partitioning utility
|
partitionmanager
|
||||||
spectacle # Screenshot utility
|
spectacle
|
||||||
)
|
)
|
||||||
|
|
||||||
# Additional default software
|
# Additional default software
|
||||||
@ -304,7 +335,7 @@ default_software=(
|
|||||||
wireplumber
|
wireplumber
|
||||||
)
|
)
|
||||||
|
|
||||||
# Put all packages together
|
# Alle Pakete zusammenführen
|
||||||
all_packages=(
|
all_packages=(
|
||||||
"${base_packages[@]}"
|
"${base_packages[@]}"
|
||||||
"${plasma_integrations[@]}"
|
"${plasma_integrations[@]}"
|
||||||
@ -312,32 +343,25 @@ all_packages=(
|
|||||||
"${default_software[@]}"
|
"${default_software[@]}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install packages
|
# Pakete installieren
|
||||||
pacstrap "/mnt" "${all_packages[@]}"
|
pacstrap "/mnt" "${all_packages[@]}"
|
||||||
|
|
||||||
echo "Base system installed."
|
echo "Base system installed."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Generating fstab
|
# Generating fstab.
|
||||||
echo "Generating fstab.."
|
echo "Generating fstab.."
|
||||||
genfstab -Up "/mnt" > "/mnt/etc/fstab"
|
genfstab -Up "/mnt" > "/mnt/etc/fstab"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Setting timezone
|
# Setting hostname.
|
||||||
echo "Setting timezone.."
|
|
||||||
arch-chroot "/mnt" ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
|
||||||
arch-chroot "/mnt" hwclock --systohc
|
|
||||||
echo "Done."
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Setting hostname
|
|
||||||
echo "Setting hostname.."
|
echo "Setting hostname.."
|
||||||
echo "${host}" > "/mnt/etc/hostname"
|
echo "${host}" > "/mnt/etc/hostname"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Setting locale
|
# Setting locale.
|
||||||
echo "Setting and generating locale.."
|
echo "Setting and generating locale.."
|
||||||
cat << EOF > "/mnt/etc/locale.gen"
|
cat << EOF > "/mnt/etc/locale.gen"
|
||||||
en_US.UTF-8 UTF-8
|
en_US.UTF-8 UTF-8
|
||||||
@ -373,7 +397,8 @@ echo
|
|||||||
|
|
||||||
# Editing mkinitcpio.conf.
|
# Editing mkinitcpio.conf.
|
||||||
echo "Editing /etc/mkinitcpio.conf.."
|
echo "Editing /etc/mkinitcpio.conf.."
|
||||||
sed -i '55s/.*/HOOKS=(base udev autodetect microcode modconf kms block keyboard keymap encrypt filesystems fsck shutdown)/' /mnt/etc/mkinitcpio.conf
|
sed -i 's/^HOOKS=.*/HOOKS=(base udev autodetect microcode modconf kms block keyboard keymap encrypt filesystems fsck shutdown)/' /mnt/etc/mkinitcpio.conf
|
||||||
|
#sed -i '55s/.*/HOOKS=(base udev autodetect microcode modconf kms block keyboard keymap encrypt filesystems fsck shutdown)/' /mnt/etc/mkinitcpio.conf
|
||||||
echo "Done."
|
echo "Done."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@ -394,7 +419,7 @@ echo
|
|||||||
|
|
||||||
# Set root password
|
# Set root password
|
||||||
echo "Setting root password.."
|
echo "Setting root password.."
|
||||||
echo -en "${pwrt}\n${pwrt}" | arch-chroot "/mnt" passwd
|
echo -en "${password_root}\n${password_root}" | arch-chroot "/mnt" passwd
|
||||||
echo "Done."
|
echo "Done."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@ -443,7 +468,7 @@ echo
|
|||||||
# Set username, password and group.
|
# Set username, password and group.
|
||||||
echo "Adding user.."
|
echo "Adding user.."
|
||||||
arch-chroot /mnt useradd -m "${user}"
|
arch-chroot /mnt useradd -m "${user}"
|
||||||
echo -en "${pwur}\n${pwur}" | arch-chroot /mnt passwd "${user}"
|
echo -en "${password_user}\n${password_user}" | arch-chroot /mnt passwd "${user}"
|
||||||
arch-chroot /mnt gpasswd -a "${user}" wheel
|
arch-chroot /mnt gpasswd -a "${user}" wheel
|
||||||
sed -i '82s/.*/%wheel ALL=(ALL) ALL/' /mnt/etc/sudoers
|
sed -i '82s/.*/%wheel ALL=(ALL) ALL/' /mnt/etc/sudoers
|
||||||
echo "Done."
|
echo "Done."
|
||||||
@ -481,7 +506,9 @@ EOF
|
|||||||
|
|
||||||
# Unmounting and rebooting.
|
# Unmounting and rebooting.
|
||||||
echo "Unmounting system.."
|
echo "Unmounting system.."
|
||||||
|
sync
|
||||||
umount "/mnt/boot"
|
umount "/mnt/boot"
|
||||||
|
umount "/mnt/home"
|
||||||
umount "/mnt"
|
umount "/mnt"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
echo
|
echo
|
||||||
|
Reference in New Issue
Block a user