Phpvirtualbox+virtualbox Full virtualized environment deployment

Source: Internet
Author: User
Tags server port

Recently the company because of the original development environment is older, and the disk is bad, so need to quickly build a set of virtualized environment to meet the testing needs and service migration, so decisively chose the Phpvirtualbox+virtualbox this set of environment, the choice, Because of its lightweight, fast deployment, the main thing is to meet demand. Nonsense is not much to say, directly on the steps.


First of all, what materials are needed! As follows:

[Email protected] ~]# cat/etc/centos-release

CentOS Release 6.5 (Final)

[Email protected] ~]# uname-r

2.6.32-431.29.2.el6.x86_64

[email protected] data]# LL

-rw-r--r--1 root root 10432725 Feb oracle_vm_virtualbox_extension_pack-4.3.8-92456.vbox-extpack

-rw-r--r--1 root root 3475340 Sep 18:17 phpvirtualbox-4.2-8.zip

-rw-r--r--1 root root 91227600 Feb Virtualbox-4.3.8-92456-linux_amd64.run

How to download it is needless to say. To an address:http://dlc.sun.com.edgesuite.net/virtualbox/4.3.8/


Two installation steps

  1. Install dependent packages

    1. [email protected] data]#yum-y Install perl  wget  httpd  php php-mysql php-pear php-soap  apr apr-util-sqlite apr-util-ldap apr-util

    2. [[email protected] data]#  yum-y install kernel-headers kernel-devel

    3. [[email protected] data]# Rpm-qa |grep kernel #这里要特别注意版本要一直, otherwise in the installation of VirtualBox will prompt error, if inconsistent, how to do it, then press D to upgrade kernel

      Kernel-headers-2.6.32-431.29.2.el6.x86_64

      Kernel-devel-2.6.32-431.29.2.el6.x86_64

      Kernel-2.6.32-431.29.2.el6.x86_64

    4. [email protected] data]# Yum upgrade kernel

  2. install dkms ()

    [[email protected" DATA]# RPM -IVH   http://linux.dell.com/dkms/permalink/dkms-2.2.0.3-1.noarch.rpm

  3. Installing Virutalbox

    [Email protected] data]# chmod +x virtualbox-4.3.8-92456-linux_amd64.run && sh virtualbox-4.3.8-92456-linux_ Amd64.run

  4. Test whether the components are loaded correctly and can start successfully

    [[email protected] data]#/etc/init.d/vboxdrv setup #看到4个 "OK" means OK

  5. Adding users and making a brief configuration

    [Email protected] data]# useradd-g vboxusers-d/data/vbox-s/sbin/bash vbox

    [[email protected] data]# passwd VBox #输入密码, the back will be used

    [[email protected] data]# Vim/etc/default/virtualbox #输入以下内容 and save

    Vboxweb_user=vbox

    [Email protected] data]# chkconfig--levels 235 Vboxweb-service on

    [[Email protected] data]# service Vboxweb-service start

    [Email protected] data]# NETSTAT-ANPTL | grep 18083

    TCP 0 0 127.0.0.1:18083 0.0.0.0:* LISTEN 1321/vboxwebsrv

  6. Installing Phpvirtualbox

    [Email protected] data]# cd/var/www/html

    [email protected] data]# wget Http://downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.3-1.zip

    [Email protected] data]# Unzip Phpvirtualbox-4.3-1.zip

    [Email protected] data]# MV Phpvirtualbox-4.3-1 VBox

    [[Email protected] data]# CD VBox; CP config.php-example config.php

    [Email protected] data]# vim config.php

var $username = ' VBox ';

var $password = ' ******* '; #前面设置的密码

var $vrdeports = ' 3389-3489 '; #remote Desktop Server port is plainly the remote access port

var $consoleHost = ' 192.168.0.80 '; #在remote used in Desktop server (important)

7. Install the expansion pack (important, install this to use the above remote access and use Conslor on the Web interface)

[Email protected] data]# vboxmanage extpack Install Oracle_vm_virtualbox_extension_pack-4.3.8-92456.vbox-extpack

8. Start the Web service

[[Email protected] data]# service httpd start && chkconfig httpd on && service vboxweb-service restart


This is basically done! You can access it through Http://192.168.0.80/vbox (user:admin/passwd:admin).

But we can't just end it, we want the virtual function to boot automatically, then we need to do the following:

9. Create a virtual machine (slightly)

Three configuration-related files to make the Autostart feature available

[email protected] data]# Vim/etc/default/virtualbox

Vboxautostart_db=/etc/vbox/autostart

Vboxautostart_config=/etc/vbox/autostart.cfg

[email protected] data]# vim/etc/vbox/autostart.cfg

# Default policy is to deny starting a VM, and the other option is ' allow '.

Default_policy = Deny

# Create an entry for each user allowed to run Autostart

VBox = {

Allow = True

}

[email protected] data]# chgrp vboxusers/etc/vbox && chmod 1775/etc/vbox

[Email protected] data]# vboxmanage setproperty autostartdbpath/etc/vbox #将该目录赋予自启动权限

[email protected] data]# Su-vbox

[Email protected] ~]$ vboxmanage list VMS #查看有哪些虚拟机

"Centos6.5" {67985137-8223-4A95-9760-E5D0381176AD}

[[email protected] ~]$ vboxmanage modifyvm "Centos6.5"--autostart-enabled on #将Centos6.5 set to self-start, need to start first

[[Email protected] data]# service vboxautostart-service Restart #重启服务, let's re-read the /etc/default/virtualbox/*.start file


At this point, congratulations, all done! In this way, you reboot your system, your virtual machine is started with the main machine, very cool, right? Just try it.

Four finally, when you do not know the machine IP, how to log into the machine? There are many ways to achieve this:

Rdesktop 192.168.0.80:3389

Gtkvncviewer

Vncviewer

Such tools can help you, you don't know this, it's okay, just log in to the Web and connect directly from Conslor.


It's all done, haha ...

This article is from the "Linuxblind Open Space" blog, so be sure to keep this source http://linuxblind.blog.51cto.com/7616603/1558687

Phpvirtualbox+virtualbox Full virtualized environment deployment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.