Virtualbox - a full-fledged virtualization server, analogue of Vmware Server. Virtualbox is 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.
This instruction is made on numerous requests of users.
To install Virtualbox, use Ubuntu 12.04 Precise
You need to configure a repository from the official Virtualbox website.
Add to source.list a repository for Ubuntu 12.04
vi /etc/apt/sources.list deb http://download.virtualbox.org/virtualbox/debian precise contrib
Or add a repository to the team:
echo 'deb http://download.virtualbox.org/virtualbox/debian precise contrib' >> /etc/apt/sources.list
Add the virtualbox repository public key with the command:
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add -
Update the repository and start installing virtualbox commands:
aptitude update
Update the system to the latest versions by the team:
aptitude dist-upgrade
After the update, restart to boot into the updated kernel with the command:
reboot
Start the installation of Virtualbox 4.2 by agreeing to the requirements of the installer:
aptitude install virtualbox-4.2
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
System response:
Oracle VM VirtualBox web service Version 4.2.4 (C) 2007-2012 Oracle Corporation All rights reserved. 4.2.4r81684
So we've got a version. 4.2.4r81684So we go to the page. http://download.virtualbox.org/virtualbox/ And we open the directory. 4.2.4 And at the top, we see the files.
Oracle_VM_VirtualBox_Extension_Pack-4.2.4-81684.vbox-extpack and Oracle_VM_VirtualBox_Extension_Pack-4.2.4.vbox-extpackThey are identical, but just have a different name, so you can download any, I for convenience below prescribe the file without reference to the name.
To do this, download an additional package with the team:
wget http://download.virtualbox.org/virtualbox/4.2.4/Oracle_VM_VirtualBox_Extension_Pack-4.2.4.vbox-extpack
Install the downloaded package for rdp and usb2 by the command:
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2*.vbox-extpack
After installation, the service must be restarted. vboxweb-service by teams:
/etc/init.d/vboxweb-service stop /etc/init.d/vboxweb-service start
For Virtualbox to work, you need to create a user under which virtual machines will work.
Add the vbox user to the system with a command:
adduser vbox
Specify the user password vbox, pre-write it in your notebook for passwords.
Create a file that answers which IP and port virtualbox will work on
vi /etc/default/virtualbox VBOXWEB_USER=vbox VBOXWEB_HOST=192.168.0.1 VBOXWEB_PORT=18083
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
Installation of phpvirtualbox
In order for phpvirtualbox to work through a web interface, you need to install a PHP-enabled web server.
Install the software by the team:
aptitude install apache2 php5 mc unzip unrar
Next, we download the phpvirtualbox itself (preliminarily verifying the pageThis is the most recent version of the team:
wget http://netcologne.dl.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.2-8.zip
Unpacking the contents of the archive phpvirtualbox-4.2-8.zip folder /var/www/ Remove everything in the program beforehand. mc.
Change the rights to phpvirtualbox files for a web server by the command:
chown -R www-data:www-data /var/www/*
We overload the web server with a command:
/etc/init.d/apache2 restart
Next we go to the folder. /var/www/ team:
cd /var/www/
Create a configuration file from the default command:
mv config.php-example config.php
changeable config.php:
vi 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 to work. rdp through the web interface, you need to specify not 127.0.0.1 but internal or external IP, for example 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';
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
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"
$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, you only need to change the VM variable, it must specify the name of your virtual machine, which is displayed in the phpvirtualbox web interface.
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
You need to run a command under the vbox user:
su vbox VBoxManage setproperty websrvauthlibrary null Ctrl+d
Then reboot the virtualbox with the command:
/etc/init.d/vboxweb-service restart
!!! If this error occurs when connecting to RDP:
Disconnect reason: I: MCS: Disconnect Request I: RDPCLIENT: The server has dropped connection.
It is necessary to: 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 to the cdrom team:
usermod -G cdrom -a vbox
The task is completed, Virtualbox is installed on the server with Ubuntu 12.04 Precise, the PHPVirtualbox web interface is installed and configured, virtual machines autorun is configured.
I was with you. Sergey Lazarenko.
Let’s take a short break from work, look at the physical achievements of a 5-year-old boy:






comment