Configuring a Virtual Machine in VirtualBox
- First off you will need a computer that is capable of hosting a virtual machine. Macs by default are ready to go out of the box but if you are on a PC you may need to do some digging to double check that you can virtualize. If your computer is relatively new then there is a good chance you are good to go without having to configure anything. Peep this stack overflow question/answer to learn how to check if your PC is virtualization capable:
Check if Virtualization is Enabled
If virtualization is not enabled you’ll need to dig around your BIOS to enable it. Do a Google search on your PC or motherboard model in order to find out how to do so for your specific machine.
- Secondly you’ll need installation media. You can download Ubuntu server here (version at the time of this writing is 20.04.1):
Download Ubuntu Server
Save this iso as we’ll need it shortly.
- Lastly download the latest version of VirtualBox for your platform. You can find their downloads here:
Let’s get down to it then! Once installed launch VirtualBox to get to the welcome screen. Then click “New” to begin the process of setting up a new virtual machine.
A new screen will pop up. This is “Guided Mode” for setting up a vm. Let’s get down and dirty by clicking “Expert Mode”.
Here we have advanced options for our new vm. Start by giving your vm a name. If you wish to store your virtual machine files elsewhere you can change that here as well. Change the “Type” to “Linux” then change the “Version” to “Ubuntu 64bit”. Memory allocation can be set here. Since we are just experimenting with Ubuntu and doing relatively simple stuff 1Gb (1024Mb) of RAM is adequate for our purposes. While you cannot change the number of CPU cores you wish to make available to your vm you can do so later. The default is 1 core, which is also adequate. Tick “Create a virtual hard disk now” then click “Create”.
Next you can specify virtual hard disk settings. You can change the location of where this hard disk will live on your computer if you wish. 10Gb is adequate for our purposes but you can allocate more or less. I like using VHD files but you can leave the default setting (VDI). Dynamic allocation means that the hard drive will only be as big on your hard disk as the space it takes up. If you have a 10Gb hard disk that is only half full, it will only take up 5Gb of space on your host computer. Fixed size means that it will create a 10Gb VHD file for the vm’s hard disk. Click “Create”.
Next you’ll see the main VirtualBox window with your freshly created vm! We need to add our Ubuntu installation file to the cd drive as if we physically put a disc into the drive. With the virtual machine highlighted on the left, click “Settings”.
In the Settings section click the “Storage” tab up top. While the “Empty” optical drive is highlighted on the left (identified by the little cd icon) click the little CD icon next to the “Optical Drive” setting. Select choose a disk file. In the window that pops up browse to the location of the Ubuntu ISO we downloaded earlier.
That’s it! We’ve successfully created a virtual machine instance whose optical drive is loaded up with our Ubuntu ISO and is ready for boot/installation. The machine is configured with 1 CPU core and 1Gb of RAM.
Next we’ll walk through installing our headless server version of Ubuntu off of our downloaded ISO file.
I’m just a normal sysadmin type guy who likes cybersecurity a lot.