Install VirtualBox and phpVirtualBox on CentOS 7 - CentLinux

Latest

Thursday, 18 July 2019

Install VirtualBox and phpVirtualBox on CentOS 7

Install VirtualBox and phpVirtualBox on CentOS 7

VirtualBox is a free and open-source hypervisor, developed by Oracle Corporation. VirtualBox supports all popular operating system platforms. VirtualBox is also used as the Provider for Vagrant, a server orchestration software.

phpVirtualBox is a web interface for administration of VirtualBox servers. phpVirtualBox is a free and open source web application. phpVirtualBox is written in PHP thus requires a Web Server with PHP language support for deployment.

In this article, we are installing VirtualBox and phpVirtualBox on CentOS 7 server.

 

This Article Provides:

     

    Environment Specification:

    We have configured a CentOS 7 virtual machine with following specifications.

    • CPU - 3.4 Ghz (2 cores)
    • Memory - 2 GB
    • Storage - 20 GB
    • Operating System - CentOS 7.6
    • Hostname - virtualbox-01.example.com
    • IP Address - 192.168.116.185/24

     

    Installing VirtualBox on CentOS 7:

    Connect with virtualbox-01.example.com using ssh as root user.

    Install VirtualBox prerequisite packages using yum command.

    [root@virtualbox-01 ~]# yum install -y kernel-devel-$(uname -r) kernel-headers gcc make perl wget ... Installed: gcc.x86_64 0:4.8.5-36.el7_6.2 kernel-devel.x86_64 0:3.10.0-957.el7 kernel-headers.x86_64 0:3.10.0-957.21.3.el7 perl.x86_64 4:5.16.3-294.el7_6 wget.x86_64 0:1.14-18.el7_6.1 Dependency Installed: cpp.x86_64 0:4.8.5-36.el7_6.2 glibc-devel.x86_64 0:2.17-260.el7_6.6 glibc-headers.x86_64 0:2.17-260.el7_6.6 libmpc.x86_64 0:1.0.1-3.el7 mpfr.x86_64 0:3.1.1-4.el7 perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7 perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-3.el7 perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7 perl-Pod-Escapes.noarch 1:1.04-294.el7_6 perl-Pod-Perldoc.noarch 0:3.20-4.el7 perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-4.el7 perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-294.el7_6 perl-macros.x86_64 4:5.16.3-294.el7_6 perl-parent.noarch 1:0.225-244.el7 perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7 Dependency Updated: glibc.x86_64 0:2.17-260.el7_6.6 glibc-common.x86_64 0:2.17-260.el7_6.6 libgcc.x86_64 0:4.8.5-36.el7_6.2 libgomp.x86_64 0:4.8.5-36.el7_6.2 Complete!

    The vboxdrv.service requires same kernel-devel modules as of running Kernel. Otherwise, after installation vboxdrv.service will throw errors. Therefore, we have used $(uname -r) with above yum command

    VirtualBox is distributed via its own yum repository. Therefore, we have to install VirtualBox yum repository first and then we will be able to install VirtualBox software.

    Download and add VirtualBox yum repository in our CentOS 7 server.

    [root@virtualbox-01 ~]# wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo --2019-07-15 21:24:40-- https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo Resolving download.virtualbox.org (download.virtualbox.org)... 104.103.58.103 Connecting to download.virtualbox.org (download.virtualbox.org)|104.103.58.103|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 259 [text/plain] Saving to: â/etc/yum.repos.d/virtualbox.repoâ 100%[======================================>] 259 --.-K/s in 0.05s 2019-07-15 21:24:42 (4.88 KB/s) - â/etc/yum.repos.d/virtualbox.repoâ saved [259/259]

    Build cache for VirtualBox yum repository.

    [root@virtualbox-01 ~]# yum makecache fast Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp3.isra.edu.pk * extras: ftp3.isra.edu.pk * updates: ftp3.isra.edu.pk base | 3.6 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 virtualbox/7/x86_64/signature | 181 B 00:00 Retrieving key from https://www.virtualbox.org/download/oracle_vbox.asc Importing GPG key 0x98AB5139: Userid : "Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>" Fingerprint: 7b0f ab3a 13b9 0743 5925 d9c9 5442 2a4b 98ab 5139 From : https://www.virtualbox.org/download/oracle_vbox.asc Is this ok [y/N]: y virtualbox/7/x86_64/signature | 2.9 kB 00:05 !!! virtualbox/7/x86_64/primary_db | 130 kB 00:01 Metadata Cache Created

    Now we can install VirtualBox using yum command.

    [root@virtualbox-01 ~]# yum install -y VirtualBox-6.0.x86_64 ... Installed: VirtualBox-6.0.x86_64 0:6.0.8_130520_el7-1 Dependency Installed: SDL.x86_64 0:1.2.15-14.el7 dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7 fontconfig.x86_64 0:2.13.0-4.3.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 libICE.x86_64 0:1.0.9-9.el7 libSM.x86_64 0:1.2.2-2.el7 libX11.x86_64 0:1.6.5-2.el7 libX11-common.noarch 0:1.6.5-2.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXcursor.x86_64 0:1.1.15-1.el7 libXdamage.x86_64 0:1.1.4-4.1.el7 libXext.x86_64 0:1.3.3-3.el7 libXfixes.x86_64 0:5.0.3-1.el7 libXmu.x86_64 0:1.1.2-2.el7 libXrender.x86_64 0:0.9.10-1.el7 libXt.x86_64 0:1.1.5-3.el7 libXxf86vm.x86_64 0:1.1.4-1.el7 libglvnd.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libglvnd-glx.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libvpx.x86_64 0:1.3.0-5.el7_0 libxcb.x86_64 0:1.13-1.el7 libxshmfence.x86_64 0:1.2-1.el7 mesa-libGL.x86_64 0:18.0.5-4.el7_6 mesa-libglapi.x86_64 0:18.0.5-4.el7_6 opus.x86_64 0:1.0.2-6.el7 Complete!

    vboxdrv.service is automatically enabled and started by VirtualBox installation process.

    Check status of vboxdrv.service.

    [root@virtualbox-01 ~]# systemctl status vboxdrv.service â vboxdrv.service - VirtualBox Linux kernel module Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: disabled) Active: active (exited) since Mon 2019-07-15 21:38:55 PKT; 53s ago Process: 33168 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, status=0/SUCCESS) Jul 15 21:38:55 virtualbox-01.example.com systemd[1]: Starting VirtualBox Lin... Jul 15 21:38:55 virtualbox-01.example.com vboxdrv.sh[33168]: vboxdrv.sh: Star... Jul 15 21:38:55 virtualbox-01.example.com systemd[1]: Started VirtualBox Linu... Hint: Some lines were ellipsized, use -l to show in full.

    VirtualBox 6.0 has been installed on our CentOS 7 server.

     

    Installing VirtualBox Extension Pack on CentOS 7:

    VirtualBox is splitted into two components.

    • Base Package
    • Extension Packs

    We have already installed VirtualBox Base Package above. Now, we are installing VirtualBox Extension Pack to extend the functionality of VirtualBox software.

    VirtualBox Extension Pack is available at VirtualBox Official Download Page. It consist of a single universal package that supports all platforms.

    We are downloading it using wget command.

    [root@virtualbox-01 ~]# cd /tmp [root@virtualbox-01 tmp]# wget https://download.virtualbox.org/virtualbox/6.0.8/Oracle_VM_VirtualBox_Extension_Pack-6.0.8.vbox-extpack --2019-07-15 21:43:24-- https://download.virtualbox.org/virtualbox/6.0.8/Oracle_VM_VirtualBox_Extension_Pack-6.0.8.vbox-extpack Resolving download.virtualbox.org (download.virtualbox.org)... 104.69.150.156 Connecting to download.virtualbox.org (download.virtualbox.org)|104.69.150.156|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 23309069 (22M) [text/plain] Saving to: âOracle_VM_VirtualBox_Extension_Pack-6.0.8.vbox-extpackâ 100%[======================================>] 23,309,069 459KB/s in 65s 2019-07-15 21:44:29 (352 KB/s) - âOracle_VM_VirtualBox_Extension_Pack-6.0.8.vbox-extpackâ saved [23309069/23309069]

    Install VirtualBox Extension Pack using VBoxManage command.

    [root@virtualbox-01 tmp]# VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.0.8.vbox-extpack VirtualBox Extension Pack Personal Use and Evaluation License (PUEL) License version 10, 20 July 2017 PLEASE READ THE FOLLOWING ORACLE VM VIRTUALBOX EXTENSION PACK PERSONAL USE AND EVALUATION LICENSE CAREFULLY BEFORE DOWNLOADING OR USING THE ORACLE SOFTWARE. THESE TERMS AND CONDITIONS CONSTITUTE A LEGAL AGREEMENT BETWEEN YOU AND ORACLE. ORACLE AMERICA, INC. ("ORACLE") IS WILLING TO LICENSE THE PRODUCT DEFINED IN SECTION 1 BELOW ONLY ON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS VIRTUALBOX EXTENSION PACK PERSONAL USE AND EVALUATION LICENSE AGREEMENT ("AGREEMENT"). IF YOU ARE AGREEING TO THIS LICENSE ON BEHALF OF AN ENTITY (RATHER THAN AS AN INDIVIDUAL HUMAN BEING), YOU REPRESENT THAT YOU HAVE THE APPROPRIATE AUTHORITY TO ACCEPT THESE TERMS AND CONDITIONS ON BEHALF OF SUCH ENTITY. 1 SUBJECT OF AGREEMENT. This Agreement governs your use of the binary software package called "Oracle VM VirtualBox Extension Pack" (the "Product"), which contains a set of additional features for "Oracle VM VirtualBox" that enhance the operation of multiple virtual machines ("Guest Computers") on a single physical computer ("Host Computer"). The Product consists of executable files in machine code, script files, data files, and all documentation and updates provided to You by Oracle. 2 GRANT OF LICENSE. Oracle grants you a personal, non-exclusive, non-transferable, limited license without fees to reproduce, install, execute, and use internally the Product on Host Computers for your Personal Use, Educational Use, or Evaluation. "Personal Use" is noncommercial use solely by the person downloading the Product from Oracle on a single Host Computer, provided that no more than one client or remote computer is connected to that Host Computer and that client or remote computer is used solely to remotely view the Guest Computer(s). "Educational Use" is any use by teachers or students in an academic institution (schools, colleges and universities) as part of the institution's educational curriculum. "Evaluation" means testing the Product for up to thirty (30) days; after expiry of that term, you are no longer permitted to use the Product. Personal Use and/or Educational Use expressly exclude any use of the Product for commercial purposes or to operate, run, or act on behalf of or for the benefit of a business, organization, governmental organization, or educational institution. Oracle reserves all rights not expressly granted in this license. 3 RESTRICTIONS AND RESERVATION OF RIGHTS. (1) The Product and copies thereof provided to you under this Agreement are copyrighted and licensed, not sold, to you by Oracle. (2) You may not do any of the following: (a) modify any part of the Product, except to the extent allowed in the documentation accompanying the Product; (b) rent, lease, lend, re-distribute, or encumber the Product; (c) remove or alter any proprietary legends or notices contained in the Product; or (d) decompile, or reverse engineer the Product (except to the extent permitted by applicable law). (3) The Product is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility and Oracle and its licensors disclaim any express or implied warranty of fitness for such uses. (4) No right, title or interest in or to any trademark, service mark, logo or trade name of Oracle or its licensors is granted under this Agreement. 4 TERMINATION. The Agreement is effective on the date you receive the Product and remains effective until terminated. Your rights under this Agreement will terminate immediately without notice from Oracle if you materially breach it or take any action in derogation of Oracle's and/or its licensors' rights to the Product. Oracle may terminate this Agreement immediately should any part of the Product become or in Oracle's reasonable opinion likely to become the subject of a claim of intellectual property infringement or trade secret misappropriation. Upon termination, you will cease use of and destroy all copies of the Product under your control and confirm compliance in writing to Oracle. Sections 3-9, inclusive, will survive termination of the Agreement. 5 DISCLAIMER OF WARRANTY. TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, ORACLE PROVIDES THE PRODUCT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT LIMITING THE FOREGOING, ORACLE SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT. The entire risk as to the quality and performance of the Product is with you. Should it prove defective, you assume the cost of all necessary servicing, repair, or correction. 6 LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL ORACLE OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT, DATA, OR DATA USE, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE THE PRODUCT, EVEN IF ORACLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event will Oracle's liability to you, whether in contract, tort (including negligence), or otherwise, exceed the amount paid by you for the Product under this Agreement. 7 SEPARATELY LICENSED THIRD PARTY TECHNOLOGY. The Product may contain or require the use of third party technology that is provided with the Product. Oracle may provide certain notices to you in the Product's documentation, readmes or notice files in connection with such third party technology. Third party technology will be licensed to you either under the terms of this Agreement or, if specified in the documentation, readmes or notice files, under Separate Terms. Your rights to use Separately Licensed Third Party Technology under Separate Terms are not restricted in any way by this Agreement. However, for clarity, notwithstanding the existence of a notice, third party technology that is not Separately Licensed Third Party Technology shall be deemed part of the Product and is licensed to You under the terms of this Agreement. "Separate Terms" refers to separate license terms that are specified in the Product's documentation, readmes or notice files and that apply to Separately Licensed Third Party Technology. "Separately Licensed Third Party Technology" refers to third party technology that is licensed under Separate Terms and not under the terms of this Agreement. 8 EXPORT. Export laws and regulations of the United States and any other relevant local export laws and regulations apply to the Product. You agree that such export laws govern your use of the Product (including technical data) provided under this Agreement, and you agree to comply with all such export laws and regulations (including "deemed export" and "deemed re-export" regulations). You agree that no data, information, and/or Product (or direct product thereof) will be exported, directly or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation, or development of missile technology. 9 U.S. GOVERNMENT END USERS. Oracle programs, including the Product, any operating system, integrated software, any programs installed on hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government. 10 MISCELLANEOUS. This Agreement is the entire agreement between you and Oracle relating to its subject matter. It supersedes all prior or contemporaneous oral or written communications, proposals, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication between the parties relating to its subject matter during the term of this Agreement. No modification of this Agreement will be binding, unless in writing and signed by an authorized representative of each party. If any provision of this Agreement is held to be unenforceable, this Agreement will remain in effect with the provision omitted, unless omission would frustrate the intent of the parties, in which case this Agreement will immediately terminate. This Agreement is governed by the laws of the State of California, USA, and you and Oracle agree to submit to the exclusive jurisdiction of, and venue in, the courts of San Francisco or Santa Clara counties in California in any dispute arising out of or relating to this Agreement. Do you agree to these license terms and conditions (y/n)? y License accepted. For batch installation add --accept-license=56be48f923303c8cababb0bb4c478284b688ed23f16d775d729b89a2e8e5f9eb to the VBoxManage command line. 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Successfully installed "Oracle VM VirtualBox Extension Pack".

    VirtualBox Extension Pack have been successfully installed on CentOS 7 server.

     

    Configure vboxweb-service on CentOS 7:

    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.

    [root@virtualbox-01 tmp]# useradd vbox [root@virtualbox-01 tmp]# 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.

    [root@virtualbox-01 tmp]# echo "VBOXWEB_USER=vbox" > /etc/default/virtualbox [root@virtualbox-01 tmp]# echo "VBOXWEB_HOST=localhost" >> /etc/default/virtualbox

    Restart vboxweb-service.

    [root@virtualbox-01 tmp]# systemctl restart vboxweb-service.service

    Allow vboxweb-service port in Linux firewall.

    [root@virtualbox-01 tmp]# firewall-cmd --permanent --add-port=18083/tcp success [root@virtualbox-01 tmp]# firewall-cmd --reload success

     

    Installing 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.

    [root@virtualbox-01 ~]# yum install -y httpd php php-soap php-xml Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp3.isra.edu.pk * extras: ftp3.isra.edu.pk * updates: ftp3.isra.edu.pk Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-89.el7.centos will be installed --> Processing Dependency: httpd-tools = 2.4.6-89.el7.centos for package: httpd-2.4.6-89.el7.centos.x86_64 --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-89.el7.centos.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-89.el7.centos.x86_64 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-89.el7.centos.x86_64 ---> Package php.x86_64 0:5.4.16-46.el7 will be installed --> Processing Dependency: php-common(x86-64) = 5.4.16-46.el7 for package: php-5.4.16-46.el7.x86_64 --> Processing Dependency: php-cli(x86-64) = 5.4.16-46.el7 for package: php-5.4.16-46.el7.x86_64 ---> Package php-soap.x86_64 0:5.4.16-46.el7 will be installed ---> Package php-xml.x86_64 0:5.4.16-46.el7 will be installed --> Running transaction check ---> Package apr.x86_64 0:1.4.8-3.el7_4.1 will be installed ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed ---> Package httpd-tools.x86_64 0:2.4.6-89.el7.centos will be installed ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed ---> Package php-cli.x86_64 0:5.4.16-46.el7 will be installed ---> Package php-common.x86_64 0:5.4.16-46.el7 will be installed --> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-46.el7.x86_64 --> Running transaction check ---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: httpd x86_64 2.4.6-89.el7.centos updates 2.7 M php x86_64 5.4.16-46.el7 base 1.4 M php-soap x86_64 5.4.16-46.el7 base 159 k php-xml x86_64 5.4.16-46.el7 base 126 k Installing for dependencies: apr x86_64 1.4.8-3.el7_4.1 base 103 k apr-util x86_64 1.5.2-6.el7 base 92 k httpd-tools x86_64 2.4.6-89.el7.centos updates 90 k libzip x86_64 0.10.1-8.el7 base 48 k mailcap noarch 2.1.41-2.el7 base 31 k php-cli x86_64 5.4.16-46.el7 base 2.7 M php-common x86_64 5.4.16-46.el7 base 565 k Transaction Summary ================================================================================ Install 4 Packages (+7 Dependent packages) Total download size: 8.0 M Installed size: 28 M Downloading packages: (1/11): apr-1.4.8-3.el7_4.1.x86_64.rpm | 103 kB 00:01 (2/11): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00 (3/11): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:03 (4/11): libzip-0.10.1-8.el7.x86_64.rpm | 48 kB 00:06 (5/11): httpd-tools-2.4.6-89.el7.centos.x86_64.rpm | 90 kB 00:07 (6/11): php-soap-5.4.16-46.el7.x86_64.rpm | 159 kB 00:04 (7/11): php-xml-5.4.16-46.el7.x86_64.rpm | 126 kB 00:04 (8/11): php-5.4.16-46.el7.x86_64.rpm | 1.4 MB 00:16 (9/11): php-cli-5.4.16-46.el7.x86_64.rpm | 2.7 MB 00:17 (10/11): php-common-5.4.16-46.el7.x86_64.rpm | 565 kB 00:17 (11/11): httpd-2.4.6-89.el7.centos.x86_64.rpm | 2.7 MB 00:24 -------------------------------------------------------------------------------- Total 335 kB/s | 8.0 MB 00:24 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : apr-1.4.8-3.el7_4.1.x86_64 1/11 Installing : apr-util-1.5.2-6.el7.x86_64 2/11 Installing : httpd-tools-2.4.6-89.el7.centos.x86_64 3/11 Installing : libzip-0.10.1-8.el7.x86_64 4/11 Installing : php-common-5.4.16-46.el7.x86_64 5/11 Installing : php-cli-5.4.16-46.el7.x86_64 6/11 Installing : mailcap-2.1.41-2.el7.noarch 7/11 Installing : httpd-2.4.6-89.el7.centos.x86_64 8/11 Installing : php-5.4.16-46.el7.x86_64 9/11 Installing : php-soap-5.4.16-46.el7.x86_64 10/11 Installing : php-xml-5.4.16-46.el7.x86_64 11/11 Verifying : httpd-tools-2.4.6-89.el7.centos.x86_64 1/11 Verifying : php-soap-5.4.16-46.el7.x86_64 2/11 Verifying : mailcap-2.1.41-2.el7.noarch 3/11 Verifying : apr-util-1.5.2-6.el7.x86_64 4/11 Verifying : php-cli-5.4.16-46.el7.x86_64 5/11 Verifying : libzip-0.10.1-8.el7.x86_64 6/11 Verifying : httpd-2.4.6-89.el7.centos.x86_64 7/11 Verifying : php-5.4.16-46.el7.x86_64 8/11 Verifying : php-common-5.4.16-46.el7.x86_64 9/11 Verifying : apr-1.4.8-3.el7_4.1.x86_64 10/11 Verifying : php-xml-5.4.16-46.el7.x86_64 11/11 Installed: httpd.x86_64 0:2.4.6-89.el7.centos php.x86_64 0:5.4.16-46.el7 php-soap.x86_64 0:5.4.16-46.el7 php-xml.x86_64 0:5.4.16-46.el7 Dependency Installed: apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-89.el7.centos libzip.x86_64 0:0.10.1-8.el7 mailcap.noarch 0:2.1.41-2.el7 php-cli.x86_64 0:5.4.16-46.el7 php-common.x86_64 0:5.4.16-46.el7 Complete!

    Enable and start Apache service.

    [root@virtualbox-01 ~]# systemctl enable httpd.service Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [root@virtualbox-01 ~]# systemctl start httpd.service

    Allow HTTP service in Linux firewall.

    [root@virtualbox-01 ~]# firewall-cmd --permanent --add-service=http success [root@virtualbox-01 ~]# firewall-cmd --reload success

    phpVirtualBox is free and open source web interface for VirtualBox. phpVirtualBox is available at Github.

    [root@virtualbox-01 ~]# cd /tmp [root@virtualbox-01 tmp]# wget https://github.com/phpvirtualbox/phpvirtualbox/archive/master.zip --2019-07-16 21:21:14-- https://github.com/phpvirtualbox/phpvirtualbox/archive/master.zip Resolving github.com (github.com)... 192.30.253.112 Connecting to github.com (github.com)|192.30.253.112|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://codeload.github.com/phpvirtualbox/phpvirtualbox/zip/master [following] --2019-07-16 21:21:18-- https://codeload.github.com/phpvirtualbox/phpvirtualbox/zip/master Resolving codeload.github.com (codeload.github.com)... 192.30.253.120 Connecting to codeload.github.com (codeload.github.com)|192.30.253.120|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/zip] Saving to: âmaster.zipâ [ <=> ] 4,247,924 175KB/s in 40s 2019-07-16 21:21:59 (103 KB/s) - âmaster.zipâ saved [4247924]

    Extract master.zip file to Apache document root.

    [root@virtualbox-01 tmp]# unzip master.zip -d /var/www/html/ ... inflating: /var/www/html/phpvirtualbox-master/panes/wizardNewHD.html inflating: /var/www/html/phpvirtualbox-master/panes/wizardNewHDAdvanced.html inflating: /var/www/html/phpvirtualbox-master/panes/wizardNewVM.html inflating: /var/www/html/phpvirtualbox-master/panes/wizardNewVMAdvanced.html inflating: /var/www/html/phpvirtualbox-master/phpvirtualbox.conf creating: /var/www/html/phpvirtualbox-master/rdpweb/ inflating: /var/www/html/phpvirtualbox-master/rdpweb/RDPClientUI.swf inflating: /var/www/html/phpvirtualbox-master/rdpweb/license_3rd.txt inflating: /var/www/html/phpvirtualbox-master/rdpweb/swfobject.js inflating: /var/www/html/phpvirtualbox-master/rdpweb/webclient.js inflating: /var/www/html/phpvirtualbox-master/rdpweb/webclient3.html inflating: /var/www/html/phpvirtualbox-master/recovery.php-disabled creating: /var/www/html/phpvirtualbox-master/tightvnc/ inflating: /var/www/html/phpvirtualbox-master/tightvnc/VncViewer.jar inflating: /var/www/html/phpvirtualbox-master/vboxinit

    Rename /var/www/html/phpvirtualbox-master directory for easy accessibility.

    [root@virtualbox-01 tmp]# mv /var/www/html/phpvirtualbox-master /var/www/html/phpvirtualbox

    Rename phpVirtualBox configuration file as follows.

    [root@virtualbox-01 tmp]# mv /var/www/html/phpvirtualbox/config.php-example /var/www/html/phpvirtualbox/config.php

    Obtain the username and password defined in config.php file.

    [root@virtualbox-01 ~]# 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.

    [root@virtualbox-01 ~]# setsebool -P httpd_can_network_connect on

    Browse URL http://virtualbox-01.example.com/phpvirtualbox/ in a client's browser.

    01-phpvirtualbox-centos-7-login

    Login with phpVirtualBox default username/password (i.e. admin/admin).

    02-phpvirtualbox-centos-7-compatibility-error

    After login phpVirtualBox web interface may display a compatibility warning and advise us to install a latest version of phpVirtualBox.

    Since, we are already installing the latest version of phpVirtualBox therefore, we have no other option to ignore this warning until a new version of phpVirtualBox is available.

    03-phpvirtualbox-centos-7-dashboard

    We are now at the Dashboard of the phpVirtualBox web interface.

    Click on New to create a new virtual machine.

    04-phpvirtualbox-centos-7-create-virtual-machine

    Provide virtual machine name and select operating system thereon and click on Next >>.

    05-phpvirtualbox-centos-7-memory

    Set memory size and click on Next >>.

    06-phpvirtualbox-centos-7-hard-disk

    Select hard disk setting and click on Create.

    07-phpvirtualbox-centos-7-hard-disk-file-type

    Select hard disk file type and click on Next >>.

    08--phpvirtualbox-centos-7-storage

    Select Storage on physical disk and click on Next >>.

    09-phpvirtualbox-centos-7-file-location

    Select file location and size and click on Next >>.

    10-phpvirtualbox-centos-7-dashboard

    Virtual machine has been created successfully.

    One last thing is to change the default password of admin user.

    Click on File > Change Password.

    11-phpvirtualbox-centos-7-change-password

    Set a strong password for admin user.

    We have successfully installed VirtualBox and phpVirtualBox on CentOS 7 server.

    8 comments:

    1. Hello,Thanks for your very practical guidance. i have an issue here, have followed through word by word.
      But unfortunately am getting this error(Failed to start VirtualBox Linux kernel module.)

      Please help.

      ReplyDelete
      Replies
      1. Hi, Please check the status of the VLKM service.
        systemctl status vboxdrv -l

        Delete
    2. Hi Ahmer! Thanks for this guidance, it's excellent! But I have a problem, I get to the page to login, enter admin/admin and I get this error. Could you tell me how can I fix it?
      Error logging in to vboxwebsrv
      Exception Object
      (
      [message:protected] => Error logging in to vboxwebsrv.
      [string:Exception:private] =>
      [code:protected] => 64
      [file:protected] => /var/www/html/phpvirtualbox/endpoints/api.php
      [line:protected] => 134
      [trace:Exception:private] => Array
      (
      )

      [previous:Exception:private] =>
      )

      ReplyDelete
      Replies
      1. Please verify that the username and password in config.php are correct.

        Delete
      2. I didn't find the error, but I installed it again and it works perfect. Thank you very much!!

        Delete
    3. After wrestling with this via several other online tutorials, well, brother, you nailed it. Excellent work!

      ReplyDelete
    4. Very appreciate for this tutorial, it helps me a lot. 👍

      ReplyDelete