Friday 21 March 2008

How to Install Wordpress and learn to stop Worrying and Love the Blog


There are two ways to setup a blog. The first is the easiest and involves registering with an on-line blogging service such as Blogger, selecting a template, configuring your account then off you go. The second route is to install a blogging application on a server, configure it, customise it then your up and running. The first method is the quickest and can have you blogging within minutes. The second is a tad more time consuming but gives you far greater flexibility in terms of what you can do.

Wordpress
Having already setup 4 blogs using the first method, I thought it was high time I got down to some real hardcore blogging and setup my own hosted blog. After a few nights of on-line research and numerous coffees, I concluded that probably the best tool for the job was Wordpress. This uses a MySQL database to hold your blogs content then a combination of PHP, XHTML and CSS style sheets to present it.

Hosting

First off you need to have a place for Wordplace to hang its hat. The server that it's hosted on needs to have MySQL and PHP installed on it. The Wordpress site lists a number of recommended Hosts. Again after more surf and coffee sessions I plumped for AN Hosting as my host of choice. A good price, well recommended and bags of features, AN were the host with the most. I also toyed with installing a WAMP server and trying things out locally, but that's a different story. AN also offer automatic Wordpress installation, but for the sake of this post I'll describe how to install it old school.

Installation
Creating the Wordpress Database
Through your hosts control panel create a new database to hold your Wordpress tables. Give it a suitable name such as wordpress or an unsuitable one such as ziggy. Add any users to this database who you want to give access to (e.g. yourself, yourwife, the cat...).

Download Wordpress
First off, download a zip file of the latest stable Wordpress release from the Wordpress website to your PC. Then un-zip it to a suitable place.

Create the wp-config.php file

If you look in the wordpress folder you will find a file called
wp-config-sample.php. Save this as
wp-config.php then edit it using a text editor such as notepad or the developers PFE.

Find the line that says define('DB_NAME', 'wordpress') and replace wordpress with the name of the MySQL database you created earlier. On the next two lines enter the name of a user who you gave admin rights to your database and their password.

e.g.

define('DB_USER', 'dbrock'); // Your MySQL username define('DB_PASSWORD', 'hawkwind'); // ...and password

On the line that says: -

define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value

I also had to replace local host with
remotemysqlhost, as instructed on the AN hosting control panel. I guess I must be the 1%.

One neat trick you can do is to have several blogs setup in the same database, if you want to do this drop down to the line that says:-

$table_prefix = 'wp_'; // Only numbers, letters, and underscores please! this is the prefix that will be given to the name of each wordpress table that is created. For more than one table use different prefixes. For example you could change it to: -


$table_prefix = 'wp_mh_'; // Only numbers, letters, and underscores please!

for your Motorhead blog.

Copy Wordpress Files to Your Server

Now you've created a configuration file, it's time to copy your files up to the server. To do this use an FTP application such as FileZilla or CuteFTP. I personally use WS-FTP, which isn't free but is reliable.

Use your FTP software to copy the extracted Worpress directory to a directory under the directory that holds your web documents. I set one up in this called \blogs\ into which I'll copy any future wordpress directories.
Run install.php

Through a web browser, such as firefox, run the worpress install.php file. To do this enter the URL of your websites root directory followed by the path to this file, which is found in the wp-admin folder.

e.g.

http://www.kungfool.co.uk/blogs/wordpress/wp-admin/install.php You should now be prompted for the name of your blog, which you can always change later, and your e-mail address. Enter both and click on the Install Wordpress link.

In the blink of an eye you'll get the message: -

WordPress has been installed. Were you expecting more steps? Sorry to disappoint.

And given a user ID and password to administer your blog with. Make a note of them for future reference and hit Log In baby.

Congratulations, you've installed Wordpress, woo hoo, go away and have a nice cup of tea and a biscuit to celebrate why don't you.

To view your fledgling blog enter your root URL followed by the wordpress directory: -

e.g.
http://www.kungfool.co.uk/blogs/wordpress
To bring up the admin login page run the following script from your browser: -
http://www.kungfool.com/blogs/wordpress/wp-login.php

substituting your root web URL and Wordpress directory as appropriate.


By the way you can visit the blog I created in this exercise at

http://www.seishan.com/blogs/test25/

I'll be building on it over the next couple of weeks, so expect it to morph as time goes by.

By the way, the 25 in test25 has nothing to do with Hawkwind's - 25 Years On, I'm just checking out Release Candidate 1 of Wordpress 2.5. Wordpress 2.5 isn't on general release yet, but hey I thought I'd give it a whirl.

Enjoy.