Part 2 of the series How I use Linux desktop at work
Just to recap, this series is describing how I leverage vagrant and VirtualBox to provision development VM on my work PCs. I’m also taking the opportunity to build them from scratch with the tools I use at home.
In the post, we go over:
The end result is a versioned configuration that can provision a basic arch VM with X and a window manager.
Note: You can find the sources created during this post in my github devbox-arch repository.
Stuff assumed to be configured before starting and already covered in part1:
Also I make use of git bash to version control my configuration and also to run vagrant.
Note: Many commands below will run fine on git bash, but not on powershell. Just take this into consideration.
At this stage, we’ll create a bare minimum vagrant file that creates VM based on arch.
I use the official arch vagrant box called archlinux/archlinux.
In my git bash, I type:
That’s it. Lets boot it up and connect to it:
Might as well create a git repository right away. This will create a safe environment to break things and revert if needed.
The VM we just created is good enough for console tools, but if we are going to use this for a development VM running X, we need to allocate more resources, setup graphic properties, setup host/guest integration.
Here is my vagrant file, it includes variables to define various properties like memory, CPUs, monitors. My objective is to be able to quickly adapt to the resources available on the host computer I use.
Couple of things to note about the vagrant file below:
You may want to destroy your VM (vagrant destroy) and recreate it (vagrant up).
You may want to add / change the configuration described above. The vb.customize configurations above use the VBoxManage.exe command from the C:\Program Files\oracle\virtualbox folder.
Call VBoxManage to get more details or you can head over to the VBoxManage documentation.
My strategy to provision the configure the OS is to keep the configuration out of the VagrantFile and create a series of shell scripts called by the VagrantFile.
This is done by the provisioner options.
Here is an example calling a specific script as root (by default).
Followed by a vagrant command to run the provision script:
The config.vm.provision instruction supports inline scripting as well as normal user provisioning.
The setup arch contains instructions to:
Same as with arch config, I’m using a script to setup X and related software.
Again followed by:
Some objectives for the core provisioning script is:
Now you should see a GUI login prompt with the vagrant user selected. You can enter the super secret password (ie: vagrant).
Warning: The vagrant account is safe as long as you don’t weaken the existing setup (like: enable services using password authentication).
I’m running out of time, and as I previously posted, I prefer something working to something perfect.
Here are the things I’ll be improving and describing in future posts:
So in a nutshell, the 2-core.sh script will evolve.
Got two issues while building this configuration:
pacman update fails due to bad mirror.
This is why I’ve been selecting the first mirror that works for me
guest OS resolution does not adjust with the VM window size. I wasted quite some time trying to find why.
This issue is due to incompatibility with your VirtualBox and the install guest additions. you have two choices here:
This is becoming my default setup for both home and work.
You will find this particular configuration in my git repository: devbox-arch.
If you look at the master branch, you’ll most definitively find something different as this configuration will evolve over time.
Some topics for the near future:
I hope this series is of some use to others and inspire people to use tools that suits their needs.
This is day 4 of my #100DaysToOffload. You can read more about the challenge here: https://100daystooffload.com.