Setup Virtual Development Environment
Hypervisor Setup
A hypervisor in it’s simplest form is software used to manage and run virtual machines.
I can’t harp enough on how much I love VirtualBox, it’s free, open-source, and really enabling bidirectional copy-pasta’s is a godsend. VMware is also a good alternative, but I’ve never returned since the time they made the clipboard feature a paid feature.
Download and install VirtualBox.
I would also recommend installing the VirtualBox’s Extension Pack, it adds a lot of useful features, one of which is the Guest Additions. The Guest Additions is a set of drivers and software that will allow you to install the necessary drivers for your VMs, it will allow you to resize your VM window and enable bidirectional copy-pasta’s.
Download and install VirtualBox Guest Additions.
Virtual Machine Setup
A virtual machine is really just a regular computer that is completely virtual and managed by the hypervisor.
You can use any operating system installation iso image to create a virtual machine, as long as you have the resources to support the minimal requirements. If you have experience with it, you can use DistroWatch and Linux Distribution Timeline for finding other distributions.
However, for the sake of this write-up I’m going to stick to and recommend Ubuntu 22.2.
Creating a Virtual Machine
To kick this off, you should download Ubuntu 22 LTS, you can download the ISO image from the following link:
Download Ubuntu 22 LTS.
Now that you have your ISO image, you can create your virtual machine.
Once you’ve opened VirtualBox, you can create your virtual machine by clicking on New
to create a new virtual machine.
A popup will appear, fill out the following:
Virtual Machine Name and Operating System
- Name:
vm-ubuntu-1
- Folder:
Default
- ISO Image:
Select the Ubuntu ISO image you downloaded
- Edition:
Default
(Greyed out)- Type:
Linux
(Greyed out)- Version:
Ubuntu (64-bit)
(Greyed out)- Skip Unattended Installation:
CHECKED
(DO NOT UNCHECK THIS BOX) For Ubuntu checking this will NOT set the root password and will not add you to sudoers.
After you’ve filled out the above, click Next
to continue. You will now be prompted to select your hardware settings.
Hardware
- Base Memory:
1024 MB
(Recommended between4096 MB
to8192 MB
for a dev machine).- Processors:
1 CPU
(Recommended between2 CPU
to4 CPU
for a dev machine, too many can cause lag).- Enable EFI (special OSes only):
UNCHECKED
(unless you’re installing macOS)
After you’ve filled out the above, click Next
to continue. You will now be prompted to select your virtual hard disk settings.
Virtual Hard Disk
- Hard disk:
Create a virtual hard disk now
- Disk Size:
25.00 GB
(Recommended between50.00 GB
to100.00 GB
for a dev machine, or more).- Pre-allocate Full Size:
UNCHECKED
After you’ve filled out the above, click Next
to continue. You will now be prompted with a summary of your settings, click Finish
to create your VM.
Now on your VirtualBox Manager, select your newly created VM from the panel and click on Settings
.
You need to update your Network Adapter settings:
Settings Menu:
- Network Adapter:
- Attached to:
Bridged Adapter
- Name:
Select the network adapter that is connected to your local host
- Advanved:
- Promiscuous Mode:
Allow All
- MAC Address:
Default
- Cable Connected:
- Port Forwarding:
EMPTY
Click on OK
to save your network adapter settings.
This next step is optional, this is primarily for users who are intending to use the GUI for their VM and want to have a better experience.
You can also update your Display settings:
Settings Menu:
- Display:
- Screen:
- Video Memory:
128 MB
(Recommended between256 MB
to512 MB
for a dev machine).- Graphics Controller:
VMSVGA
Click on OK
to save your display settings.
Another optional, yet highly recommended step is to update your Shared Clipboard settings:
Settings Menu:
- General
- Advanced:
- Shared Clipboard:
Bidirectional
Click on OK
to save your shared clipboard settings.
Instance First Startup
Finally, you can start your VM by clicking on Start
.
Sometimes, but not always, you may get a popup asking you to select your boot media. If you do, then you can select your ISO image and click on Start
.
You should now be greeted with the Ubuntu installation screen.
Setup Menus:
- Select your language and press
ENTER
.- Select Install Ubuntu Desktop and press
ENTER
.- Select your language and press
ENTER
.- Select your keyboard layout and press
ENTER
.- Select Normal installation and press
ENTER
.- Select Download updates while installing Ubuntu and press
ENTER
.- Select Erase disk and install Ubuntu and press
ENTER
.- Select Continue and press
ENTER
.- Select your timezone and press
ENTER
.- Select your keyboard layout and press
ENTER
.- Enter your user details:
- Your name:
username
- Your computer’s name:
vm-ubuntu-1
- Pick a username:
username
- Choose a password:
password
- Confirm your password:
password
- Log in automatically:
UNCHECKED
This is entirely user preference, if you setup an SSH server then you will almost never need to login to your VM directly if you really like the CLI. Once your VM is on, you can SSH into it.
- Select
Continue
and pressENTER
.
Once you’ve completed the above steps, you can now wait for the installation to finish.
Note: This may take a while, so you can go grab a coffee or something.
Once the installation is complete, you will be prompted to restart your VM.
Note: You can restart your VM by clicking on the
Machine
menu and selectingReset
.
Once your VM has restarted, you will be prompted to login.
- Enter your password and press
ENTER
.- You will be prompted to enter your password again, enter your password and press
ENTER
.
You should now be greeted with the Ubuntu desktop.
Note: If you’re using a VM with a GUI, you can resize your VM window to your liking. If you’re using a VM without a GUI, you can skip this step.
You can now shutdown your VM by clicking on the Power
icon on the top right corner of the screen and selecting Power Off
.
Note: You can also shutdown your VM by clicking on the
Machine
menu and selectingACPI Shutdown
.
Initial Setup and Configuration
Now that you have your VM setup, you can start using it. We can start off by updating your system, since your packages and system updates are a bit behind since they created the ISO image.
- Open a terminal with
CTRL+ALT+T
. - Update your system.
1
sudo apt-get update && sudo apt-get upgrade -y
- If you get an error like
user is not in the sudoers file
, then you have two options.
Option 1: Add your yourself to sudoers group.
- First drop into root user shell.
1sudo su -
- Add your user to the sudoers file.
1 usermod -aG sudo <username>or
1adduser <username> sudo
- Exit the root user shell.
1exit
- Restart your VM.
1sudo reboot
Option 2: Manually add your user to the sudoers file.
- Open the sudoers file.
1sudo nano /etc/sudoers
- Add the following line to the end of the file.
1 <username> ALL=(ALL) NOPASSWD:ALL- Save the file with
CTRL+O
and exit withCTRL+X
.- Restart your VM.
1sudo reboot
- Install required dependencies for future steps.
1
2
3
sudo apt install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git