Running Ubuntu Server on VirtualBox has many benefits for both personal and business use. One of the main advantages of using a minimal installation of Ubuntu Server is that it requires less resources, making it an ideal option for older or less powerful hardware. This means that users can run Ubuntu Server on a computer with less RAM and storage space, making it a great option for those who want to run a server on an older or less powerful computer.
Another benefit of running Ubuntu Server on VirtualBox is that it allows users to run multiple operating systems on the same computer. This is especially useful for developers and testers who need to test their applications on different operating systems. With VirtualBox, they can run Ubuntu Server on their main operating system, while also running other operating systems, such as Windows or MacOS, on the same computer.
Follow your distribution. On Ubuntu 20 and above:
|sudo apt update|
sudo apt install virtualbox virtualbox-ext-pack
Now download the ubuntu-22.10-live-server-amd64.iso (or any newer version) from https://ubuntu.com/download/server.
Create a new VM with the following settings:
- Type: Linux
- Version: Ubuntu (64-bit)
- At least 4096 Mb of memory
- Create a 15 GB hard disk (keep other options as selected)
- Open the Settings and chage:
- CPU: you need at least 2 CPUs
- Network: NAT
- In Network:
- Click “Advanced”
- Click “Port Forwarding”
- Add port forwarding: 8022:22
- In Storage
- Select the “Controller: IDE”
- Click the “Empty” item
- Click the small disk icon on the right panel
- Browse for the ubuntu-22.04.1-live-server-amd64.iso file
Close the settings popup and start the VM:
- In order to keep the VM small, you can select the “minimal” installation.
- When asked, install the SSH Server
- Everything else, you can just keep the default settings
- Create your account on the last screen and wait until it shows to “Reboot” then press ENTER (use TAB to move cursor to the “Reboot Now” if needed)
Note the reboot might not work well, you will have to force shutdown:
- Select the Machine menu
- Select the “Reset” menu item
Restart the machine, and let it be minimized, we don’t need it.
On you host (not in the VM), open a terminal and SSH to port 8022 to SSH to your VM:
|$||ssh -p 8022 YOUR_VM_USERNAME@0.0.0.0|
Enter the password you created in your VM.
Let’s update everything first:
|sudo apt update|
sudo apt upgrade -y
sudo shutdown -h now
The last command will shutdown the VM. Once the update is complete and the VM is stopped, let’s save its state, so we can later start over from there, or even clone it.
In VirtualBox settings, go to the Snapshots
Then “Take” a snapshot
Restart the VM, SSH to it (port 8022) and now you’re ready!
One Reply to “Running a minimal Ubuntu Server on VirtualBox”
Comments are closed.