在CentOS 7配置vboxweb-service:
phpVirtualBox admin communicate to our VirtualBox server using vboxweb-service. Therefore, we have to configure vboxweb-service before installing phpVirtualBox.
Create a user that will run the vboxweb-service process.
# useradd vbox # passwd vbox Changing password for user vbox. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: all authentication tokens updated successfully.
Create a configuration file for vboxweb-service.
# echo "VBOXWEB_USER=vbox" > /etc/default/virtualbox # echo "VBOXWEB_HOST=localhost" >> /etc/default/virtualbox
Restart vboxweb-service.
# systemctl restart vboxweb-service.service
Allow vboxweb-service port in Linux firewall.
# firewall-cmd --permanent --add-port=18083/tcp success # firewall-cmd --reload success
安装phpVirtualBox on CentOS 7:
phpVirtualBox is a PHP based web application. Therefore, it can be deployed on a web server with PHP language support.
We are installing Apache HTTP server and PHP 5.4 along with other required packages using yum command.
# yum install -y httpd php php-soap php-xml
Enable and start Apache service.
# systemctl enable httpd.service Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. # systemctl start httpd.service
Allow HTTP service in Linux firewall.
# firewall-cmd --permanent --add-service=http success # firewall-cmd --reload success
phpVirtualBox is free and open source web interface for VirtualBox. phpVirtualBox is available at Github.
# cd /tmp # wget https://github.com/phpvirtualbox/phpvirtualbox/archive/master.zip
Extract master.zip file to Apache document root.
# unzip master.zip -d /var/www/html/
Rename /var/www/html/phpvirtualbox-master directory for easy accessibility.
# mv /var/www/html/phpvirtualbox-master /var/www/html/phpvirtualbox
Rename phpVirtualBox configuration file as follows.
# mv /var/www/html/phpvirtualbox/config.php-example /var/www/html/phpvirtualbox/config.php
Obtain the username and password defined in config.php file.
# grep -e \$username -e \$password /var/www/html/phpvirtualbox/config.php var $username = 'vbox'; var $password = 'pass';
The above values must match with the OS user vbox, that we have created above.
We have already created the OS user with the same username and password, otherwise you have to edit config.php to match it.
(Note: We are using an easy password for the sake of simplicity, but you are recommended to set a strong password here.)
Set SELinux boolean, so the Apache can access other network services.
# setsebool -P httpd_can_network_connect on
Browse URL http://virtualbox-01.example.com/phpvirtualbox/ in a client's browser.