Thursday, September 19, 2013

phpVirtualBox on openSUSE reloaded

phpVirtualBox home page has been moved from google to sourceforge it is in  You will need to install VirtualBox since it is just a front end.  before you can use this app. Refer to my guide on how you can install vbox.  After you have installed vbox you will install a web server. We will use apache2 as an example. You can either use yast2 software management to install the lamp_server pattern and some php packages or use our friend zypper.

  In this setup i choose to install to a different directory than /srv/www/htdocs. So just in case something unrecoverable happens :P in my system i will not delete the directory where phpvirtuablox resides. Here i choose /data/apache2. You can put it any where you like just replace the config entry in apache2.

    To install the packages using zypper
      •     zypper in patterns-openSUSE-lamp_server php5-soap      

         Create an entry for apache2
          •     vi /etc/apache2/conf.d/phpvirtualbox.conf   

          The only thing you need to replace to meet your setup is    /data/apache2  the rest is as-is.

            Alias /phpvirtualbox  /data/apache2/phpvirtualbox

            <Directory   /data/apache2/phpvirtualbox>
               Options Indexes MultiViews FollowSymLinks
               AllowOverride All
               Order allow,deny
               Allow from all

             Unpack that zip file using unzip into /data/apache2.
              •   unzip phpvirtualbox-"$version".zip -d /data/apache2/ && cd /data/apache2 
                Rename that file to just phpvirtualbox
                  •   mv -v phpvirtualbox-"$version" phpvirtualbox && cd phpvirtualbox 

                    Now rename the php file
                      •  mv config.php-example config.php 

                        Edit that config.php file and put the name of the user which uses virtualbox and the corresponding line and do it like this.
                            var $username = 'jetchisel';                                  
                            var $password = 'mypassword';

                          •   var $ location = '';  

                          •  var $consoleHost = 'IP ADDRESS OF YOUR COMPUTER'; 

                          Create an file called virtualbox in /etc/default and put something like this.


                          Set permissions as root run the following commands.

                            •   chgrp -Rv vboxusers /data/apache2/phpvirtualbox  
                            •   chmod -Rv 775 /data/apache2/phpvirtualbox   

                               Edit that config.php file, un comment out the following.

                                  var $startStopConfig = true;
                                  var $enableAdvancedConfig = true;

                                For the deprecated system V.
                                   Download the vboxinit for SuSE.
                                    •  wget -O vboxinit 
                                      copy the script to /etc/init.d
                                        •  cp -v vboxinit /etc/init.d/vboxinit 
                                          set permission.
                                            •  chmod u+rx /etc/init.d/vboxinit  
                                              Enable init script.
                                                •  chkconfig vboxinit on  
                                                     Check the script if it is working
                                                          •  /etc/init.d/vboxinit {start|stop|restart|status} 

                                                          Enable the init scripts at boot time.

                                                              •   chkconfig vboxweb-service on 

                                                              Restart the init scripts as root run the following.
                                                              •  service vboxautostart-service restart 
                                                              •  service vboxweb-service restart 

                                                              For SYSTEMD

                                                               Download the systemd version  for SuSE.
                                                              •  wget 
                                                              You can save it to any place you want even in /home/user/bin. In this example i choose to put in  to /usr/lib/systemd/
                                                              •  cp -v systemd-vboxinit /usr/lib/systemd 
                                                              Set permissions
                                                              •  chmod ug+x /usr/lib/systemd/systemd-vboxinit 
                                                              •  chgrp vboxusers /usr/lib/systemd/systemd-vboxinit

                                                              Create a systemd unit  "vboxvmservice.service" (or any name that suits you)
                                                              inside /usr/lib/systemd/system and add the entry below: Replace " username " with the user that belongs to the vboxusers group.


                                                                     Description=VBox Virtual Machine  Service


                                                                     ExecStart=/usr/lib/systemd/systemd-vboxinit start
                                                                     ExecStop=/usr/lib/systemd/systemd-vboxinit stop



                                                              If you choose to save the systemd-vboxinit script in another path and not /usr/lib/systemd then you need to adjust the following entry.

                                                              •  ExecStart=/path/to/file/systemd-vboxinit start
                                                              •  ExecStop=/paht/to/file/systemd-vboxinit stop 

                                                              Start that newly created unit.
                                                              •   systemctl start vboxvmservice.service 
                                                              Enable the service at boot time.
                                                              •  systemctl enable vboxvmservice.service 

                                                              Enable the init scripts;

                                                                •  systemctl enable vboxweb-service.service 

                                                                Start and enable apache2.
                                                                •   systemctl start apache2.service 
                                                                •  systemctl enable apache2.service 

                                                                In your browser type the url below:
                                                                •   localhost/phpvirtualbox  

                                                                First log in:
                                                                •  username: admin 
                                                                •  password: admin  

                                                                After a log in you can add a user that can handle your vms.

                                                                Configure vms in phpvirtualbox's graphical menu.
                                                                •  Settings --> General --> Basic --> "StartupMode --> Automatic" 

                                                                 An example of running vms at boot.

                                                                Checking the status of your unit after booting.

                                                                Zip file from github:

                                                                You can search phpvirtualbox for an rpm package of this in OBS.

                                                                Kudos to Mr. Ian Moore the author of phpvirtuabox.


                                                                No comments:

                                                                Post a Comment