Posted by Daniel Lanza on April 15, 2016
This tutorial will explain how to install Ubuntu Server on a virtual machine.
First, you need to have Ubuntu Server ISO file and VirtualBox installed.
Create a new virtual machine on VirtualBox by clicking on New.
Select type and version of the virtual machine. In this case, Linux and Ubuntu (64-bits).
Select the amount of memory (RAM). VirtualBox recommends 768 MB. I selected 1,536 MB to have enough memory.
Select the hard disk size. 16 GB is enough.
Click and start the new virtual machine.
At this point, you need to load the Ubuntu Server ISO file.
Ubuntu Server installation has started. Select the language. In this example, English.
Select Install Ubuntu Server.
Choose your language, location and country of origin keyboard.
Type the Ubuntu Server hostname. This hostname will be used to access the server. I typed ubuntuvmsrv. vm means virtual machine on the network and srv server.
Type your real name, your username and your password.
Ubuntu can guide you regarding partitions. This is a virtual machine to test, so I selected Guided - use entire disk.
Configure updates as you want. I select manually updates.
You can choose software installation. I chose (with space bar):
Set MySQL server root password.
Select install GRBU boot loader on hard disk.
Congratullations! You have first installed Ubuntu Server on a virtual machine.
The virtual machine is restarted, and you will get a prompt to login. Use your username and password to login.
Update your Ubuntu Server with the following command:
sudo apt-get upgrade
The Ubuntu Server is ready to use. Although, a virtual machine network setting is needed.
We will need two network adapters:
Check out your virtual machine recognizes the two adapters.
$ ls /sys/class/net eth0 eth1 lo
Add the second interface with a static IP address for the host-only adapter (eth1).
sudo vim /etc/network/interface
Type the following text and save.
# This file describes the network interface available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface (NAT adapter) auto eth0 iface eth0 inet dhcp # The second network interface (Host-only adapter) auto eth1 iface eth1 inet static address 192.168.56.101 netmask 255.255.255.0 network 192.168.56.0 broadcast 192.168.56.255
Restart the virtual machine.
sudo shutdown -h now
When Ubuntu Server is started, check out the static IP address for host-only adapter is available to show (eth1).
ip addr show
Type the IP in your local machine, and you will see the Apache2 Ubuntu Default Page.
Enjoy your new virtual machine! 😃