Install Ubuntu Server on Virtualbox, Guest Addition & Solve network problem


Installing Ubuntu Desktop 11.04 or 11.10 on Virtualbox is easy. All you need is just configure NAT & Host-only adapter to make VM can connect to internet and Host.
Also, there is easy installation for Virtualbox Guest Addition, which can done with right-click.

But it’s different with Ubuntu Server on Virtualbox. It’s doesn’t have GUI. So, we need to install Virtualbox Guest Addition manually. Other problem is about network adapters problem. I have tried with Ubuntu 11.04 Natty and 11.10 Oneiric. All results are same! Virtualbox only detecting one network cards only.

So, let start with VboxGuestAddition. Click on Devices menu and select Install Guest Additions. Then go to terminal and do this :

1
2
3
4
5
6
sudo apt-get install linux-headers-$(uname -r) build-essential
sudo mkdir /tmp/cdrom
sudo mount /dev/cdrom /tmp/cdrom
sudo su
cd /tmp/cdrom
./VBoxLinuxAdditions.run

Now Virtualbox Guest Addition success installed.

Then we need to solve network card problem. We need to delete network rules to reset network interfaces.

1
sudo rm -rf /etc/udev/rules.d/70-persistent-net.rules


Then shutdown VM and go to network settings. Add 2 Network interfaces (NAT and Host-only adapter). Boot VM again.

When doing “sudo ifconfig”, you will find only one card that show. In my VM, eth1 (host-only adapter) show up, but not with eth0. So i check if eth0 can be up.

1
2
sudo ifconfig eth0 up
sudo dhclient eth0

Voila! I get my eth0 NAT up and connect to internet. Then, we can make eth0 show up automatically by editing “/etc/network/interfaces”.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# This file describes the network interfaces 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
auto eth1
iface eth1 inet dhcp

# The primary network interface
auto eth0
iface eth0 inet dhcp

Now i have two networks NAT & Host-only adapter works in Ubuntu Server on Virtualbox.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.