- Setting Up Arch Linux in Virtural Box
- About Arch Linux
- Create a VM
- Install Arch Linux
- Required reading
- Post-installation setup
- Install VirtualBox Guest Additions
- Switch to Linux LTS kernel
- Some recommended UI improvements
- How to Install VirtualBox on Arch Linux
- Update Arch Linux
- Install VirtualBox on Arch Linux
- Install VirtualBox Extension Pack on Arch Linux
- Launch VirtualBox
- Conclusion
Setting Up Arch Linux in Virtural Box
This instructions used: http://www.cs.columbia.edu/~jae/4118-LAST/arch-setup-2018-1.html as a starting point. When I created my vbox, I used the above plus:
I plan on using this a a template to modify till I am happy with it. Also, it will provide a document to rebuild a VM.
About Arch Linux
There are many Linux distributions out there. Arch Linux is our choice. Start by reading a little bit about it:
Create a VM
- Download and install VirtualBox
- Also install Oracle VM VirtualBox Extension Pack
- Download archlinux-2018.01.01-x86_64.iso from Arch Linux Downloads page
- Verify the file integrity checksum
- Create a new VM in VirtualBox
- Select Arch Linux (64-bit)
- RAM: 1 GB bare minimum, 2 GB highly recommend (or even more, if your host machine has 8 GB)
- Hard disk: 20 GB bare minimum, 50 GB or more recommended. Choose “Dynamically allocated” so that the virtual disk takes up only as much space as it is currently using. Choose “VDI (VirtualBox Disk Image)”.
- Boot the VM using the live CD image you downloaded.
Install Arch Linux
Once the VM boots successfully into the Arch Live CD image, you are ready to install Arch onto your virtual hard disk. Follow the Arch Linux Installation guide carefully step-by-step.
The Arch Linux Installation guide – we’ll call it the Guide from now on – is detailed and comprehensive, but sometimes it’s a bit confusing. I have listed below some additional info and directions on some of the trickier sections of the Guide.
Note that what follows is NOT the whole instruction. They are clarifications and additional help on the Arch Linux Installation guide that you are supposed to follow.
- Set the keyboard layout Leave the default console keymap as US. Nothing to do here.
- Verify the boot mode Nothing to do here. In case you’re curious, we are booting in BIOS mode.
- Connect to the Internet Verify that the VM is connected to the Internet using the ping command.
- Update the system clock Follow the Guide’s instruction.
- Partition the disks / Format the partitions / Mount the file systems These sections point you to two other long documents, Partitioning and File systems, but don’t really tell you what to do. Skim through the documents to get an idea of what it’s talking about. Basically, you should come to an understanding of what a disk partition is. Here is what you’ll actually do. First, create a single MBR partition which fills up the entire hard disk. We will use parted :
Once you are in parted (you know it because the prompt changes to (parted) ), run the following commands:
mklabel msdos mkpart primary ext4 0% 100% set 1 boot on print quit
First we select “msdos” partition type, which is another name for the MBR partition type. Then we create a “primary” partition which will fill up 100% of the disk, and indicate that we will later format it as an “ext4” file system type. We then make the partition bootable. Finally run the print command to see if all is well before we quit out of parted. If you paid attention to the print output, you will see that your partition doesn’t actually start at the beginning of the disk, even if we told it so. Parted skipped 1049kB at the start of the disk. Don’t worry. That’s the way it should be. After creating the partition /dev/sda1, run the following command to format the partition as an ext4 filesystem:
Note that we do not create a swap partition because a swap file can be added later if necessary. Lastly, don’t forget to mount the new partition at /mnt to begin filling it up with an Arch Linux installation:
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
systemctl enable dhcpcd.service
pacman -S intel-ucode pacman -S grub grub-install --target=i386-pc /dev/sda grub-mkconfig -o /boot/grub/grub.cfg
Required reading
At this point, you have a minimally functional Arch Linux system. There are a few more things to do before you can use the system productively.
Before we begin, however, you must understand some basic concepts about Arch Linux. Please read the following short sections in the General Recommendations page:
- Section 1: System administration
- Section 2: Package management
- Section 4: Graphical user interface
After you have read the sections, move on to the post-installation setup.
Post-installation setup
useradd -m -g users -s /bin/bash archie passwd archie
At this point, you can make the non-root user a “sudoer”. A sudoer can run a command as root by passing it through the sudo command. First, install sudo:
Then, add the following lines to /etc/sudoers (you can omit the comments of course, and replace archie with your user name):
# The basic structure of a user spec looks like this: # who where = (as_whom) how: what archie ALL=(ALL) NOPASSWD: ALL
pacman -S net-tools pkgfile base-devel
You can also try running a full system upgrade to see if any of your installed packages have new versions:
# first, install Xorg pacman -S xorg xorg-server xorg-apps # install some good fonts pacman -S ttf-dejavu ttf-droid ttf-inconsolata # install Xfce pacman -S xfce4 xfce4-goodies
pacman -S gvim firefox chromium
Before you start your Xfce4 desktop, log in as the non-root user. You can switch to the 2nd virtual console by pressing Ctrl-Alt-F2 . After you log in as a non-root user, you can type the following to start your Xfce4 desktop:
Install VirtualBox Guest Additions
Now you should install VirtualBox Guest Additions inside the VM. The Guest Additions will enable very useful features like dynamically resizing the VM window, copy & paste between guest and host, time sync between guest & host, and accessing the host file system from the guest.
sudo pacman -S linux-headers sudo pacman -S virtualbox-guest-dkms sudo pacman -S virtualbox-guest-utils
sudo systemctl enable vboxservice.service
154 ? S < 0:00 [iprt-VBoxWQueue]197 ? Ssl 0:00 /usr/bin/VBoxService -f 392 ? S 0:00 /usr/bin/VBoxClient --clipboard 393 ? Sl 0:00 /usr/bin/VBoxClient --clipboard 401 ? S 0:00 /usr/bin/VBoxClient --display 402 ? S 0:00 /usr/bin/VBoxClient --display 409 ? S 0:00 /usr/bin/VBoxClient --seamless 410 ? Sl 0:00 /usr/bin/VBoxClient --seamless 415 ? S 0:00 /usr/bin/VBoxClient --draganddrop 416 ? Sl 0:00 /usr/bin/VBoxClient --draganddrop 531 pts/0 S+ 0:00 grep -i vbox
You can look through Arch’s documentation on VirtualBox for more detailed info.
Switch to Linux LTS kernel
The stock kernel of Arch Linux stays pretty close to the bleeding edge, so it gets updated very frequently. Arch offers a more stable alternative based on a kernel version designated as a Long-Term Support (LTS) version. The linux package in Arch is the stock kernel and the linux-lts package is the LTS kernel. We are going to use the LTS kernel.
- Install the LTS kernel packages.
sudo pacman -S linux-lts linux-lts-headers
so that GRUB will remember the last kernel you boosted from and make it the default entry next time you boot. Then you also need to add the following lines at the end of the file:
GRUB_SAVEDEFAULT=true GRUB_DISABLE_SUBMENU=y
Optionally, while you’re editing this file, you can make your virtual console – the text-based command line before you start Xfce – a little bigger. Change GRUB_GFXMODE=auto to:
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_COLOR_NORMAL="light-blue/black" GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
sudo grub-mkconfig -o /boot/grub/grub.cfg
- Type uname -r to see the current kernel version you’re running
- Reboot into the new LTS kernel
- Type uname -r again to see the new LTS kernel version.
Some recommended UI improvements
- Enable HiDPI support If you have a HiDPI (High Dots Per Inch) display like Apple’s Retina Display, by default VirtualBox scales the screen to half of its native resolution. You can enable HiDPI support in VirtualBox Manager’s Settings / Display. Now everything will look tiny. You need to do some work to make your desktop look good on a HiDPI screen. Here is an ArchWiki page on HiDPI.
- Better terminal font On a non-HiDPI display, I hate looking at anti-aliased fonts (i.e. fonts with shadows) in a terminal window. My favorite non-anti-aliased font is the Terminus font. Try switching your terminal font to it unless you are on a HiDPI display.
Congratulations! You have successfully installed and configured an Arch Linux system. Hopefully this is the beginning of a long-term relationship between Linux and you.
How to Install VirtualBox on Arch Linux
VirtualBox is open-source virtualization software that helps us run multiple guest operating systems (virtual machines) on a single host machine.
It supports the guest virtual machines running Windows, Linux, BSD, OS/2, Solaris, Haiku, and OSx86 operating systems.
Here, we will see how to install VirtualBox on Arch Linux.
Update Arch Linux
Before installing the VirtualBox package, update the Arch Linux packages with Pacman.
Install VirtualBox on Arch Linux
The VirtualBox package is available on the Arch Linux repository. So, you can easily install VirtualBox using the pacman command.
While installing, you will need to choose the right VirtualBox host module package based on the kernel your system currently boots into ( uname -r ) as Arch Linux supports installing multiple Linux kernels.
- For the Linux stable kernel (linux), choose virtualbox-host-modules-arch
- For any other kernel, including Linux LTS kernel (linux-lts), choose virtualbox-host-dkms
To compile VirtualBox modules, you will also need to install kernel headers.
For the Linux stable kernel (linux), install the below package.
For the Linux LTS kernel (linux-lts), install the below package.
pacman -Syy linux-lts-headers
If you use any other kernel, you can find the right kernel headers by Install VirtualBox Guest Additions Disc on Arch Linux
The VirtualBox guest addition disc provides installer packages via an ISO image for installing guest additions onto the installed virtual machines. You can find the .iso file at /usr/lib/virtualbox/additions/VBoxGuestAdditions.iso on Arch Linux.
pacman -Syy virtualbox-guest-iso
Install VirtualBox Extension Pack on Arch Linux
The Oracle Extension Pack provides additional features such as USB 2.0/3.0, VirtualBox Remote Desktop Protocol, and much more. It is released under a non-free license only available for personal use.
You can install the virtualbox-ext-oracle package from the seblu repository or manually by downloading the Oracle Extension Pack and installing it via VirtualBox GUI (File >> Preferences >> Extensions).
Launch VirtualBox
After the installation, you can launch VirtualBox by running the virtualbox command in the terminal or by going to Application Launcher.
Conclusion
That’s All. I hope you have successfully installed VirtualBox on Arch Linux.