Arch is another Linux distribution that is very popular in the Linux users. Arch is installed as a minimal base system without any desktop environment and the user has to do the most part to set things up. It has its own package management system called pacman and uses a rolling release which needs one time installation and further updates are pushed on it. Now since it's a minimal system installation, most of things are to be configured by the user himself. If you are planning to install Arch Linux in VirtualBox, you have to take care of various things.
In this article, we will see how to install Arch Linux in VirtualBox. The steps to install it along side Windows is same.
Download Arch Linux
You can grab a copy of Arch Linux from the official website : https://www.archlinux.org/download/.
Current release is 2017.05.01 running on Kernel 4.10.13. I have a two month old copy with me, version 2017.03.01 and to save some bandwidth, I will install this in VirtualBox. The process will be same for any version, though.
Setting up VirtualBox
I assume you have downloaded and install Oracle VM VirtualBox. Start the application and click on New to create a new Virtual Machine. Give your Virtual Machine a name and choose the Type and Version. Typing Arch Linux in the name will set the Type to Linux and Version to Arch Linux 64-bit. Also, it will set the Memory Size to 1 GB. You can increase it if you have a good amount of RAM. Leave the hard disk option to Create a virtual hard disk now.
In the next screen, assign the size of the Virtual Disk you are creating for the Arch Linux. Leave all the options to their default value.
Installing Arch Linux in VirtualBox
After setting up the Virtual Machine, the next step is to install Arch Linux. Start the machine you have created and a dialogue box will appear asking you to select the virtual optical disk file or a physical optical drive to start your new virtual machine.
Click on the folder icon and navigate to ISO file which you have downloaded. Click on Start to start boot into Arch Linux.
The next screen is the boot screen. Select Boot Arch Linux option and after various checks and service start up, Arch Linux will boot up but in command line.
Partitioning your disk
The next step will be partitioning the drive that you have allocated. I will be selecting 10GB for root, 4 GB for SWAP and the remaining for home storage for home partition. I will use fdisk command for partition.
Type lsbl to check the disk name which we have created. It should be sda.
Enter the below command for partitioning.
fdisk /dev/sda
For Command (m for help):, type n, then p for primary partition, 1 as the default partition no., enter to select the default first sector, and +10G for assigning 10GB for root.
Repeat the same process for swap. For the third partition which is gonna be the home partition, do not enter the size but press enter. It will accept the default last sector.
To view the partitions you have just created, you can press p.
Enter w commands to write all these entries permanently. These won't be written unless you issue the w command.
Creating filesystems
Next step is to create filesystem and format the partitions we have just created.
We will use mkfs to create the file system and mkswap command to create the swap space.
Type in the following commands for the above work:
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda3
for swap:
mkswap /dev/sda2
swapon /dev/sda2
You can check the partitioned disks by command lsblk.
The next step is to mount the filesystem we have created. Type in the following commands to mount.
mount /dev/sda1 /mnt
mkdir /mnt/home
mount /dev/sda3 /mnt/home
Installing the Base
pacstrap command is used to initiate the base installation.
pacstrap /mnt base base-devel
This will download the necessary package and installs them.
The installation will take some minutes depending upon your internet speed.
The next step is to create a mount table. Type in the following command.
mount /dev/sda1 /mnt
genfstab /mnt>> /mnt/etc/fstab
Mount table makes sure which filesystesm are mounted while boot up.
The next step is to configure the Base system.
Type in the following commands :
arch-chroot /mnt /bin/bash
This will change the system root to Arch Linux installation.
Configuring locale settings and time zone
locale settings are used for system language. Open file /etc/locale.gen and uncomment the language you want to use. I had to un-comment en_GB.UTF-8. To un-comment, remove the hash # sign from the line.
Now, run the following command :
locale-gen
echo LANG=en_GB.UTF-8 > /etc/locale.conf
export LANG=en_GB.UTF-8
This will create locale.conf file at /etc location. Create another file manually
vi /etc/vconsole.conf and add the following line : KEYMAP=us
Now, to configure the timezone, you will need to check it first. Type in the following command to get the available zone
ls /usr/share/zoneinfo/
check the subzone
ls /usr/share/zoneinfo/
Once decided, set the timezone by typing the following command :
ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
Next step is to set the hardware clock. time the following command :
hwclock --systohc --utc
Setting host names, root user, passwords
We are on the verge of competing installation of Arch Linux in a VirtualBox.
To create a hostname, type in the following commands:
echo archLinux > /etc/hostname
I am putting archLinux as the hostname. Add this hostname to the hosts file too. Host files are present at /etc/hosts.
nano /etc/hosts
and add archLinux.
Now run the an update to your system
pacman -Syu
This will synchronize the database package.
Create a root password and installing bootloader.
Use the command passwd to create the root password for your Arch Linux Root account.
The final step is to install a bootloader. Type the following command :
pacman -S grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
You are done with Arch Installation, before restart, exit the chroot environment, and unmount the filesystem.
Type these commands :
exit
umount /mnt/home
umount /mnt
reboot
At reboot, select Boot existing OS. Enter root as username and password which you have set in the above step to login.
Now, lets install a Desktop Environment.
Installing GNOME desktop environment in Arch Linux
You will first need to configure the network.
Type ip link to get the interface name. My interface name is enp0s3. Type the below command now.
vi /etc/systemd/network/enp0s3.network
and add the following info in the file.
[Match]
name=en*
[Network]
DHCP=yes
Save the file and exit. Type the following command to activate the changes:
systemctl restart systemd-networkd
systemctl enable systemd-networkd
Before we have network connectivity, edit the file /etc/resolv.conf and and 2 name server entries :
nameserver 8.8.8.8
nameserver 8.8.4.4
Now, you should have the network connectivity. You can ping google.com to check it.
Installing X environment
This will install a platform and necessary components to install a desktop environment. Type the following command :
pacman -S xorg xorg-server
This will install X Windows System. We are going to install GNOME desktop environment. Type the command :
pacman -S gnome gnome-extra
The next step is to install a display manager on Arch Linux and enable it so that a login screen is displayed on the start-up. GNOME includes the default display manager gdm but we have to enable it.
systemctl start gdm.service
systemctl enable gdm.service
That's it. Restart your virtual machine and boot into Arch Linux. Input the login credentials and you will be presented with Arch Linux with GNOME desktop environments.
Let me know in the comments if you face any error. Arch Wiki is very well managed and chances are that you will find solution to any problem you face during the installation. Also, Arch Linux experience in virtual box is not up to the level when you install it as a primary OS.
0 komentar:
Posting Komentar