Restore mono apps

This is not perfected…..

rebuild server with the following…

  • update
  • all mount points
  • backup
  • java7
  • apache2 base
  • apache2 ssl
  • apache2 mono
  • rsync -raltWv –progress –exclude /root/logs/srv.rsync.log –log-file=/root/logs/srv.rsync.log /mnt/nfs/fs-01.sdb1/backup/apache-01/srv/ /srv/
  • rsync -raltWv –progress –exclude /root/logs/srv.rsync.log –log-file=/root/logs/srv.rsy nc.log /mnt/nfs/fs-01.sdb1/backup/apache-01/etc/apache2/sites-available/ /etc/apache2/sites-available/
  • enable sites
  • start apache

Dest Machine:

cd /tmp/

rm -rf ./www/

Source Machine:

backup —> scp -r /srv/www/Java.Qbytesworld.com/ davidq@apache-999:/tmp/www/

restore —> rsync -raltWv –progress –exclude=*.rsync.log –log-file=/root/logs/www.rsync.log /mnt/nfs/fs-01.sdb1/backup/apache-01/srv/www/ /tmp/www/

Dest Machine:

/etc/init.d/tomcat7 stop

mv /tmp/www/Java.Qbytesworld.com/ /srv/www/

chown -R apache:apache /srv/www/

/etc/init.d/tomcat7 start

May be needed?

chmod -R 775 /srv/www/

Dynamic mass virtual hosts with mod_rewrite

http://httpd.apache.org/docs/2.2/rewrite/vhosts.html

This document supplements the mod_rewrite reference documentation. It describes how you can use mod_rewrite to create dynamically configured virtual hosts.

mod_rewrite is not the best way to configure virtual hosts. You should first consider the alternatives before resorting to mod_rewrite. See also the "how to avoid mod_rewrite document.
top

Virtual Hosts For Arbitrary Hostnames

Description:

We want to automatically create a virtual host for every hostname which resolves in our domain, without having to create new VirtualHost sections.

In this recipe, we assume that we'll be using the hostname www.SITE.example.com for each user, and serve their content out of /home/SITE/www.

Solution:

RewriteEngine on

RewriteMap lowercase int:tolower

RewriteCond %{lowercase:%{HTTP_HOST}} ^www\.([^.]+)\.example\.com$
RewriteRule ^(.*) /home/%1/www$1

Discussion
You will need to take care of the DNS resolution – Apache does not handle name resolution. You'll need either to create CNAME records for each hostname, or a DNS wildcard record. Creating DNS records is beyond the scope of this document.

The internal tolower RewriteMap directive is used to ensure that the hostnames being used are all lowercase, so that there is no ambiguity in the directory structure which must be created.

Parentheses used in a RewriteCond are captured into the backreferences %1, %2, etc, while parentheses used in RewriteRule are captured into the backreferences $1, $2, etc.

As with many techniques discussed in this document, mod_rewrite really isn't the best way to accomplish this task. You should, instead, consider using mod_vhost_alias instead, as it will much more gracefully handle anything beyond serving static files, such as any dynamic content, and Alias resolution.

top

Dynamic Virtual Hosts Using mod_rewrite

This extract from httpd.conf does the same thing as the first example. The first half is very similar to the corresponding part above, except for some changes, required for backward compatibility and to make the mod_rewrite part work properly; the second half configures mod_rewrite to do the actual work.

Because mod_rewrite runs before other URI translation modules (e.g., mod_alias), mod_rewrite must be told to explicitly ignore any URLs that would have been handled by those modules. And, because these rules would otherwise bypass any ScriptAlias directives, we must have mod_rewrite explicitly enact those mappings.

# get the server name from the Host: header
UseCanonicalName Off

# splittable logs
LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

<Directory /www/hosts>
# ExecCGI is needed here because we can't force
# CGI execution in the way that ScriptAlias does
Options FollowSymLinks ExecCGI
</Directory>

RewriteEngine On

# a ServerName derived from a Host: header may be any case at all
RewriteMap lowercase int:tolower

## deal with normal documents first:
# allow Alias /icons/ to work - repeat for other aliases
RewriteCond %{REQUEST_URI} !^/icons/
# allow CGIs to work
RewriteCond %{REQUEST_URI} !^/cgi-bin/
# do the magic
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1

## and now deal with CGIs - we have to force a handler
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1 [H=cgi-script]

top

Using a Separate Virtual Host Configuration File

This arrangement uses more advanced mod_rewrite features to work out the translation from virtual host to document root, from a separate configuration file. This provides more flexibility, but requires more complicated configuration.

The vhost.map file should look something like this:

customer-1.example.com /www/customers/1
customer-2.example.com /www/customers/2
# ...
customer-N.example.com /www/customers/N

The httpd.conf should contain the following:

RewriteEngine on

RewriteMap lowercase int:tolower

# define the map file
RewriteMap vhost txt:/www/conf/vhost.map

# deal with aliases as above
RewriteCond %{REQUEST_URI} !^/icons/
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
# this does the file-based remap
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/docs/$1

RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/cgi-bin/$1 [H=cgi-script]

Available Languages: en

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.

Tomcat with JMX

You will also need to add two files:

1) /etc/tomcat7inst/jmxremote.password

#monitorRole tomcat
#controlRole tomcat
user password

2) /etc/tomcat7inst/jmxremote.access

#monitorRole readonly
#controlRole readwrite
user readwrite

4)

chmod 600 /etc/tomcat7inst/jmxremote.*

chown tomcat7:tomcat7 /etc/tomcat7inst/jmxremote.*

5) Edit /etc/tomcat7inst/8xx/bin/startup.sh

Add to existing options:

export JAVA_OPTS="-Dcom.qbw.instance=811
-Xms1g -Xmx1g -XX:MaxPermSize=128m
-Djava.rmi.server.hostname=192.168.1.xx
-Dcom.sun.management.jmxremote.port=xxy9
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file=/etc/tomcat7inst/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=/etc/tomcat7inst/jmxremote.access
"

6)

/etc/tomcat7inst/8xx/bin/shutdown.sh

/etc/tomcat7inst/8xx/bin/startup.sh

Tomcat7 multi instance

apt-get install tomcat7

apt-get install tomcat7 tomcat7-docs tomcat7-examples tomcat7-admin tomcat7-user

Created for you:
Creating config file /etc/default/tomcat7 with new version
Adding system user `tomcat7' (UID 107) …
Adding new user `tomcat7' (UID 107) with group `tomcat7' …

apt-get install tomcat7-docs tomcat7-examples tomcat7-admin tomcat7-user

# find / -name "tomcat-users.xml"
There will be 2 tomcat-users.xml
• /etc/tomcat7/tomcat-users.xml is for the site created on port 8080
• /usr/share/tomcat7/skel/conf/tomcat-users.xml is the default used for create instance.

vi /etc/tomcat7/tomcat-users.xml (be sure to change user and password)
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="user" password="password" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>

Restart tomcat:
/etc/init.d/tomcat7 restart

CD to the directory where you want to put the new instance.
mkdir /etc/tomcat7inst
cd /etc/tomcat7inst

tomcat7-instance-create -p 8100 -c 8105 810
You are about to create a Tomcat instance in directory '810'
* New Tomcat instance created in 810
* You might want to edit default configuration in 810/conf
* Run 810/bin/startup.sh to start your Tomcat instance

Modify/verify

/etc/tomcat7inst/810/conf/server.xml
<Server port="8105" shutdown="SHUTDOWN">
<Connector port="8100" protocol="HTTP/1.1"
<Connector port="8109" protocol="AJP/1.3" redirectPort="8443" />

Modify/verify

/etc/tomcat7inst/810/conf/ tomcat-users.xml (same as above).

To get ROOT app
cp -r /var/lib/tomcat7/webapps/ROOT/ /etc/tomcat7inst/810/webapps/
Restart tomcat:

./810/bin/shutdown.sh
./810/bin/startup.sh
/etc/init.d/tomcat7 restart

To get manager sites to work
cp /etc/tomcat7/Catalina/localhost/* /etc/tomcat7inst/810/conf/Catalina/localhost/
Restart tomcat:

./810/bin/shutdown.sh
./810/bin/startup.sh
/etc/init.d/tomcat7 restart


When doing a deploy, be sure to cleanup…
rm -rf /etc/tomcat7inst/810/work/Catalina/
rm –rf /etc/tomcat7inst/810/temp/

=======================================================

Make Tomcat auto-start on boot (optional)

Now you should create an INIT-File that makes it possible to start, stop and restart your Tomcat Server. This file must be located in your “/etc/init.d/” directory. You can use the following command to create a file called “tomcat” and open up that file in an editor (I used nano).

vi /etc/init.d/tomcat8x0 (example here tomcat8x0 (519.00 bytes)). For a better script look at http://wiki.debian.org/LSBInitScripts or and example /etc/init.d/skeleton

Make sure you set the right paths for the startup.sh and shutdown.sh scripts. They reside in the /bin directory of your tomcat path (use the path to which you moved the tomcat files

chmod 755 /etc/init.d/tomcat8x0

update-rc.d tomcat8x0 defaults (you must cd to /etc/init.d/ for this to work)

You can remove the autostart with the following command:

update-rc.d -f tomcat8x0 remove (you must cd to /etc/init.d/ for this to work)


Now the Tomcat Server starts automatically at system bootup.

If you wish to start/stop Tomcat Server manually like this:
sudo /etc/init.d/tomcat8x0 start

sudo /etc/init.d/tomcat8x0 stop

Tomcat7 install

apt-get install tomcat7

apt-get install tomcat7 tomcat7-docs tomcat7-examples tomcat7-admin tomcat7-user

Created for you:
Creating config file /etc/default/tomcat7 with new version
Adding system user `tomcat7' (UID 107) …
Adding new user `tomcat7' (UID 107) with group `tomcat7' …

apt-get install tomcat7-docs tomcat7-examples tomcat7-admin tomcat7-user

# find / -name "tomcat-users.xml"
There will be 2 tomcat-users.xml
• /etc/tomcat7/tomcat-users.xml is for the site created on port 8080
• /usr/share/tomcat7/skel/conf/tomcat-users.xml is the default used for create instance.

vi /etc/tomcat7/tomcat-users.xml
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="user" password="password" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>

Restart tomcat:
/etc/init.d/tomcat7 restart

CD to the directory where you want to put the new instance.
mkdir /etc/tomcat7inst
cd /etc/tomcat7inst

tomcat7-instance-create -p 8100 -c 8105 810
You are about to create a Tomcat instance in directory '810'
* New Tomcat instance created in 810
* You might want to edit default configuration in 810/conf
* Run 810/bin/startup.sh to start your Tomcat instance

Modify/verify

/etc/tomcat7inst/810/conf/server.xml
<Server port="8105" shutdown="SHUTDOWN">
<Connector port="8100" protocol="HTTP/1.1"
<Connector port="8109" protocol="AJP/1.3" redirectPort="8443" />

Modify/verify

/etc/tomcat7inst/810/conf/ tomcat-users.xml (same as above).

To get ROOT app
cp -r /var/lib/tomcat7/webapps/ROOT/ /etc/tomcat7inst/810/webapps/
Restart tomcat:

./810/bin/shutdown.sh
./810/bin/startup.sh
/etc/init.d/tomcat7 restart

To get manager sites to work
cp /etc/tomcat7/Catalina/localhost/* /etc/tomcat7inst/810/conf/Catalina/localhost/
Restart tomcat:

./810/bin/shutdown.sh
./810/bin/startup.sh
/etc/init.d/tomcat7 restart


When doing a deploy, be sure to cleanup…
rm -rf /etc/tomcat7inst/810/work/Catalina/
rm –rf /etc/tomcat7inst/810/temp/

apache2: Could not reliably determine the server’s fully qualified domain

Issue:

# /etc/init.d/apache2 restart
* Restarting web server apache2

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
… waiting ..apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

To fix that problem, you need to edit the httpd.conf file.

  • vi /etc/apache2/httpd.conf

Set content to:

ServerName localhost

  • /etc/init.d/apache2 restart

NFS issues

2013/02/14 19:52:14 [1102] rsync: chown "/mnt/nfs/fs-01.sdb1/backup/database-01/etc/wpa_supplicant/action_wpa.sh" failed: Invalid argument (22)

I have found 2 causes for this:

1)

First check your hostfile.
So my hostfile looked like:

/etc/hosts:
127.0.0.1 localhost.localdomain localhost <real hostname>
::1 localhost.localdomainlocalhost.localdomain localhost6 localhost6.localdomain6 localhost <real hostname>

and the nfs mount mounted as nobody:nobody

but to make it work, your hostfile should look like this:

127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomainlocalhost.localdomain
192.168.x.x <realhost.name.cxm> realhost

this because rpcidmapd is looking at a domain:

rpc.idmapd[23262]: nss_getpwnam: name '<username>@name.cxm' does not map into domain 'localdomain'

once you have your <realhost.name.cxm> assigned to your external ip on your nic (eth0) in the /etc/hostfile, and rpcidmapd reloaded or restarted, things should be running fine….

2)

If the user or group ID is different between the boxes

Box #1

# cat /etc/group | grep apache
apache:x:1001:
# cat /etc/group | grep box
vboxusers:x:1002:

# cat /etc/group | grep apache
apache:x:1001:
# cat /etc/group | grep box
vboxusers:x:1002:

# cat /etc/passwd | grep apache
apache:x:1001:1001::/home/apache:/bin/sh

# cat /etc/passwd | grep box
virtuser:x:1002:1002::/mnt/local/sda1/virtualbox:/bin/sh

Box #2

# cat /etc/group | grep apache
apache:x:1002:
# cat /etc/group | grep box
vboxusers:x:1001:

# cat /etc/passwd | grep apache
apache:x:1002:1002::/home/apache:/bin/sh
# cat /etc/passwd | grep box
virtuser:x:1001:1001::/mnt/local/sda1/virtualbox:/bin/sh

VBoxHeadless – Running Virtual Machines With VirtualBox 4.1 On A Headless Ubuntu 12.04 Server

Reference from here.

VBoxHeadless – Running Virtual Machines With VirtualBox 4.1 On A Headless Ubuntu 12.04 Server

This guide explains how you can run virtual machines with VirtualBox 4.1 on a headless Ubuntu 12.04 server. Normally you use the VirtualBox GUI to manage your virtual machines, but a server does not have a desktop environment. Fortunately, VirtualBox comes with a tool called VBoxHeadless that allows you to connect to the virtual machines over a remote desktop connection, so there's no need for the VirtualBox GUI.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

I have tested this on an Ubuntu 12.04 server (host system) with the IP address 192.168.0.100 where I'm logged in as a normal user (user name virtuser in this example) instead of as root.

2 Installing VirtualBox

To install VirtualBox 4.1 on our Ubuntu 12.04 server, we open /etc/apt/sources.list

sudo vi /etc/apt/sources.list

… and add the following line to it:

																																																									[...]
			deb http://download.virtualbox.org/virtualbox/debian precise contrib
			

Then we download the VirtualBox public key…

wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add –

… and update our package database:

sudo apt-get update

Afterwards, we install VirtualBox 4.2 as follows:

sudo apt-get install linux-headers-$(uname -r) build-essential virtualbox-4.2 dkms

(The dkms package ensures that the VirtualBox host kernel modules are properly updated if the Linux kernel version changes.)

Starting with version 4.0, VirtualBox has introduced so called "extension packs" and has outsourced some functionality like remote desktop connection support (VRDP) that was part of VirtualBox packages before version 4.0 into these extension packs. Because we need remote desktop connections to control our virtual machines, we need to install the appropriate extension pack now. Go to http://www.virtualbox.org/wiki/Downloads, and you will find a link to the following extension pack:

VirtualBox 4.2.6 Oracle VM VirtualBox Extension Pack
Support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards.

Download and install the extension pack as follows:

cd /tmp
wget http://download.virtualbox.org/virtualbox/4.2.6/Oracle_VM_VirtualBox_Extension_Pack-4.2.6-82870.vbox-extpack

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.6-82870.vbox-extpack

(Make sure you grab the latest version from the VirtualBox web site.)

(Make sure you run the last command with sudo – sudo VBoxManage extpack install … – because otherwise you will get an error like this:

administrator@server1:/tmp$ VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.6-82870.vbox-extpack
0%…
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to install "/tmp/Oracle_VM_VirtualBox_Extension_Pack-4.2.6-82870.vbox-extpac": The installer failed with exit code 127: Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address
administrator@server1:/tmp$

)

Now we must add the user that will run VirtualBox (virtuser in this example) to the vboxusers group:

groupadd vboxusers
mkdir -p /mnt/local/sda1/virtualbox
useradd -m -d /mnt/local/sda1/virtualbox virtuser -g vboxusers
passwd virtuser
chown virtuser:vboxusers /mnt/local/sda1/virtualbox

VirtualBox is now installed and ready to be used.

Do we need Guest Additions (Did not need this the first time on fileshares 001 and 999.

sudo apt-get install virtualbox-guest-additions

===================================================================
We won't be doing manual, go to phpvirtualbox (Web Admin)
===================================================================

3 Using VirtualBox On The Command Line

3.1 Creating A VM

To create a VM on the command line, we can use the VBoxManage command. See

VBoxManage –help

for a list of available switches and (highly recommended!) take a look at http://www.virtualbox.org/manual/ch08.html.

I will now create an Ubuntu 12.04 Server VM with 512MB memory and a 10GB hard drive from the Ubuntu 12.04 Server iso image (which I have stored in /home/ubuntu-12.04-server-amd64.iso):

VBoxManage createvm –name "Ubuntu 12.04 Server" –register
VBoxManage modifyvm "Ubuntu 12.04 Server" –memory 512 –acpi on –boot1 dvd –nic1 bridged –bridgeadapter1 eth0
VBoxManage createhd –filename Ubuntu_12_04_Server.vdi –size 10000
VBoxManage storagectl "Ubuntu 12.04 Server" –name "IDE Controller" –add ide
VBoxManage storageattach "Ubuntu 12.04 Server" –storagectl "IDE Controller" –port 0 –device 0 –type hdd –medium Ubuntu_12_04_Server.vdi
VBoxManage storageattach "Ubuntu 12.04 Server" –storagectl "IDE Controller" –port 1 –device 0 –type dvddrive –medium /home/ubuntu-12.04-server-amd64.iso

3.2 Importing An Existing VM

Let's assume you have a VM called examplevm that you want to reuse on this host. On the old host, you should have a directory Machines/examplevm in the VirtualBox directory; Machines/examplevm should contain the examplevm.xml file. Copy the examplevm directory (including the examplevm.xml file) to your new Machines directory (if your user name is administrator, this is /home/administrator/.VirtualBox/Machines – the result should be /home/administrator/.VirtualBox/Machines/examplevm/examplevm.xml).

In addition to that copy the examplevm.vdi file from the old VDI directory to the new one (e.g. /home/administrator/.VirtualBox/VDI/examplevm.vdi).

Afterwards, you must register the imported VM:

VBoxManage registervm Machines/examplevm/examplevm.xml

3.3 Starting A VM With VBoxHeadless

Regardless of if you create a new VM or import an old one, you can start it with the command:

VBoxHeadless –startvm "Ubuntu 12.04 Server"

(Replace Ubuntu 12.04 Server with the name of your VM.)

VBoxHeadless will start the VM and a VRDP (VirtualBox Remote Desktop Protocol) server which allows you to see the VM's output remotely on another machine.

To stop a VM, run

VBoxManage controlvm "Ubuntu 12.04 Server" poweroff

To pause a VM, run

VBoxManage controlvm "Ubuntu 12.04 Server" pause

To reset a VM, run

VBoxManage controlvm "Ubuntu 12.04 Server" reset

To learn more about VBoxHeadless, take a look at

VBoxHeadless –help

and at http://www.virtualbox.org/manual/ch07.html#vboxheadless.

Managing A Headless VirtualBox Installation With phpvirtualbox (Ubuntu 12.04)

Reverence from here.

Managing A Headless VirtualBox Installation With phpvirtualbox (Ubuntu 12.04)

phpvirtualbox is a web-based VirtualBox front-end written in PHP that allows you to access and control remote VirtualBox instances. It tries to resemble the VirtualBox GUI as much as possible to make work with it as easy as possible. It is a nice replacement for the VirtualBox GUI if you run VirtualBox in headless servers (like in the tutorial VBoxHeadless – Running Virtual Machines With VirtualBox 4.1 On A Headless Ubuntu 12.04 Server). This tutorial explains how to install phpvirtualbox on an Ubuntu 12.04 server to manage a locally installed, headless VirtualBox.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

I'm assuming that a headless VirtualBox is already installed on the local Ubuntu 12.04 server, e.g. as described in the tutorial VBoxHeadless – Running Virtual Machines With VirtualBox 4.1 On A Headless Ubuntu 12.04 Server.

I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:

sudo su

2 Installing phpvirtualbox

Created on install side.

groupadd vboxusers
useradd -m -d /mnt/local/sda1/virtualbox virtuser -g vboxusers

First create a system user called virtuser and add it to the vboxusers group:

useradd -m virtuser -G vboxusers

Create a password for the virtuser user:

passwd virtuser

Create the file /etc/default/virtualbox and put the line VBOXWEB_USER=virtuser in it (so that the VirtualBox SOAP API which is called vboxwebsrv runs as the user virtuser ):

vi /etc/default/virtualbox

			VBOXWEB_USER=virtuser
			

Next create the system startup links for vboxwebsrv and start it:

update-rc.d vboxweb-service defaults
/etc/init.d/vboxweb-service start

We need a web server with PHP support to serve phpvirtualbox – I'm using Apache2 here. Install Apache2 and PHP5 as follows:

apt-get install apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apache2 apache2-doc apache2-suexec libapache2-mod-php5 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapr1 php5-common php5-mysql php5-suhosin php-pear wget

Restart Apache2:

/etc/init.d/apache2 restart

I want to serve phpvirtualbox from Apache's default virtual host with the document root /var/www (I will install it in /var/www/phpvirtualbox) – if you have a different document root, you must adjust the following steps:

cd /var/www
wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.2-4.zip

Unzip phpvirtualbox and rename the phpvirtualbox-4.1-7 to phpvirtualbox for ease of use:

unzip phpvirtualbox-4.2-4.zip
mv phpvirtualbox-4.2-4 /var/www/phpvirtualbox/

Next go to the /var/www/phpvirtualbox/ directory…

cd /var/www/phpvirtualbox/

… and create the file config.php by copying it from config.php-example:

cp config.php-example config.php

Open config.php and fill in the password you created earlier for the virtuser system user:

vi config.php

																														[...]
			/* Username / Password for system user that runs VirtualBox */
			var $username = 'virtuser';
			var $password = 'secret';
			[...]
			

That's it already – you can now open a browser and access phpvirtualbox as follows:

http://www.example.com/phpvirtualbox/

http://fileshare-01/phpvirtualbox/

http://fileshare-99/phpvirtualbox/

IF COPING/IMPORTING, NETWORK will not work. 2 options

1. make the MAC address exactly the same as original.

2. Comment out all lines:

vi /etc/udev/rules.d/70-persistent-net.rules

The default username is admin, the password is admin as well:

This is how phpvirtualbox looks – much like the native VirtualBox GUI:

The first thing you should do is change the admin password. Go to File > Change Password:

Type in the old password and specify a new one:

If you know the native VirtualBox GUI, it's now very easy to use phpvirtualbox. For example, if you want to create a new virtual machine, you have the same wizard as you have in the VirtualBox GUI:

(I'm leaving a few sceenshots out so you don't feel bored…)

In the end you have a new VM. Click on the Start button to run that VM:

Even though phpvirtualbox is a web front-end, you still get the VM console that you know from the VirtualBox GUI – pretty cool:

3 Links


Tag Cloud