Installing Arch Linux on a VirtualBox
Here I am going to give you the steps of installing Arch Linux on a Virtual box.
- Open the Oracle VM VirtualBox, click on new, and type the name of Arch Linux. Then click Next.
2. Then create a VirtualMachine with 20GB Hard Disk and 1GB RAM.
1. Download Arch Linux from the Following Link:
https://www.archlinux.org/download/
In my case, I am going to use “archlinux-2018.12.01-x86_64.iso” startup disk on my virtual machine.
2. Click on Boot from Arch Linux’ x86_64 on the Opening Screen.
3. After Booting you would be getting Root Login by default.
4. Make Sure that the Internet connection is available on the machine. use following ping command to check the connection.
ping www.google.com
5. Before we start the installation, we should partition the drive. Type following command in the console and it will tell the drive details of the disk.
fdisk -l
You will be able to see the current system’s disk partition. In our case now we need to partition the 20GB hard drive to three partitions.
We are making Three Partitions
a. Primary Root partition: /dev/sda1 as Primary Boot with 10GB
b. Swap Partition: /dev/sda2 as 2xRam i.e.2048MB
c. Logical Partition Home: /dev/sda3
6. To start the partitioning, type ‘cfdisk’ command and select the label as Dos.
cfdisk
7. Creating The Primary Root Partition:
Select “New”
Enter the Partition Size as 10G and press enter to proceed.
Select this Primary Partition as Primary + Bootable.
Go to write and press enter to write partition to the disk.
8. Creating the Swap Partition:
Go to Free space. And select “New”.
Since RAM is 1024 MB, Swap size would be 2048MB.
Partition Size : 2048M
Select primary
Select Write
Go to write and press enter to write partition to the disk.
9. Creating a Logical Partition:
Go to Free space. And select “New”.
Type the Partition Size as 8G
Select Write
and Type: Yes
Now Quit from this Utility. Make sure to give bootable permission only to the ‘Primary Root Partition’.
10. You can type the following command to verify the partitioning.
fdisk -l
11. The next step is to “Format Partitions”
mkfs.ext4 /dev/sda1 — -Root Partition
mkfs.ext4 /dev/sda3— -Logical Partition
12. Format Swap Partition and Activate
mkswap /dev/sda2
swapon /dev/sda2
13. Installing Arch Linux
a. Mount Primary Partition /dev/sda1 to /mnt and Logical Partition to/mnt/home using the following commands.
mount /dev/sda1 /mnt
mkdir /mnt/home
mount /dev/sda3 /mnt/home
14. Bootstrap the system by typing:
pacstrap /mnt base base-devel
15. After bootsraping the system create fstab file using following command:
genfstab /mnt >> /mnt/etc/fstab
verify the fstab entries.
cat /mnt/etc/fstab
16. Change the system root to the Arch Linux installation directory by typing:
arch-chroot /mnt /bin/bash
17. Configure the Language
nano /etc/locale.gen
Uncomment en_US.UTF-8 UTF-8
Save the File.
18. type following command to activate.
locale-gen
19. Create /etc/locale.conf file.
nano /etc/locale.conf
Add the following line
LANG=en_US.UTF-8
Save the file.
20. Synchronize the zone information by typing:
ls /usr/share/zoneinfo/
Select your region as necessary.
ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtimehwclock --systohc --utc
21. Set the Root Password.
passwd
22. Choose the Network Configuration.
nano /etc/hostname
type any name. : eg. archserver
23. Enable the dhcpcd by typing:
systemctl enable dhcpcd
24. Grub Installation
Type the following commands:
pacman -S grub os-prober
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
25. execute following commands,
umount /mntexit
Then Reboot the system.
exit
reboot
Choose “Boot Existing OS” to boot Arch Linux on Virtual Box. Now you have successfully installed Arch Linux on your virtual machine :)