Sunday, April 7, 2013

Setting up WordPress on a Ubuntu 12.10 Server

Ever wanted to host your own blog? Here's one way to do it. WordPress is one of the more user friendly content management systems available, and although others may be better suited to enterprise applications(I'm looking at you, Drupal), WordPress does just fine as a blog CMS. To begin with, I set up a 64 bit installation of Ubuntu Server 12.10 in VirtualBox. Then I followed the tutorial I posted previously to set it up as a LAMP server.

The next step is to set up a database that your blog will use. I chose to use MySQL. You can name the database whatever you want, and create a user that has access to it. Here are the MySQL commands you will need(replace username and password ):
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO "username"@"localhost" IDENTIFIED BY "password";
FLUSH PRIVILEGES;
EXIT;
Now your database is set up and ready to go! Next, download the latest release of WordPress to your www directory and extract it. You will need to be root to do this:
sudo su
cd /var/www/
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
Now you have a directory containing the wordpress installation at /var/www/wordpress/. However, we still need to connect the MySQL database to the WordPress installation. Enter the wordpress directory and you will find a file called "wp-config-sample.php". Rename it to "wp-config.php" and open it with a text editor. Here's a screenshot of wp-config.php open in VI (You can see part of a GUI because I'm logged in through SSH). I've underlined the parts you need to update in yellow.
mv wp-config-sample.php wp-config.php
vi wp-config.php 



Next step: Make your blog more secure against hackers! If you scroll down a little in the wp-config.php file, you will find a list of keys. Make a new key for each one. You won't have to remember them, so make them as complicated and nasty as possible. You're looking for this section:



Now then, cross your fingers and open your web browser to http://hostname/wordpress/wp-admin/install.php. If all went well, you should see this:


Follow the instructions on the screen to create an admin account for your blog. Note: this is not the username and password for your database. It's a new one that will be used to log into the administrator account of the blog. Fill in the information and hit the button to install WordPress.

Now you can log in to your new WordPress blog! That wasn't so bad, was it? Your blog will be at http://hostname/wordpress/.

Happy Blogging!

2 comments:

  1. nice info
    http://php4unow.blogspot.com/

    ReplyDelete
  2. This is excellent, Chris. I had been considering setting up a Wordpress blog, but had started to write one in python. I might have to try this out.

    Check out my blog if you have not already: http://pmickplace.blogspot.com

    ReplyDelete