minimal arch linux w/ xfce
unknown
plain_text
a year ago
3.7 kB
17
Indexable
#!/bin/bash
#
# a minimal Arch Linux system with XFCE on an NVMe drive using GRUB as the bootloader for UEFI systems.
#
# Update system clock
timedatectl set-ntp true
# Partitioning using sgdisk for UEFI
sgdisk -Z \
-o \
-a 2048 \
-n 1:0:+200M -t 1:ef00 -c 1:"EFI" \
-n 2:0:0 -t 2:8300 -c 2:"ROOT" \
/dev/sda
# Format partitions
mkfs.fat -F32 /dev/sda1
mkfs.ext4 -E discard /dev/sda2
# Mount root partition
mount /dev/sda2 /mnt
mkdir -p /mnt/{home,boot/grub,}
mount /dev/sda1 /mnt/boot
# Enables multilib & ParallelDownloads
perl -i -0777 -pe "s/^#(\[multilib\]\n)#/\1/gm; s/\#(ParallelDownloads)/\1/gm" /etc/pacman.conf
pacman -Sy archlinux-keyring --noconfirm
# Grab the latest and most hottest mirrors known to man!
reflector --verbose --latest 5 --country US --sort rate --save /etc/pacman.d/mirrorlist --ipv4
# Install base system and necessary packages (-P will copy our pacman.conf)
pacstrap -P /mnt base base-devel linux linux-firmware archlinux-keyring grub efibootmgr xfce4-notifyd xfce4-panel xfce4-pulseaudio-plugin xfce4-screenshooter xfce4-session xfce4-settings xfce4-terminal xfdesktop xfwm4 xfwm4-themes ristretto thunar thunar-archive-plugin thunar-volman xorg-server mesa xf86-input-libinput networkmanager network-manager-applet lightdm lightdm-gtk-greeter pulseaudio pulseaudio-alsa gvfs nano openssh xarchiver arj binutils bzip2 cpio gzip lha lrzip lz4 lzip lzop p7zip tar unarj unrar unzip xdg-utils xz zip zstd --needed --noconfirm
# Generate fstab
genfstab -U /mnt >> /mnt/etc/fstab
# tmpfs to fstab
echo -e "tmpfs /tmp tmpfs nodev,nosuid 0 0" >> /mnt/etc/fstab
echo -e 'KEYMAP="us"\nFONT="eurlatgr"' > /mnt/etc/vconsole.conf
# Change root into the new system
arch-chroot /mnt /bin/bash <<EOF
# Update keys and stuff
pacman-key --init
pacman-key --populate archlinux
# Set timezone
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
hwclock --systohc
# Add sysctl settings to disable IPv6
echo "# Disable IPv6" >> /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf
# Disable IPv6 in network configuration (dhcpcd)
echo "noipv6rs" >> /etc/dhcpcd.conf
# Localization
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
# Network configuration
echo "arch" > /etc/hostname
echo -e "127.0.0.1\tlocalhost\n::1\t\tlocalhost\n127.0.1.1\tarch.localdomain\tarch" > /etc/hosts
# Set root password (replace 'password' with your own)
echo "root:password" | chpasswd
# Cant forget this one.. jeez
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
# Create user account
useradd --create-home --gid users --groups wheel,storage,power,video --password $(openssl passwd -1 "password") --shell /bin/bash user
# rebuild the ram disk for the kernel
mkinitcpio -p linux
# Install GRUB bootloader for UEFI
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
# Generate GRUB configuration file
grub-mkconfig -o /boot/grub/grub.cfg
systemctl enable NetworkManager
systemctl enable dhcpcd
systemctl enable lightdm
systemctl enable sshd
# hide those stupid menu itemns i hate
for i in {'xfce4-mail-reader.desktop','avahi-discover.desktop','bssh.desktop','bvnc.desktop','qvidcap.desktop','qv4l2.desktop',}; do
[ -e "/usr/share/applications/$i" ] && echo "OnlyShowIn=GNOME" >> "/usr/share/applications/$i"
done
EOF
# Unmount all partitions
umount -R /mnt
# Reboot system
reboot
Editor is loading...
Leave a Comment