📜 ⬆️ ⬇️

Hypervisor for Dummies

Hello! I decided to share the experience of creating a hypervisor based on Ubuntu server 14.04 LTS and a free virtual machine virtualbox 5.2 with a web-based management interface both by the server (webmin) and virtual machines (phpvirtualbox). On the network, you can find crooked instructions on raising the above on ubuntu server 16.04, but this instruction is obsolete and offers the version of virtualbox 5.0-5, despite the fact that at 16.04 in version 6 5.2 has already taken root in the official repositories. Here we fix it all. This instruction applies to both ubuntu server 14.04 and 16.04. On more recent versions did not check, but I suspect that it will also work. So, let's begin.

1. To begin, after installing ubuntu, you should update all the packages and the kernel:

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

2. Then reboot:
')
 sudo reboot now 

3. Now we will recreate sources.list with the addition of necessary repositories (for 14.04, if you have a higher version, you will have to edit trusty handles on your code name (except webmin, it is always sarge)). For convenience, log in as root:

su
or
sudo -i

4. Then backup sources.list and create a clean one:

 cd /root mv /etc/apt/sources.list /etc/apt/sources.list.bak touch /etc/apt/sources.list nano /etc/apt/sources.list 

5. Paste this into the new sources.list file:

 # deb http://ru.archive.ubuntu.com/ubuntu/ trusty main restricted deb-src http://ru.archive.ubuntu.com/ubuntu/ trusty main restricted deb http://ru.archive.ubuntu.com/ubuntu/ trusty-updates main restricted deb-src http://ru.archive.ubuntu.com/ubuntu/ trusty-updates main restricted deb http://ru.archive.ubuntu.com/ubuntu/ trusty universe deb-src http://ru.archive.ubuntu.com/ubuntu/ trusty universe deb http://ru.archive.ubuntu.com/ubuntu/ trusty-updates universe deb-src http://ru.archive.ubuntu.com/ubuntu/ trusty-updates universe deb http://ru.archive.ubuntu.com/ubuntu/ trusty multiverse deb-src http://ru.archive.ubuntu.com/ubuntu/ trusty multiverse deb http://ru.archive.ubuntu.com/ubuntu/ trusty-updates multiverse deb-src http://ru.archive.ubuntu.com/ubuntu/ trusty-updates multiverse deb http://ru.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://ru.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu trusty-security main restricted deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted deb http://security.ubuntu.com/ubuntu trusty-security universe deb-src http://security.ubuntu.com/ubuntu trusty-security universe deb http://security.ubuntu.com/ubuntu trusty-security multiverse deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse deb http://archive.canonical.com/ubuntu trusty partner deb-src http://archive.canonical.com/ubuntu trusty partner ## deb http://extras.ubuntu.com/ubuntu trusty main ## deb-src http://extras.ubuntu.com/ubuntu trusty main deb https://download.webmin.com/download/repository sarge contrib deb http://download.virtualbox.org/virtualbox/debian trusty contrib 

6. Download and install the keys:

 wget http://www.webmin.com/jcameron-key.asc wget https://www.virtualbox.org/download/oracle_vbox_2016.asc wget https://www.virtualbox.org/download/oracle_vbox.asc apt-key add jcameron-key.asc apt-key add oracle_vbox.asc apt-key add oracle_vbox_2016.asc apt-get update 

7. Install the necessary packages:

 apt-get install mysql-server apache2 php-soap webmin mc unzip traceroute apt-get install virtualbox-5.2 

8. Add a user:

 usermod -aG vboxusers { } 

Important! Use the name of the user present in the system, for it is from him that the virtual machines will be launched.
9. Next, download and install the Extension Pack:

 wget https://download.virtualbox.org/virtualbox/5.2.20/Oracle_VM_VirtualBox_Extension_Pack-5.2.20.vbox-extpack VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.20.vbox-extpack 

10. It is up to the webmord, download and install:

 wget https://github.com/phpvirtualbox/phpvirtualbox/archive/5.2-0.zip unzip 5.2-0.zip mv phpvirtualbox-5.2-0 /var/www/html/phpvirtualbox 

11. Assign the owner and rights:

 chown -R www-data:www-data /var/www/html/phpvirtualbox chmod -R 755 /var/www/html/phpvirtualbox 

12. Now copy and edit the config:

 cp /var/www/html/phpvirtualbox/config.php-example /var/www/html/phpvirtualbox/config.php nano /var/www/html/phpvirtualbox/config.php 

13. In the opened config we are only interested in 2 lines, namely

 var $username = 'user'; var $password = 'password'; 

here we bring in the real username and password from the account specified in clause 8.

14. Create and edit the / etc / default / virtualbox file:

nano /etc/default/virtualbox
and add there
VBOXWEB_USER={ 8}

15. Reboot:

 reboot now 

If everything went well, then after rebooting, the virtual machine management interface will be available at http://{ip }/phpvirtualbox , and webmin, a powerful server management interface, will be accessible at https://{ip }:10000 . To log in to the virtual machine management interface, use the standard username and password admin: admin (changes in the interface itself), and for authorization in webmin, use the real user account with root privileges (you can directly root if you unblocked it).

Source: https://habr.com/ru/post/427945/


All Articles