Nowadays having local Linux server is a must for every QA engineer. Local Linux server helps to debug applications, run your tests and install additional utilities which make your life easier. In this tutorial I will show how to install Ubuntu Server on your local Windows machine.
Install VirtualBox on Windows
First of all, we have to install VirtualBox on local Windows machine. We are going to run Ubuntu Server inside VirtualBox VM. Your Windows machine is considered as host machine and Ubuntu Server as guest machine. To download latest stable version open VirtualBox official website.
Click "Download VirtualBox" image and it will show all available files to download.
From VirtualBox platform packages section you should click "Windows hosts" and after clicking download starts automatically.
Once download is complete open VirtualBox installer file. If you see dialog window with text "Oracle VM VirtualBox 7.0.6 needs the Microsoft Visual C++ 2019 Redistributable Package being installed first" you have to press "OK" button then finish VirtualBox installation.
Now you have to download Microsoft Visual C++ 2019 Redistributable Package and install it.
Make sure you download correct architecture and in case if you don't know, open CMD and type this command
wmic OS get OSArchitecture
Once Visual C++ Package is installed you can proceed with installation of VirtualBox. If everything is fine you should see VirtualBox installation window.
Click "Next" and it will ask you which features you would like to install. I recommend leaving everything as it is and click "Next" button again.
Press "Yes" button if you see warning about resetting network connection.
In a new window press "Yes" button again to agree installation of dependencies. Next you have press "Install" button to start the installation.
You have to wait until installation if done, once you press "Finish" button it will launch VirtualBox.
Download Ubuntu Server LTS version
To install Ubuntu Server with VirtualBox we have to download latest Ubuntu Server LTS version. LTS stands for long term support, and I highly recommend choosing LTS version.
You have to download ISO file and move to next step once it's done.
Create new virtual machine on VirtualBox
Now we have VirtualBox installed, latest Ubuntu Server ISO file downloaded, and we have to create new virtual machine. Click "New" button to create new virtual machine.
In "Name" field insert any meaningful name, I named it as Ubuntu Server 22.04. Select ISO image you recently downloaded. The rest you can leave as it is.
Open "Unintended Install" section, insert username and password. Make sure Hostname field does not include empty spaces and check mark is displayed next to it. Optionally, you can check "Install in Background" checkbox if you would like to install in background.
Note, "Install in Background" option didn't work for me while installing Ubuntu Server. If it happens to you as well, you should double click on virtual machine to open VM window.
In Hardware step you can increase RAM and CPU properties based on your local machine capabilities. If not sure, you can leave as it is and change these settings after installation. I increased base memory to 4GB and number of processors to 2.
In Hard Disk step I recommend only changing disk size, I allocated 50GB for virtual machine.
Now you can press "Finish" button which will start the Ubuntu Server installation.
Install Ubuntu Server on VirtualBox
First step will be to select language.
Next you have to select your keyboard layout.
Ubuntu Server comes with two versions, standard and minimized. Minimized version is often used in cloud computing and I would suggest to select it if you are familiar with Ubuntu. If not select standard version.
Do not change network settings and press Done.
Leave empty proxy address if you are not going to use proxy connection.
Use default mirror image, no need to change it. On storage configuration step leave everything as it is and move to next step.
Press "Done" button on storage confirmation step and it will display warning message. Select "Continue" and hit the Enter key.
In profile setup insert username and password. It was not supposed to show this step because we already provided required information but seems there is an issue with that.
Skip "Ubuntu Pro" option and check "Install OpenSSH server" option. Without OpenSSH server you won't be able to login through SSH connection.
In next step you can install recommended software, but I prefer to skip this step.
Once you click "Done" button Ubuntu Server installation starts. Installation is going to take some time. When installation is complete you have reboot the VM.
Take snapshot of virtual machine
One last thing I would recommend to do is to take a snapshot of virtual machine. Once VM is up and running, you have select Machine -> Take Snapshot.
Insert snapshot name and description, then hit "OK" button.
VirtualBox will create a new snapshot and if something goes wrong you will be able to restore from this point.
How to SSH to VirtualBox virtual machine
First of all you have to shutdown running VM and open VM settings. In settings select Network -> Adapter 1 and open Advanced settings.
In Advanced settings press "Port Forwarding" button.
Add new forwarding rule and save.
- Protocol: TCP
- Host IP: 127.0.0.1
- Host Port: 2222
- Guest IP: 10.0.2.15
- Guest Port: 22
Start the virtual machine.
Connect to VM via SSH protocol
Open CMD and insert this command:
ssh firstname.lastname@example.org -p 2222
You have to accept server fingerprint and insert your password to log in. If you see something similar you did everything correctly.
Congratulations, you have just installed Ubuntu Server on your local machine and connected through SSH. Now you can install product you are testing in this server, run your automated tests and experiment. Thanks for reading this tutorial, I hope it was useful.