Created
July 18, 2023 23:33
-
-
Save pizzimenti/e54cca9529ac6679b0a775cccb2e1714 to your computer and use it in GitHub Desktop.
Quick VM setup to Gnome
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/bash | |
| set -e | |
| echo "Updating system clock" | |
| timedatectl set-ntp true | |
| echo "Partitioning disk" | |
| fdisk /dev/vda <<EOF | |
| o | |
| n | |
| p | |
| w | |
| EOF | |
| echo "Formatting partition" | |
| mkfs.ext4 /dev/vda1 | |
| echo "Mounting root partition" | |
| mount /dev/vda1 /mnt | |
| echo "Installing base system" | |
| pacstrap /mnt base linux linux-firmware | |
| echo "Generating fstab" | |
| genfstab -U /mnt >> /mnt/etc/fstab | |
| echo "Chrooting into new system" | |
| arch-chroot /mnt <<EOF | |
| echo "Setting time zone" | |
| ln -sf /usr/share/zoneinfo/US/Los_Angeles /etc/localtime | |
| echo "Setting hardware clock" | |
| hwclock --systohc | |
| echo "Setting up locale" | |
| sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen | |
| locale-gen | |
| echo "LANG=en_US.UTF-8" > /etc/locale.conf | |
| echo "Setting up hostname" | |
| echo "arch-vm1" > /etc/hostname | |
| echo "127.0.0.1 localhost" >> /etc/hosts | |
| echo "::1 localhost" >> /etc/hosts | |
| echo "127.0.1.1 arch-vm1.localdomain arch-vm1" >> /etc/hosts | |
| echo "Setting root password" | |
| echo "root:j" | chpasswd | |
| echo "Installing and enabling bootloader" | |
| pacman -S --noconfirm grub | |
| grub-install /dev/vda | |
| grub-mkconfig -o /boot/grub/grub.cfg | |
| echo "Installing GNOME and GDM" | |
| pacman -S --noconfirm gnome gdm | |
| systemctl enable gdm | |
| echo "Adding a regular user" | |
| useradd -m -G wheel -s /bin/bash user | |
| echo "user:j" | chpasswd | |
| echo "Allowing wheel group to use sudo" | |
| echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers | |
| exit | |
| EOF | |
| echo "Done! You can reboot now." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment