w3resource logo


web-server

Installation Ubuntu Server

Secondary Nav

Getting started

Why install on Virtual server

  • You can use your existing hardware in an efficient way.
  • Maintenance and disaster recovery become easy.
  • For even a single service like a web server, email server etc. you can assign a Linux virtual machine and thus keep things simple.
  • You can run multiple guests on a single machine.

Virtualisation

Ubuntu server on VMware on any host

  • Download the server image from http:// www.ubuntu.com/getubuntu/downloadserver
  • Start Vmware
  • Create a new virtual machine using the image you just downloaded

Hands-on Installation

Here is an overview of a sample partioning on hard drive.

Directory Type File System Typical Size Size LAB
/boot Primary Ext2 100MB 200MB
/var LMV XFS 4GB 700MB
/home LVM XFS 200MB 3GB
/ LVM Ext3 50GB 2GB
swap LVM Swap 1GB 200MB

Option 2: Linux guests to an Ubuntu host running KVM

  • KVM is the default virtualisation technology that ships with current versions of Ubuntu
  • Requires hardware with virtualisation extensions

One host, many guests

  • Ubuntu guest
  • Windows guest

Install a guest

Can your hardware support KVM?

inspect the cpuinfo virtual file:

egrep '(vmx|svm)' --color=always /proc/cpuinfo

No output means no KVM support. Try checking virtualization settings in the BIOS.

If there is support, install the required packages:

$ sudo apt-get install kvm libvirt-bin ubuntu-vmbuilder
qemu bridge-utils virt-viewer
  • libvirt-bin provides libvirtd which you need to administer qemu and kvm instances using libvirt
  • kvm is the backend
  • ubuntu-vm-builder powerful command line tool for building virtual machines
  • bridge-utils provides a bridge from your network to the virtual machines

Install guest

Add your user name to the libvirtd group

More about user management later. -->

$ sudo usermod -aG libvirtd `id -un`

This will give you access to the system-wide libvirtd instance. Log out and in to make this effective.

Test the installation is valid:

virsh is the main interface for managing guest domains

$ virsh -c qemu:///system list Id Name State
$

Install KVM

Run the KVM command as root to reveal problems, such as lack of hardware

kvm command can be used to start guest machines directly

$ sudo kvm
QEMU PC emulator version 0.9.1 (kvm-62),
Copyright (c) 2003-2008 Fabrice Bellard
usage: qemu [options] [disk_image]
...
$

Setup virtual network

You need to configure bridge networking to enable network services to the VM and VM access to the outside world. The VM will access the network through the host’s physical network interface.

Install the bridge utility with the following command

sudo apt-get install bridge-utils

Stop networking services

sudo invoke-rc.d networking stop

Setup the virtual network step 2

Edit /etc/network/
interfaces and add
the br0 section:

content of/etc/network/

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.0.10
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0

You may also use DHCP instead of fixed IP address.

Setup the virtual network step 3

Restart networking services:

sudo /etc/init.d/networking restart


Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program