Let’s be honest, sometimes we don’t necessarily want to start a site from scratch, especially a blog. There’s so many blogging platforms out there, why reinvent the wheel? Arguably the most well known, Wordpress, is very easy to install on Ubuntu 12.04 LTS.
First things first, you will need to install Wordpress and MySQL (if it’s not already installed):
sudo apt-get install wordpress mysql-server
If you don’t already have a LAMP server setup, you will when this is done as Wordpress depends on Apache and PHP (and necessarily modules). MySQL server is not a dependency (I assume because Wordpress can run on different databases) so we’ll install it as well. Come to think of it, this could very well be considered a one line solution to setting up a LAMP box.
Wordpress itself gets installed to
/usr/share/wordpress. Depending on if you are going to be running a single Wordpress blog or multiples ones you may link to or copy the directory to a public directory. By default, Apache uses the
/var/www directory as your document root. We can link the Wordpress code to this directory:
sudo ln -s /usr/share/wordpress /var/www/wordpress
You can adjust the directory accordingly for your needs. Once linked your blog should be available from
http://your-servers-ip/wordpress (assuming you didn’t rename the symlink). But, if you try to access it now you will get an error about missing / unreadable configuration files.
Luckily, Wordpress comes with scripts to handle setting up our database and configuring the install for us. Be sure to replace
your-servers-ip with your server’s IP or the fully qualified domain name for the blog you’re setting up.
sudo sh /usr/share/doc/wordpress/examples/setup-mysql -n wordpress your-servers-ip
Now that the configuration file is created, let’s go ahead and
chown all of the files to be owned by
www-data the user that runs Apache:
sudo chown www-data /var/www/wordpress -R
Now you can visit your site (http://your-servers-ip/wordpress if you followed this to a T) and you will be presented with the Wordpress installation page. Fill out the form and you will be on your way to a working Wordpress blog. A word of caution, installing Wordpress from the repositories on 12.04 LTS will leave you with Wordpress version 3.3.1 and no easy way to update due to local changes to the source. I’m unsure how secure this install of Wordpress actually is but know that a lot of folks may favor using the most up to date version of Wordpress. If there’s any interest I’ll put together another post about doing a manual install of Wordpress on Ubuntu 12.04 LTS.