Menu

How to setup a hypervisor in ubuntu 16.04 with KVM and Kimchi

3 years ago 12

In this guide, we will be making our own Hypervisor in Ubuntu 16.04 by installing KVM (Kernel-based Virtual Machine) as well as Kimchi, which is a free, open-source web-based virtualization management platform so we can manage our hypervisor easily through the web browser.

You can find more info on Kimchi here

Installing kvm
Connect to your server as the admin user via SSH.

ssh [email protected]

Update and upgrade your web server

sudo apt-get update && sudo apt-get upgrade -y

Install KVM and all dependencies required

sudo apt-get install qemu qemu-kvm libvirt-bin

Verify the kvm installation

$ kvm-ok

INFO: /dev/kvm exists
KVM acceleration can be used

Installing Kimchi:

sudo apt-get install nginx

wget https://github.com/kimchi-project/kimchi/releases/download/2.5.0/wok-2.5.0-0.noarch.deb

wget http://kimchi-project.github.io/gingerbase/downloads/latest/ginger-base.noarch.deb

wget https://github.com/kimchi-project/kimchi/releases/download/2.5.0/kimchi-2.5.0-0.noarch.deb

Installing dependencies:

sudo dpkg -i wok-2.5.0-0.noarch.deb

sudo apt-get install -f

sudo service wokd start

sudo dpkg -i ginger-base.noarch.deb

sudo apt-get install -f

sudo service wokd restart

#reboot here
sudo shutdown -r now

sudo dpkg -i kimchi-2.5.0-0.noarch.deb

sudo apt-get install -f

#reboot here
sudo shutdown -r now

#If you have UFW enabled please add the port
sudo ufw allow 8001/tcp

Now open the web interface on

https://Server_IP:8001 You should see the following

Now lets create our first VM, we need to log in using your normal ubuntu username and password.

For testing we will download an Ubuntu Server image to the /var/lib/kimchi/isos directory which is the default path to the ISO repository

cd /var/lib/kimchi/isos

sudo wget http://releases.ubuntu.com/16.04.2/ubuntu-16.04.2-server-amd64.iso

Now from the web interface we go to Virtualization > Templates > + Add Template

In this case i am selecting, the 16.04.2 Template and then click on Create this should add a new template as shown below

Feel free to add more ram, CPU, disk space as desired using the actions > edit button, at this point, it is just a template and not yet a vm.

Now we will create a vm using this template.

From the web interface we go to Virtualization > Guests > + Add Guest

Then we choose the VM Name and the template to use and hit create.

Important Note: Do not include any spaces in your VM name or you will be unable to start your VM.

Once this is done, it is time to start your VM by pressing the Actions Menu > Start option

That’s it you now have a working Ubuntu VM running, you can press the view console link to access your VM’s console.

Optional Change Port to 443:

Change the port in the Nginx Config

sudo nano /etc/nginx/conf.d/wok.conf

Look for the following line

listen 0.0.0.0:8001 ssl;

Change it to

listen 0.0.0.0:443 ssl;

Also locate inside of location / config

proxy_redirect http://127.0.0.1:8010/ https://$host:8001/;

Change this to

proxy_redirect http://127.0.0.1:8010/ https://$host:443/;

Change the port in the Wok config

sudo nano /etc/wok/wok.conf

Uncomment the following line

#proxy_port = 8001

Change it to

proxy_port = 443

If you have UFW enabled please add the port

sudo ufw allow 443/tcp

Restart Wok and Nginx

sudo service wokd restart
sudo service nginx restart

That is it now you can open the web interface on

https://Server_IP