I recently upgraded to a new system, and instead of running Arch Linux natively I've decided to run it inside VirtualBox on Windows 10. Below I note down the steps I took, which closely follow the excellent wiki pages of archlinux. But along the way, I also noted a few other steps steps I took to make this system very comfortable, which you'll have to figure out for yourself if you like them or not!
There isn't much of preparation required, given that I started from scratch, but I did have to setup my windows environment a little bit.
- Install the windows package manager chocolatey
- Install qBittorrent (which will be used to download an iso copy of arch) by running the following command from the command line
choco install qbittorrent(recommended to run the command line as an administrator)
- Head over to the Arch Linux download section and click the torrent link for the latest version (I'm not pasting the link here, because arch evolves so fast that next time anyone reads this gist it is very likely that it will already be old). This normally should start your qBittorrent. Please consider seeding others once you are done with your download.
- Unless you've already installed Virtual Box from the download website, I personally prefer to use Chocolatey because its faster by typing
choco install virtualboxfollowed by installing the [guest additions] (http://download.virtualbox.org/virtualbox/5.0.10/Oracle_VM_VirtualBox_Extension_Pack-5.0.10-104061.vbox-extpack)
- While you are at it, why don't you invert your colors in Windows to relax your eyes? Hit the
Windows Key + Minus Sign, which will start the handy Magnifier app, followed by
Ctrl + Alt + Iwhich will toggle inverting your colors.
- And while you are really at it, consider adding Vimium to your Chrome browser.
And that's it. I'm now ready to follow the setups listed on the arch wiki.
I couldn't find a section on the Arch wiki where these steps are listed, perhaps they are obvious, but since I think I know what I'm doing I'm just going off script here (what a great start!).
- Start VirtualBox and click
- Name your machine, preferably with a descriptive but memorable name (e.g.,
exultant carpenter), select type
Linux, and version
Arch Linux (64 bit)(unless you downloaded the 32 bit version. A note on this, I recall in the past that for some machines you may need to go inside your UEFI/BIOS firmware, and enable Intel VT-x to be able to run the 64 bit version, highly recommended!)
- Next set your RAM. I have 16GB and I want to make this my main development environment, so I decide to set mine to 8192MB, but Arch Linux requires much less than that.
- Create a virtual hard disk now and select
Dynamically allocatedon the next screens.
- Select a reasonable disk size (e.g., 40GB). Note that all of those settings are not that important at the moment as they can be changed in the future
- Once this wizard completes, hit
settingsand make a few additional changes. Namely:
System > Processor > 2 CPU,
Display > Screen > Video Memory 128MB & Monitor Count 4 & Enable 3D(or whatever is the number of monitors that you have, hopefully >1 unless you sport a 4K monitor)
- And finally go to
Storage > Storage Tree > Controller: IDE > Optical Drive + icon > Choose Diskand navigate to where the ISO file you downloaded previously is stored (I personally moved the ISO under
- Click ok and you are now ready to Start the VM
- Once started, select `Boot Arch Linux (x86_64)
We now want to install Arch Linux as guest to our Virtual Box, following the steps listed here.
- I skip over setting up my keyboard and my internet, because I'm happy with the keyboard default and my internet works (as is verified by typing
- Start system clock with
timedatectl set-ntp true
- This step is informational only: list block devices with
lsblk, you will see
sdawith a size of XXG and type
disklisted as well as
sr0where the ISO. Our goal here is to make
sdabootable but at this point its just an unmounted, unformatted block, which is pretty useless. So let's setup a partition in
parted /dev/sda, and once inside parted type
mklabel msdosto setup a new MBR/msdos partition (why not
mklabel gpt? this is because VirtualBox offers an BIOS system)
- Next I follow the BIOS/MBR example. I run
mkpart primary ext4 0% 100%,
set 1 boot on, and
- Format the partition in ext4 with
mkfs.ext4 /dev/sda1and mount it with
mount /dev/sda1 /mnt
- I skip over changing the mirrors
- Install the base packages with
pacstrap -i /mnt base base-devel(if this is your first time using pacman, rejoice because it will be the main reason you will love Arch Linux! You will be prompted with a few confirmation screens, just keeping hitting enter until you downloads start (this may take a few minutes, depending on the speed of your internet connection). A quick note on the questions in Linux that end with
[Y/n], these are usually pretty safe questions, so you don't actually need to type
Yand can just hit enter. More discussion about this here for example.
- Generate an fstab file using
genfstab -U /mnt > /mnt/etc/fstaband change root using
arch-chroot /mnt /bin/bash
- To help your locale-aware programs and libraries render text, regional monetary values, time and date formats correctly, set your Locale I type the following (assuming US):
vi /etc/locale.gen, which will open the vi editor,
/en_US.UTF-8, followed by the character
xto delete the leading
#, which uncomments the appropriate line, and finally
:wqwhich saves and quits the file
tzselectto find your time zone, and type
ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtimewhere
Zone/SubZoneis your selection. Since windows 10 is also installed on the machine, important to set
hwclock --systohc --utc
- Do not install microcode updates, as this is a virtual machine
- Install grub package with
pacman -S grub os-prober
- Next pick a hostname to refer to your machine on the network, I pick
exultantcarpenter, and put this is a file as such
echo exultantcarpenter > /etc/hostname. Also add this hostname to
/etc/hostsby adding it as an option beside localhost (the line should look like
127.0.0.1 localhost.localdomain localhost exultantcarpenter, all separated by tabs.
- Ensure that you machine will be able to connect to the internet when boot in the future, by running the following two commands. 1)
ls /sys/class/netwhich will output two words to the screen, for instance
enp0s8 lo. and 2)
systemctl enable email@example.com, where you replace
enp0s8with what your first command outputed.
- Almost there! Next we set a password, unmount and reboot! Set a password with
passwd, exit chroot with
exit, unmount with
umount -R /mnt, and reboot with
shutdown. Once the machine is off the virtual machine, return to VirtualBox, select the machine, and remove the drive (
Settings > Storage > Storage Tree, select the ISO and click on the minus sign to remove)
- Hit start again and you are done!
At this point, you can take a break and come back later to continue the setup of all your favorite goodies for your brand new Arch Linux (xmonad, haskell, R, apache Spark, clojure).