Skip to content

Instantly share code, notes, and snippets.

@unipi-user
Created November 8, 2016 02:25
Show Gist options
  • Save unipi-user/25c973fc3895728dadf3828a4fd0fcf6 to your computer and use it in GitHub Desktop.
Save unipi-user/25c973fc3895728dadf3828a4fd0fcf6 to your computer and use it in GitHub Desktop.
arch KDE
#!/bin/bash
#Pre-Installation
# Connect to the Internet
# wifi-menu
# Update the system clock
timedatectl set-ntp true
# Partition the disks
echo "mklabel gpt
mkpart ESP fat32 1MiB 200MiB
set 1 boot on
mkpart primary ext4 200MiB 100%
quit
" | parted /dev/sda
# Format the partitions
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
# Mount the partitions
mount /dev/sda2 /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot
# Select the mirrors
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
grep -E -A 1 ".*Germany.*$" /etc/pacman.d/mirrorlist.bak | sed '/--/d' > /etc/pacman.d/mirrorlist
# Install the base packages
pacstrap -i /mnt base base-devel
# Configure the system
genfstab -U /mnt > /mnt/etc/fstab
# Copy the scripts to the new system
cp -r ~/Installation/ /mnt/
# Change root into the new system and start second Script
echo "Execute Arch-Installation.sh"
arch-chroot /mnt /bin/bash
#!/bin/bash
#Installation
# Set the hostname
read -p "Set hostname: " hostName
echo $hostName > /etc/hostname
# Set the root password
echo "Set root password:"
passwd
# Set timezone (or use tzselect)
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
# Set locales and generate them
echo LANG=de_DE.UTF-8 > /etc/locale.conf
echo LANGUAGE=de_DE >> /etc/locale.conf
echo KEYMAP=de-latin1 > /etc/vconsole.conf
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
echo "en_US ISO-8859-1" >> /etc/locale.gen
echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen
echo "de_DE ISO-8859-1" >> /etc/locale.gen
locale-gen
# Fix pacman: Signature is unknown trust
rm -Rf /etc/pacman.d/gnupg
pacman-key --init
pacman-key --populate archlinux
# Create a new initial RAM disk
mkinitcpio -p linux
# Install and configure the Bootloader
bootctl install
echo "title Arch Linux" > /boot/loader/entries/arch.conf
echo "linux /vmlinuz-linux" >> /boot/loader/entries/arch.conf
echo "initrd /initramfs-linux.img" >> /boot/loader/entries/arch.conf
echo "options root=/dev/sda2 rw" >> /boot/loader/entries/arch.conf
echo "default arch" > /boot/loader/loader.conf
# Exit the chroot environment and reboot (optionaly add: umount -R /mnt)
echo "1. exit | 2. umount -R /mnt | 3. reboot | 4. Execute Arch-Post-Installation.sh"
#!/bin/bash
#Post-Installation
# Create user and set password
read -p "Set user name:" userName
useradd -m -g users -G wheel,storage,power,audio,video -s /bin/bash $userName
echo "Set user password:"
passwd $userName
# Header files and scripts for building modules for Linux kernel
pacman -Syy
pacman -S linux-headers
# Install important services
pacman -S --noconfirm acpid ntp dbus avahi cups cronie ufw
# Enable important services
systemctl enable acpid
systemctl enable ntpd
systemctl enable cronie
systemctl enable avahi-daemon
systemctl enable ufw
# Install command line and ncurses programs
pacman -S --noconfirm sudo
pacman -S --noconfirm bash-completion
pacman -S --noconfirm htop
pacman -S --noconfirm screen
pacman -S --noconfirm wget axel
pacman -S --noconfirm xdotool
pacman -S --noconfirm xclip
# Install xorg and graphics
pacman -S --noconfirm xorg-server xorg-server-utils xorg-utils xorg-xinit
pacman -S --noconfirm xf86-video-intel
# Install desktop & window manager
pacman -S --noconfirm plasma kde-applications kde-l10n-de
# Install graphical programs
# pacman -S --noconfirm libreoffice-fresh libreoffice-fresh-de hunspel-de
# pacman -S --noconfirm gimp
# pacman -S --noconfirm ffmpeg
# pacman -S --noconfirm zenity
# pacman -S --noconfirm git
# pacman -S --noconfirm virtualbox virtualbox-host-modules-arch virtualbox-guest-iso
# pacman -S --noconfirm openvpn
# Install from AUR
# cower
# teamviewer
# skype
# khal
# Configure the network
pacman -S --noconfirm wpa_supplicant dialog
systemctl enable NetworkManager
# Configure sudo
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
# Add User-"user" to VirtualBox-Group
# gpasswd -a $userName vboxusers
# Configure Keyboardlayout
# localectl set-x11-keymap de pc105 nodeadkeys
# echo "#! /bin/bash" > /home/$userName/.xinitrc
# echo "setxkbmap -model pc105 -layout de -variant nodeadkeys" >> /home/$userName/.xinitrc
# Configure xinit
echo "exec startkde" >> /home/$userName/.xinitrc
# Configure auto startX
cp /etc/skel/.bash_profile /home/$userName/
echo "startx" >> /home/$userName/.bash_profile
# Finish
echo "Installation finished!!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment