It has been far too long since I put together a blog post, however that is because I have been spending my nights testing and perfecting the migration of my own blog, as well as other sites, to a vCloud Express provider. I have moved three times this year alone from GoDaddy to BlueHost and finally to Virtacore. Basically on any shared hosting I saw performance issues regardless of the caching plugins I tried. Eventually I decided to go with my own virtual server, after all it makes sense I work for VMware, and put them into a vCloud Express cloud. This process now seems simple, but it took quite a bit of research and testing to get things where I wanted them to be. For those that do run blogs either in WordPress or another format I’d suggest you look into the vCloud Express option. Because I have done so much testing with Virtacore in the past month or so I decided to host with them since I am familiar with their portal and tools.
Deploying The Bitnami WordPress Stack
This is where the bulk of the work needs to get done. There is a few articles out there on how to set up the LAMP stack including one from Jason Boche that I read through. Ultimately I did some googling on “WordPress Appliances” and found the solution for me. It was a company call Bitnami. What these guys have is pretty cool. They build the stacks for multiple applications as either virtual machines, or native installers you can use. Once I found them I was pretty much on my way. I actually talked to them directly and helped them produce an up to date version of their WordPress Appliance that was suitable to use with vCloud Director or ESX. The one you will find for download on their site is now in ESX format and trust me you do not want the hassle of converting it to ESX and making all the changes to optimize it. I did make a few changes to their appliance to update for networking, and the disk size as it was only 5GB. I also added more RAM and CPU so you should have no issues. They were also nice enough to install all the needed packages for you to install the VMware tools.
- Download the modified OVF version of the Appliance Here which has been updated by Bitnami
- Import the Appliance to a local ESX Instance
- Boot it up and install the VMware tools
- DHCP will be used initially but we will change this later
- Change the password for user “bitnami”
- All commands will require sudo as well
Before you can have a completely working version you need to make a few adjustments so this will all work. There is a couple of things you need to know about the appliance. First you will notice when you access the IP address you get a splash page and wordpress is installed in a sub directory as you see below.
This is should be changed so you can access the WordPress install directly. According to the folks at Bitnami this is a common request and may be integrated in the future.
- You just need to follow the steps located here. You need to basically edit the http.conf file in apache so it points to the wordpres/htdocs folder as the root.
- next you need to rename the file /opt/bitnami/apps/wordpress/updateip to something like updateip.bak. If you do not this will change your URL in wordpress on each reboot.
- Log into phpmyadmin and update the table for wp_options option_id #3 and #39 to reflect your blog name instead of the DHCP IP address.
- Create a HOSTS entry for this name and local IP so you can stilla access the blog locally.
- Change the various passwords.
- phpMYAdmin – “sudo /opt/bitnami/mysql/bin/mysqladmin -p -u root password” (Default is root/bitnami)
- Database Password used by WordPress:
- $ mysql -u root -p -e “grant all privileges on bitnami_wordpress.* to ‘bn_wordpress’@’127.0.0.1′ identified by ‘new_password‘;”
- Edit the wordpress/htdocs/wp-config.php file and change the “DB_PASSWORD” option
- WordPress”User” – do this inside wordpress default password is ‘bitnami’
- Most likely you will need to make the myphpadmin page accessible from the outside by following these steps
- Enable APC caching for WP-Total Cache by following these steps. It is already installed so you just need to remove the comment in the php.ini file and restart the services. This is MUCH better for caching that disk based which is a HUGE advantage of using your own server.
- Enable the Bitnami stack to start as a service using this article.
At this point make sure you can access the blog with the HOSTS entry and see the basic blog page with no data. If you can then move on to moving your data. You should basically have an empty WordPress site as shown below:
Configuring SMTP (UPDATED 1-3-12)
One thing I did find was that the appliance includes the plugin WP SMTP which allows you to send WordPress mail through SMTP rather than using PHP Mail() function. There is a few things I noticed with this mainly that not all other plugins or themes are coded wo use “wp_mail()”. Many of them including one of my themes used the standard PHP “mail()” and based on the nature of the plugin, bypasses the setting modified. Only code that uses “wp_mail()” properly sends, and in fact some of the notifications in WordPress for updating a user will not work. So the best solution I found was to install POSTFIX in the appliance and configure the included plugin to use the local SMTP server with postfix. There are however some things you need to know that took me a good few days to work out.
- Packages you need to install:
- cyrus-sasl-plain (Needed for authenticated SMTP Relay if you choose to do so)
- Some of the Virtacore external IP addresses are listed with certain blacklists like SpamHaus as “Dynamic” IP Addresses. You will want to check yours or you will not be able to send mail from your appliance directly to email addresses and you will get a 554 error.
- Virtacore does not yet have a shared/central “trusted” non-authenticated SMTP relay for use. I am working on that with them as to the valid reasons why it would be useful.
- If you want to setup smarthost relay it can be tricky. It is easy to do with non SSL/TLS and I used the instructions here for testing, but once I cleared out the blocked IP’s things sent fine directly
- The Bitnami stack comes with the WP-SMTP plugin and you can set this to relay through Postfix instead of an external relay
- use localhost hostname
- Use Port 25
- make sure your external IP is not blacklisted
- This will mean you are sending mail directly from wordpress to postfix locally and it will relay out
- No need to change your outbound firewall rules since this is a local to outbound only
Adding this aspect to the appliance means you may not even need the WP SMTP plugin, but it is nice to have just in case. This essentially sets up outbound mail from your appliance directly. It would be best to smarthost relay from your appliance just on the off-chance the IP get’s re-listed for some reason, but that can be tricky to set up with SSL/TLS so hopefully Virtacore will add a basic relay host for folks in their cloud to use. It would make life much easier for sure and prevent any issues with blacklisting. So far I have had no issues other than a problem with PHP Mail() not sending after a server reboot. However, if nothing is using php mail() then the above route should work fine.
Import Your WordPress Data
Once you verified that you can get to the blog site under the HOSTS entry and local IP address and the site is responding you can import your data. This is done in a few steps with the Database and the contents of your blog.
- Export your Database from your live site with myPHPadmin
- Import that file into the Bitnami database and you should see all your tables and rows appear
- See screen show below
- Download you’re entire wp-contents directory from your live site and copy it to /opt/bitnami/apps/wordpress/htdocs basically replacing the entire directory on the appliance. Do this as the “Bitnami” user with FileZilla or other program
Once the files and database ave been moved again using your HOSTS file entry see if you’re blog comes up locally on the appliance. Ensure that the plugins and other things are working. You may need to tweak a few things but in most cases since you copied the entire blog content the configuration and everything should remain. If things look good you are ready to upload your Virtual Machine to vCloud Express with vCloud Connector. This was covered in previous articles, and is extremely simple to do. Once the appliance has been uploaded you will need to do one or two last things.
- Edit the IP address from DHCP to Static using the IP assigned from the static IP pool
- Edit the resolv.conf file to add the DNS servers of the provider
- Restart the networking and add an External IP using the Provider’s portal
Before you slice over your actual DNS I would change your HOSTS entry to point to the new external IP, clear your browser and make sure you can now hit the live site. If you can you are ready to cut over your real DNS to the new external IP and wait a day or two for DNS to update before you make any changes. This will ensure everyone is pointing to the new version and seeing your updates. You can also turn the TTL down to 30 minutes on most DNS servers to allow the updates to propagate faster.
Configuring Your Firewall
You will also notice by default when you spin up a Virtacore vCloud Express Virtual Machine all traffic is allowed. If you navigate to “My Cloud” and then “My Virtual Networks”, scroll down and you will see that “Public Cloud Firewall – Enabled” is UNCHECKED. Now once you check this and save you will block all traffic, so either pre-write the rules you want for things like SSH/HTTP/HTTPS before you enable it or write them quickly after. Just be sure you use the private destination IP address for the rules.
Results And Testing
I have found since moving to this setup my response times are far better than any shared hosting. I am also now investigating the different backup options. Virtacore has clouds in both Virginia and California so I am playing with a DR server in LA while the primary runs in VA. I also bought the plugin called BackupBuddy which is proving to be useful for creating and shipping full backups of your blog. So far I am happy with it since it provides a way to restore to a new appliance if need be in another datacenter.
I hope you decide to give both Bitnami and Virtacore a try for your WordPress stack. I for one have been very happy with them both. I also ended up moving a few other sites I handle and converting them all to a WordPress Multi-Site install, but that is for another day . I may post a few screen shots in the next couple days of a few key things so you can see examples of things. I simply had more of the steps documented than actual screen shots.
Also there is the option of building your own Linux server using the new CentOS 6.2 ‘Minimal’ Installer. I have been playing with this and it is pretty slim for sure. It does not even include much int he way of networking tools or even basic packages. But if you want a really small version of Linux for your own appliances, this is a nice little option. In fact I will be testing this in a rebuild of my vCloud Director home lab this week. I did use the native installer of Bitnami on a CentOS minimal install and it also worked well if you want to go that route.
Sign up here for a Virtacore trial using the code STEKREF get $50 off.