Re-installing WordPress on Ubuntu 11.04

Publishing the last post was quite an ordeal, and not because of anything related to the content. Installing WordPress on Ubuntu was a bit more challenging for me than I thought it would be. For those of you who may be running into the same issues I did, here is a run-down of what I did and what I had to change.

The first step was to follow the Ubuntu Community page on WordPress. I followed the steps of installing a LAMP server and WordPress from Ubuntu repositories on the command-line. I was using Ubuntu 11.04 64-bit, and the version of WordPress from the repo’s is 3.0.5.

Changing the URL for the blog

I chose elangocheran.com as my server name during the initial WordPress installation. However, I made http://www.elangocheran.com the default domain name that people see for my webserver, so readjusting for this required a little extra work. The first thing was in /etc/wordpress, create a symlink from config-www.elangocheran.com.php to config-elangocheran.com.php, which itself was set up a symlink to wp-config.php.

Another adjustment was to ensure that the blog’s URL was at the path /blog of the main domain (i.e., http://www.elangocheran.com/blog). When following the Ubuntu Community instructions exactly, however, I did this except that the path /wordpress was created instead. The following steps fixed this:

  • Login to the WP admin (e.g., URL=DOMAIN/wordpress/wp-admin)
  • In the Settings section on the left, change the site address and WordPress address to be .../blog instead of .../wordpress
  • Click the button to save the settings. The changes will take effect before the next page loads, and this should cause an error. The reason is that WordPress is looking for DOMAIN/blog, which should be located at /var/www/blog, but the symlink to the wordpress installation is still named /var/www/wordpress
  • Rename the symlink at /var/www/wordpress to /var/www/blog
  • Logging into the WP admin should work now
  • In the WP admin page, go the Settings section on the left, and click on the Media link within it.
    • Change the default location for uploads to be /var/www/blog/wp-content/uploads
    • Change the default URL path for uploads to be DOMAIN/blog/wp-content/uploads

    This will ensure that the things you upload will be less likely to be visible out-of-context, and that the links to the uploaded files are properly generated.

WordPress image upload and insert problems

At least some others using WordPress on Debian-based systems (including Ubuntu) had the same problem as me: inserting an uploaded image into a post led to a blank screen. For me, the problem was not only that, but that when I clicked “insert image”, what should’ve appeared as a modal window (pop-over) actually was loaded in its own page. Another, somewhat-related, issue is that the flash uploader did not work either.

Uninstalling new themes and deactivating all of the plugins did not work. In some forums where users reported similar issues, others stated security settings needed to be changed, ultimately in mod_security of Apache. This sounded a little heavy-handed for what seemed like a software issue. Like the post above and others, I upgraded to the latest version of WordPress. The version I’m running is 3.2.1, and everything works as it should, with a few obvious cosmetic touches that I appreciate very much.

Upgrading WordPress means ignoring the Debian/Ubuntu package and thus missing the convenience of automatic updates and installation. Then again, as this problem proves, not everything that lands in the repos is bug-free. Others who upgraded WP to v 3.0.5. through WP itself regretted not doing their “due diligence” to find out about this problem and skip over this version.

The change-over to manual installation wasn’t too bad. The process was the following:

  • mv /usr/share/wordpress /usr/share/wordpress.hold
  • wget http://wordpress.org/latest.zip
  • unzip latest.zip
  • mv wordpress /usr/share
  • cd /usr/share
  • ln -s /etc/wordpress/wp-config.php wp-config.php
  • mv /usr/share/wordpress.hold/wp-content/uploads /usr/share/wordpress/wp-content
  • chown -R www-data:www-data /usr/share/wordpress
  • logging into WP admin showed a screen indicating that it would update the database to the new version

That was it! Basically, I made a copy the old WP installation directory while I installed the new one. From the copy of the old WP, I moved my uploaded files to the new WP. Since I had already removed my few themes and plugins in previous attempts to fix the problem, nothing to salvage there. And permissions were set accordingly.

One thought on “Re-installing WordPress on Ubuntu 11.04”

  1. I followed your line to overcome some difficulties updating my wordpress installation, but I did not make a backup. This didn’t even appear to be necessary. All files and posts were there . Only the plugins were gone. I now am able to update wordpress as is supposed.
    thanks for your post!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s