Tags

, , ,

I do all my development on a Windows 7 computer but the natural environment for WordPress execution is Linux. I would like to use my tools on Windows and then see the running code on a Linux box.

One way of doing this is to use a virtual appliance. This is what we are going to make,

Manageable WordPress Multisite Virtual Appliance

Overview

This virtual appliance is used facilitate development of an application using WordPress. It runs on developer’s laptop and can be managed using common Windows tools.

Key features

  • zero cost
  • Oracle Virtual Box execution environment
  • Bitnami WordPress Multisite Virtual Appliance
  • root access using a password
    • This is development machine and we want to avoid stupid permissions issues
    • A future deliverable might use keys for access
  • Webmin GIU to facilitate easy maintenance

Format and location

  • Developers laptop, Windows 7, 64 bit, 256 GB SSD, 8 GB RAM, Oracle Virtual Box 4, Bitnami MultiSite

Acceptance Criteria

  • Developer can easily manage all aspects of the machine

To create this deliverable,

Create your new machine

  1. Install Oracle Virtual Box
  2. Download Bitnami WordPress MultiPress stack
  3. Create a new Virtual Machine called “Bitnami WordPress Multisite”
  4. Unzip the download using 7-zip or similar
  5. Simply double click the OVF file and follow the prompts to create the new virtual machine. Ensure that you have a “bridged network adaptor”
  6. Run the new virtual machine
  7. When it boots read off the IP number
  8. Go to that IP number in your web browser. You should see the WordPress site! (do not try to login yet). Feel good and close the window.

Set the root password

  1. In the Virtual Box window enable the shared clipboard
    1. Devices > Shared Clipboard > Bidirectional
  2.  In the Virtual Box window  login at the command prompt with the username and password bitnami:bitnami). (note: This will capture the keyboard and mouse. Press the right control key to release)
  3. Change your password when prompted to do so (write it down!)
  4. Change the root password to a known value
    sudo su
    passwd

Get terminal access

  1. Enable and start the ssh server
      1. sudo mv /etc/init/ssh.conf.back /etc/init/ssh.conf
      2. sudo start ssh
  2. Pressing the right control key will release the keyboard and mouse from the Virtual Box window
  3. Now use PuTTY (say) to create a SSH (secure shell) session to the new machine
  4. Use the username and password root:<root password>
  5. You should now use Putty instead of the Virtual Box window for all terminal administration because it is better.

Get file access

  1. Install WinSCP on your Windows computer
  2. Login to to the Virtual Machine using WinSCP and the root password (it should be possible to connect as bitnami and sudo to su but I cannot make it work)
  3. You now have full read/write access to every file on the server

Configure WordPress Multisite

WordPress Multisite uses subdomains to identify each user and it has to know the name of the domain that it is hosted on. By default it using the IP number at boot but we have to change this. I am going to call the machine “wpms.com”

  1. Add domain name to virtual machine
    1. edit etc/hosts,
    2. enter 127.0.0.1 wpms.com
  2. Add the domain name to the Windows computer
    1. edit C:\Windows\System32\drivers\etc\hosts,
    2. enter <ip number of virtual machine> wpms.com
  3. Update the WordPress configurationand rename the boot script that tells WordPress to use IP rather than name,
    sudo /opt/bitnami/apps/wordpress/bnconfig --machine_hostname wpms.com
    sudo mv /opt/bitnami/apps/wordpress/bnconfig /opt/bitnami/apps/wordpress/bnconfig.backup

Improve control by installing Webmin

Webmin will allow us to quickly find out anything we need to know about our Linux system without having to read the manual. We will use the APT mechanism to install it (at the bottom of this page)

  1. Using WinSCP find and edit the /etc/apt/sources.list file on your system and add the lines :
  2. deb http://download.webmin.com/download/repository sarge contrib
    deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
  3. You should also fetch and install the GPG key with which the repository is signed, with the commands :
    cd /root
    wget http://www.webmin.com/jcameron-key.asc
    apt-key add jcameron-key.asc
  4. You will now be able to install with the commands :
    apt-get update
    apt-get install webmin
  5. All dependencies should be resolved automatically, when they are not follow the prompt and type “apt-get -f install” to force all the packages to be downloaded and the webmin install to complete
  6. Open up the firewall port for webmin
    sudo ufw allow 10000
  7. Follow these instructions to update the webmin configuration files for MySQL and Apache
  8. Go to https://wpms.com:10000 and you can login to Webmin as the bitnami user
  9. Browse to the MySQL module and login with root:bitnami, update packages if prompted to do so.
  10. Some Webmin modules such as the file manager use unsigned Java applets. You must add the Webmin URL to the list of allowed security exceptions (https://wpms.com:10000) by changing the Java configuration on your Windows machine.
    windows > start > search > configure java
Advertisements