Last active
November 3, 2022 12:36
-
-
Save Luv2C0d3/05a2f33509998993336ccbbba0d92ce6 to your computer and use it in GitHub Desktop.
Install Arch Linux + EFI + Gnome in VMware player VM
This file contains 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
# Install Arch Linux on VMWare player 15 | |
# | |
# References I used: | |
# | |
# Install Arch Linux on Dell XPS-13 (https://bit.ly/32P6t61): | |
# Has some of the BTRFS commands, but uses encryption. | |
# Install.txt file in Arch ISO image. | |
# | |
# Arch Linux Installation and Configuration on UEFI Machines (https://bit.ly/2PtvIY1): | |
# This tutorial includes same info as others, but also some network commands if you | |
# get stuck without a network. | |
# | |
# How to install Gnome on Arch Linux (https://bit.ly/2MRPB96): | |
# This one in addition to the official arch documentation for Gnome. | |
# | |
# Preliminary notes: | |
# To enable EFI on vmware player, create VM normally, then once created, | |
# modify VMX file and include the following line: | |
firmware = "efi" | |
# | |
# You may also want to add a bios boot delay in case you need to boot back | |
# to the livecd ISO | |
bios.bootDelay = "9000" | |
# | |
# Boot in to VM by hooking up Arch Linux ISO: | |
# | |
# For cases where VM is booting into high dpi display. | |
# Set large font | |
setfont latarcyrheb-sun32 | |
# | |
# Set root password and start sshd to connect from | |
# terminal in host | |
# | |
passwd | |
systemctl start sshd | |
# | |
# Get VM ip address | |
# | |
ip a | |
# | |
# Now, from host connect via ssh to root@address returned above. | |
# | |
# Sync clock | |
timedatectl set-ntp true | |
# Create three partitions: | |
cgdisk /dev/sda | |
# 1 1024MB EFI partition | |
# Block size 2147484 | |
# Hex code ef00 | |
# Label boot | |
# 2 16396MB Swap partition | |
# Block size 34359739 | |
# Hex code 8200 | |
# Label swap | |
# 3 100% Linux partition (to be encrypted) | |
# Hex code 8300 | |
# Label root | |
# Formatting and encryption | |
mkfs.fat -F32 /dev/sda1 | |
mkswap /dev/sda2 | |
swapon /dev/sda2 | |
mkfs.btrfs /dev/sda3 | |
# Create btrfs subvolumes | |
mount -t btrfs /dev/sda3 /mnt | |
btrfs subvolume create /mnt/@root | |
btrfs subvolume create /mnt/@var | |
btrfs subvolume create /mnt/@home | |
btrfs subvolume create /mnt/@snapshots | |
# Mount btrfs subvolumes | |
umount /mnt | |
mount -o subvol=@root /dev/sda3 /mnt | |
mkdir /mnt/{var,home,.snapshots} | |
mount -o subvol=@var /dev/sda3 /mnt/var | |
mount -o subvol=@home /dev/sda3 /mnt/home | |
mount -o subvol=@snapshots /dev/sda3 /mnt/.snapshots | |
# Mount EFI partition | |
mkdir -p /mnt/boot/EFI | |
mount /dev/sda1 /mnt/boot/EFI | |
# Change pacman mirror priority, move closer mirror to the top | |
vi /etc/pacman.d/mirrorlist | |
# Install the base system plus packages. | |
pacstrap /mnt base base-devel sudo linux | |
# Generate fstab | |
genfstab -L /mnt >> /mnt/etc/fstab | |
# Enter the new system via chroot | |
arch-chroot /mnt | |
# setup time | |
rm -f /etc/localtime | |
ln -s /usr/share/zoneinfo/America/Vancouver /etc/localtime | |
hwclock --systohc --utc | |
# Generate locales | |
sed --in-place -e 's/^#en_US.U/en_US.U/' /etc/locale.gen | |
locale-gen | |
echo 'LANG=en_US.UTF-8' > /etc/locale.conf | |
echo 'KEYMAP=dvorak' > /etc/vconsole.conf | |
echo 'FONT=latarcyrheb-sun16' >> /etc/vconsole.conf | |
# | |
# Replace 'your-vm' by the hostname you want for your vm. | |
# | |
echo 'your-vm' > /etc/hostname | |
echo '127.0.0.1 localhost' >> /etc/hosts | |
cat /etc/hosts | |
echo '::1 localhost' >> /etc/hosts | |
echo '127.0.1.1 your-vm.localdomain your-vm' >> /etc/hosts | |
# | |
# Set root passwd | |
# | |
passwd | |
# | |
# Add a user. Replace 'user1' by your non-root login user. | |
useradd -m -g users -G wheel -s /bin/bash user1 | |
passwd user1 | |
echo 'user1 ALL=(ALL) ALL' > /etc/sudoers.d/user1 | |
# | |
# Ok, tired of using sed. | |
# | |
pacman -S vim | |
pacman -Syu | |
pacman -S grub efibootmgr dosfstools os-prober mtools | |
pacman -S linux | |
grub-install --efi-directory=/boot/EFI --bootloader-id=GRUB --recheck | |
grub-mkconfig -o /boot/grub/grub.cfg | |
# | |
# Ssh server | |
# | |
pacman -S openssh | |
systemctl enable sshd | |
systemctl start sshd | |
cat > /etc/systemd/network/20-wired.network <<EOF | |
[Match] | |
Name=ens33 | |
[Network] | |
DHCP=ipv4 | |
EOF | |
systemctl enable systemd-networkd | |
systemctl start systemd-networkd | |
systemctl enable systemd-resolved | |
systemctl start systemd-resolved | |
# | |
# Gnome | |
# | |
pacman -S gnome | |
sudo systemctl enable gdm.service | |
# | |
# Install open-vm-tools to get drag and drop clipboard | |
# Reference: https://bit.ly/31NlCDx | |
# | |
pacman -S open-vm-tools | |
systemctl enable vmtoolsd | |
systemctl start vmtoolsd | |
systemctl enable vmware-vmblock-fuse | |
systemctl start vmware-vmblock-fuse | |
# | |
# This seems to fix the autoresize problem | |
# | |
pacman -S xf86-video-vmware | |
# | |
# Exit chrooted environment | |
# | |
exit | |
umount -a | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment