Here are the steps for Arch Linux installation on a VM and also for configuring it to have a desktop and internet connection.
- Download the Arch Linux ISO image (https://www.techspot.com/downloads/5571-arch-linux.html)
- Create a Virtual Machine on VirtualBox (Make sure the VM and VirtualBox are on the same drive (both under C:/ or D:/))
- I have used Fixed size virtual HDD to avoid potential issues with Dynamically allocating the memory (I am not sure this is required)
- Start the VM
- Select "Boot Arch Linux", the first option on setup menu. Then the system should start booting.
- We will create 3 partitions on the virtual hard disk: The first one will be the primary root partition with half the size of your total mem. size (if you total mem. is 20G, this should be 10G). The second one will be the swap partition, which will be twice the initial RAM allocation (if you allocate 1024M of RAM, this will be 2048). The third will be the logical partition with the remaining memory.
- Use cfdisk command to create partitions
- Select dos as the label type
- Press enter on Free space to create your first partition. Make it primary and bootable.
- Repeat the step 4, 2 times to create the other partitions.
- Select write to flush the changes. Type yes to confirm.
Run the following commands to format the partitions you created in the previous step.
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda3
mkswap /dev/sda2
Activate the swap by running this command
swapon /dev/sda2
mount /dev/sda1 /mnt
mkdir /mnt/home
mount /dev/sda3 /mnt/home
Bootstrap the system by running this command
pacstrap /mnt base linux linux-firmware
It can take a few minutes to complete.
After the installation generate the fstab file by typing:
genfstab /mnt >> /mnt/etc/fstab
Change the system root to the Arch Linux installation directory:
arch-chroot /mnt /bin/bash
- To configure language settings we need to install nano or a text editor. We will use pacman (package manager) to download stuff.
pacman -S nano
- Select your desired language configuration by deleting the # in front of it and pressing control + x and typing y to quit nano.
- Activate it by running
locale-gen
- Create the locale.conf by typing:
nano /etc/locale.conf
Add this line to the file:
LANG=en_US.UTF-8
- Synchronize the zone information: Following command will give you a list of available zones.
ls /usr/share/zoneinfo
- Select your zone, I will be using CET
ln –s /usr/share/zoneinfo/CET /etc/localtime
- Synchronize the hardware clock
hwclock --systohc --utc
- Set the root user password
passwd
nano /etc/hostname
-
Type any name as your hostname, save and quit.
-
Install dhcpcd to setup DHCP client
pacman -S dhcpcd
- Enable DHCP client
systemctl enable dhcpcd
- Initiate the grub installation
pacman -S grub os-prober
- Install the grub boot loader to the hard disk by typing
grub-install /dev/sda
- Configure it:
grub-mkconfig –o /boot/grub/grub.cfg
- Exit from chroot and reboot the system
exit
reboot
- After rebooting select "Boot existing OS" to boot Arch Linux
- Login with your root name & password.
Download a network manager.
pacman -S networkmanager network-manager-applet
systemctl start NetworkManager
systemctl enable NetworkManager
nmtui
useradd -m -g wheel <your_user>
passwd <your_user>
Switch to newly created user
su <your_user>
Install lightdm as the desktop manager
pacman -S lightdm
pacman -S light-dm-gtk-greeter
pacman -S lightdm-gtk-greeter-settings
Enable lightdm service
systemctl enable lightdm
Lightdm will be enabled after rebooting
systemctl list-unit-files --state=enabled
We will install xfce. You can install KDE, Gnome or whatever you like.
pacman -S xfce4
Other emulator options include st, rxvt-unicode, termite and terminator.
pacman -S alacritty
pacman -S firefox
pacman -S nautilus