Virtualbox Virtualization system, currently one of the best free virtualization software products. Personally tested the work of guests: XP, Windows 2003, 2008, Debian, Ubuntu is stable.
phpVirtualBox AJAX is an implementation of the VirtualBox user interface written in PHP. This is a web interface for remote access to virtual machines.
To install Virtualbox, we will use the Linux Debian GNU/Linux operating system with the installed ISPConfig hosting control panel installed according to the instructions: Install and configure hosting panel ISPConfig 3 in Debian
Add a repository from the official Virtualbox website.
We add a repository to source.list by the team:
For Debian Wheezy:
echo 'deb http://download.virtualbox.org/virtualbox/debian wheezy contrib' >> /etc/apt/sources.list
For Debian Jessie:
echo 'deb http://download.virtualbox.org/virtualbox/debian jessie contrib' >> /etc/apt/sources.list
Add the virtualbox repository public key with the command:
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | apt-key add - wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | apt-key add -
Update the repository and start installing virtualbox commands:
aptitude update
In order to install Virtualbox 4.3, we run the following command:
aptitude install virtualbox-4.3
In order to install Virtualbox 5, we run the following commands:
aptitude install virtualbox-5.0
or:
aptitude install virtualbox-5.1
In order for us to have access to RDP through the web interface and USB2 for a virtual machine, you need to download and install an additional virtualbox package.
But before you install the add-on package, you need to find out the version of the installed virtualbox command:
vboxwebsrv -V Oracle VM VirtualBox web service Version 4.3.40 (C) 2007-2016 Oracle Corporation All rights reserved. 4.3.40r110317
or:
vboxwebsrv -V Oracle VM VirtualBox web service Version 5.0.10 (C) 2007-2015 Oracle Corporation All rights reserved. 5.0.14r105127
or:
vboxwebsrv -V Oracle VM VirtualBox web service Version 5.1.24 (C) 2007-2017 Oracle Corporation All rights reserved. 5.1.24r117012
So we've got a version. 4.3.34 Or 5.0.14, so we're going to the page. http://download.virtualbox.org/virtualbox/ And we open the directory. 4.3.34or 5.0.14 and at the very top we see Oracle_VM_VirtualBox_Extension_Pack-4.3.34.vbox-extpack fileWe need to download it and install it.
To do this, download an additional package with the team:
wget http://download.virtualbox.org/virtualbox/4.3.40/Oracle_VM_VirtualBox_Extension_Pack-4.3.40-110317a.vbox-extpack
For version 5.0:
wget http://download.virtualbox.org/virtualbox/5.0.14/Oracle_VM_VirtualBox_Extension_Pack-5.0.14.vbox-extpack
For version 5.1:
wget http://download.virtualbox.org/virtualbox/5.1.24/Oracle_VM_VirtualBox_Extension_Pack-5.1.24-117012.vbox-extpack
And install the downloaded package for rdp and usb2 by the command:
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-*.vbox-extpack
System response to package installation:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Successfully installed "Oracle VM VirtualBox Extension Pack".
After installation, the service must be restarted. vboxweb-service by teams:
/etc/init.d/vboxweb-service stop sleep 7 /etc/init.d/vboxweb-service start
For Virtualbox to work, you need to create a user under which virtual machines will work.
Adding a user vbox to the system by command:
adduser vbox
Indicate the user password vbox, pre-write it in your notebook for passwords.
Installation of phpvirtualbox
In order for phpvirtualbox to work through the web interface, you need to add a domain. vm.server.loc as in the instructions Installation of Roundcube email client in Debian - Part 5 Without a database, we create an FTP account through which we upload phpvirtualbox files.
Next, we download through the browser phpvirtualbox (Preliminary confirmation of the pageThis is the latest version, or a team in the console on the server itself:
Phpvirtualbox for Virtualbox 4.3
wget -c -t0 http://kent.dl.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.3-3.zip
Phpvirtualbox for Virtualbox 5.0
wget -c -t0 http://netcologne.dl.sourceforge.net/project/phpvirtualbox/phpvirtualbox-5.0-5.zip
Unpacking the contents of the downloaded archive phpvirtualbox folder version you need domain by FTP as in the instructions above Installation of Roundcube email web client, or through the server console, do not forget to change the rights of the web server:
We change the rights to phpvirtualbox files for a web server, as in the instructions above.
We overload the web server with a command:
/etc/init.d/apache2 restart
Next, through the console go to the domain folder /var/www/vm.server.loc team:
cd /var/www/vm.server.loc
Create a configuration file from the default command to the console:
mv config.php-example config.php
If you upload phpvirtualbox files via FTP, simply rename and edit the settings as below in the instructions:
changeable config.php:
/* Username / Password for system user that runs VirtualBox */ var $username = 'vbox'; var $password = 'pass';
wherein pass Your password entered when creating a user vbox
Modify further:
was:
/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */ var $location = 'http://127.0.0.1:18083/';
Attention!! In order for rdp to work through the web interface, it is necessary to specify not 127.0.0.1 but internal or external IP, such as 192.168.0.1 (internal server address).
became:
/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */ var $location = 'http://192.168.0.1:18083/';
was:
// Host / ip to use for console connections #var $consoleHost = '192.168.1.40';
became:
// Host / ip to use for console connections var $consoleHost = '192.168.0.1';
Create a file that answers which IP and port will work on virtualbox
echo ' VBOXWEB_USER=vbox VBOXWEB_HOST=192.168.0.1 VBOXWEB_PORT=18083 ' > /etc/default/virtualbox
Attention!! IP 127.0.0.1 can be specified, but in order for rdp to work through a web interface, it is necessary to specify not 127.0.0.1 but internal or external IP, such as 192.168.0.1 (internal server address)
Reboot virtualbox with the command:
/etc/init.d/vboxweb-service restart
We open the address of our server in the browser:
http://192.168.0.1/
inject
login: admin
Password: admin
The web interface will open in English, which can be changed in the settings into Russian, by the way, I strongly recommend changing the user's password, but it is better to create an administrator with a not typical name and a complex password, and the current one should be deleted, then if you have an interface looking at the Internet (which is not recommended for security), the password and login will be much more difficult (almost impossible) to pick up.
The interface of the web interface is almost no different from the desktop version of Virtualbox.
We create a virtual machine with the help of the wizard by clicking on the button to create, and connecting the image of the desired disk and selecting an image in the dashboard, we install the operating system.
Auto-start virtual machines when the server is turned on, save the current state of the guest machine (not turn off) when the physical server is turned off with the restoration of the current state when the server is turned on.
Auto-Start Virtualbox Guest Machine:
Create a script that will start and save guest machines when the server is turned on or off:
vi /etc/init.d/virtualbox
#!/bin/bash
### BEGIN INIT INFO
# Provides: myscript
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 1 0 6
# Short-Description: simple description.
### END INIT INFO
START="/bin/bash"
#if [ ! -f /etc/rc.vm ]; then
# echo "/etc/rc.vm does not exist"
# exit 0
#fi
VBOXDIR="/etc/vbox"
VM_USER="vbox"
SU="su - $VM_USER -c"
VBOXMANAGE="VBoxManage -nologo"
VM="Gateway"
case "$1" in
start)
echo -n "Starting up virtual maschine $VM"
sleep 15 && $SU "VBoxHeadless --startvm $VM > /dev/null 2>&1 &"
echo "done."
;;
restart)
$SU "VBoxManage controlvm $VM reset"
;;
stop)
$SU "VBoxManage controlvm $VM savestate"
;;
stopacpi)
$SU "VBoxManage controlvm $VM acpipowerbutton"
exit 0
;;
*)
echo "Usage: $N {start|restart|stop}" >&2
exit 1
;;
esac
exit 0
In this file, only the variable needs to be changed. VMIn it you need to specify the name of your virtual machine, which is displayed in the web interface. phpvirtualbox.
Make the file executable and add it to the autoload commands:
chmod +x /etc/init.d/virtualbox update-rc.d virtualbox defaults
For each guest machine, you need to make your own file that starts and saves the virtual machine when the server is turned on and off.
Mistakes!!
!!! If you open the web interface with an error:
Error logging in to vboxwebsrv
It is necessary to run the command under the user vbox:
su vbox VBoxManage setproperty websrvauthlibrary null Ctrl+d
Then reboot. virtualbox team:
/etc/init.d/vboxweb-service restart
! Attention. If this error occurs when connecting to RDP:
Disconnect reason: I: MCS: Disconnect Request I: RDPCLIENT: The server has dropped connection.
We need to go in. Properties of a virtual machine - Display. - Remote display - Additional opportunities - check the box Allow multiple connections
If you choose to use a physical CD/DVD drive instead of an installation disk image in a virtual machine and the PHPVirtualbox web interface gives you an error:
Cannot open host device '/dev/sr0' for readonly access. Check the permissions of that device ('/bin/ls -l /dev/sr0'): Most probably you need to be member of the device group. Make sure that you logout/login after changing the group settings of the current user (VERR_ACCESS_DENIED)
This means that the user under which we run the virtual machine, in our case, is the vbox There is no right to use a physical CD/DVD drive.
To treat this error, it is enough to add a user vbox group cdrom team:
usermod -G cdrom -a vbox
Task accomplished. Virtualbox installed on the server with Debian GNU / Linux, installed and configured web interface PHPVirtualbox, set up autorun virtual machines.
I was with you. Sergey Lazarenko.
After productive work, you can distract yourself and watch a video about Work with VMware vSphere:





comment