I’ll step you through a complete installation of WordPress. I’ll list the minimum requirements and a couple of useful extras. After you have WordPress installed, I’ll take you on a tour of WordPress options for configuring your blog. Finally, you’ll make your first post to your blog.
Installing WordPress on your server is as simple as running its install script. However, first you’ll need to make sure that your system meets WordPress requirements, obtain WordPress and some helper programs, and prepare your server.
Your system needs to meet some basic requirements to install and run a WordPress blog. The first is hosting. You’ll need an account on a server somewhere. This may be shared hosting or your own server, if you have one. WordPress does work on Windows, especially with the same web server and database setup. But because it’s the most common and, frankly, the simplest to set up, I’m going to concentrate on GNU/Linux-based hosting.
Your hosting server needs to have support for PHP version 4.1 or later and MySQL database server version 3.23.23 or later. I recommend Apache as a web server (version 1.3.23 or later), but any web server capable of supporting PHP should work. If you have support for mod_rewrite in Apache, you’ll be able to use some especially useful features of WordPress. (See http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html for more information about mod_rewrite.) You’ll also need to be able to upload files via FTP and change permissions on your files and folders.
I don’t have a recommendation for disk space or bandwidth. A 1,000-post blog with 2,000 comments and no pictures will fit comfortably in 10MB with room to spare. Bandwidth is too variable to call. Blog popularity ranges from 1 visit a week to 10,000 per day and higher.
A huge number of companies offer hosting. Shop around and get the best deal to suit your needs. Always go for more than you think you’ll need, but stay within your budget. You never know—your blog may become very popular. The last thing you want is to be cut off for exceeding your bandwidth, just as you are building your community.
Next, you need to get a copy of WordPress. That’s pretty easy. Mouse along to http://wordpress.org/download and download the latest .zip file. The latest release is also available as a gzipped tarball. If your desktop is a UNIX or Linux machine, this may be more appropriate for you. The files inside are all the same.
You will need an FTP program, a program to expand zipped files, and a text editor of some kind.
FTP is the term for the transfer of files from a client, in this case your PC, to a server—your hosting server. Actually the acronym stands for File Transfer Protocol, but it is commonly used as a verb, too. FTP software is readily available. In fact, it is likely that your current operating system already includes an FTP program. Unfortunately, it is probably a command-linedriven one. While command-line FTP is straightforward to use, it is much easier to work with a graphical application if you can. If your desktop is Windows, I recommend Filezilla (http://filezilla.sourceforge.net/) or SmartFTP (http://www.smartftp.com) for FTP. Plenty of other FTP programs are available..
You’ll need a program to unarchive the WordPress installation files you download, because they are compressed in an archive. If you download the .zip file, you will need a program capable of expanding, or unzipping, the archive. WinZip (http://www.winzip.com/) is probably the most popular on Windows, but has a shareware license requiring you to purchase it after a trial period. I recommend 7zip (http://www.7-zip.org/), which is completely free.
For a text editor, I recommend nothing more elaborate than Notepad for now. Later, you might want to evaluate some of the specialized PHP and CSS editors.
You’ll need to take a few steps before you install WordPress on your server. These include gathering some information, creating a database, transferring the files, and setting file permissions. So, let’s get started.
Before doing anything else, you will need to gather some information and make a fairly simple decision.
From your hosting service you will need the following information:
- Your login and password for FTP (you should have been given those when you signed up for your hosting)
- The name of your database, if one has already been created for you, and your database login details
The decision you need to make is simply where to put your blog. By that, I mean that you must decide if your blog will be the only thing on your web site or whether you will want to also have other pages, such as Drupal or phpBB sections. It comes down to the URL of your blog. Will it be http://example.com/ or will it be http://example.com/blog? I almost always recommend the latter (of course, you may wish to call it journal, diary, news, or something other than blog), because it leaves your options open for future changes.
Now you need a database. Some hosting services allow you to have only one database. Often, this is already created for you when you sign in to your administration page. Others allow you to create your own database. If you have the choice of multiple databases with your own name, I suggest you create one called WordPress, if you can, but it doesn’t matter what its name is, as long as you know that name. If you are creating a brand-new database, don’t forget to give your database user account permission to access it.
These steps are usually carried out through some kind of control panel—software running on your server to allow you to administer your hosting space—provided by your hosting service. Hosting services provide many different control panels or administration pages. Although you rarely have a choice of which one you get, they should all be capable of allowing you to administer your database in various ways. Two of the most common control applications are Plesk (http://www.sw-soft.com/en/products/plesk/) and cPanel (http://www.cpanel.net/).
If you have the option, create a database user specifically for the use of WordPress. That is, if you can, create a user and assign that user privileges to access the WordPress database you just created.
In the end, it doesn’t actually matter whether you use an existing database or set up a new one. WordPress will quite happily share a database with any other application, including another installation of WordPress.
Before you transfer the WordPress files to your server, you’ll need to expand the archive. The file you downloaded from the WordPress site is an archive, or a compressed collection of files. Then you will need to use FTP to transfer the WordPress files you downloaded earlier to your server. These tasks require the FTP program and expansion software I mentioned earlier as requirements.
Extract the WordPress files from the archive into a convenient folder, such as C:\wpwork or C:\My Documents\wpwork. You’ll need this folder to work through the examples in this book. You should have approximately 160 files in various folders within C:\wpwork. You’ll need to copy one of them and edit it before you upload the files.
Find the wp-config-sample.php file and make a copy of it called wp-config.php, saving it in the same directory. Load that copy into an editor program—a text editor, not a word processor. As I noted earlier, Notepad will work fine for now, if you don’t have a specialized text editor. In this file, you need to change the dummy database connection settings to the real values.
// ** MySQL settings ** // define('DB_NAME', 'wordpress'); // The name of the database define('DB_USER', 'username'); // Your MySQL username define('DB_PASSWORD', 'password'); // ...and password define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
Fill in the details for the database name, database user, and password from the information you gathered earlier. As the comment says, it is very unlikely you will need to change the host setting. I have found only one hosting service that required the host setting to be changed. If you do need to change that setting, your hosting provider will have supplied that information along with your other details.
// ** MySQL settings ** // define('DB_NAME', 'wp_example'); // The name of the database define('DB_USER', 'wp_db_user'); // Your MySQL username define('DB_PASSWORD', 'secret'); // ...and password define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
If your installation of WordPress is going to share a database with another WordPress installation—that is, if you plan to keep the data tables for multiple WordPress installations in the same database—you’ll also need to change the prefix setting just below the database connection setting, which looks like this:
$table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_'
$table_prefix = 'example_'; // example: 'wp_' or 'b2' or 'mylogin_'
Now save the changes made in wp-config.php file.
|Note||You need to change the prefix setting in wp-config.php only if your WordPress installation is going to be sharing a database with another installation. If some other software is using the database, you don’t need to change this setting, as WordPress and the other program should not have conflicting table names.|
Next, create a brand-new file called dothtaccess.txt in the same folder as wp-config.php. It should be an empty file, but if you’re using Notepad, it won’t let you create an empty file! Simply press Enter a couple of times to get around this restriction. You can create the file in Windows Explorer if you wish. Simply right-click, choose New ➤ Text Document, and name it dothtaccess.txt.
Setting File Permissions
Before you put away the FTP program, you need to check your permissions on certain files and directories. By default, files you upload to your server and directories you create on it are owned by you, or rather your account on the server. This is correct and as you might expect. However, the web server, Apache, usually runs as a different user, often apache, httpd, or nobody. This means that software running under Apache—in this case, WordPress—doesn’t normally have permissions to modify or delete files, nor to create new ones. To fix this, you need to change the permissions of some of the WordPress files. You will most likely need to give full access to those files. You will also need to give write access to a couple of folders, so that WordPress can create new files.
Depending on your FTP software, you will either need to set the file permissions to a numeric value such as 666 or 777, or check the R (read), W (write), or X (eXecute) permissions for U (user or owner), G (group), and O (other). The numeric value 666 represents read and write permissions for user, group, and other. The 777 value represents read, write, and execute permissions for user, group, and other.
Table 14-1 shows which files and folders need their permissions set and what type of permissions should be applied. Note that a folder name with an asterisk following it signifies that all the files in that folder need their permissions adjusted.
You are now ready to install WordPress on your server. You have created a database, given permissions to your database user, uploaded the WordPress files, created a couple of new files, and set permissions appropriately. Although reading through these instructions, it seems like a lot of work, if you are already familiar with these tasks, this whole process really does take only five minutes! Have heart, you are nearly there.
Go to your web browser and type the following address into the address bar (assuming you installed in the blog directory):
This will load the WordPress install script, as shown in Figure 14-5. Click First Step, and you will be prompted for the title of your weblog and an e-mail address.
As shown in Figure 14-6, type in a suitable name—Wendy’s Weblog, Tuxedo News, or whatever you want to call it. Don’t worry—you can change the title later. Make sure the e-mail address you enter is valid. Your administrator (admin) password will be sent to it. Click the Continue to Second Step button to move to the next step.
Next, you will see a progress screen as the install script creates your database tables for you. In practice, it is so fast that all you will see is the “Finished!” message. You will see instructions for logging in to your new blog. Make a careful note of the password. For security reasons, it is a randomly generated one.
|Tip||When I’m setting up a new WordPress blog, I select the password with my mouse and copy it to the clipboard (by pressing Ctrl+C). Then I can simply paste it into the login form.|
Now, click the link to wp-login.php. You will see the standard WordPress login screen. Enter the username of admin and the password from the previous page, as shown in Figure 14-7. Then click the Login button.
Introducing the Dashboard
You should now see the WordPress Dashboard, as shown in Figure 14-8. This is the page that greets you every time you log in to your blog.
The Dashboard has several main areas. At the top of the page is the name of your blog and a link to view the web site. Resist clicking that just yet; let me take you through the rest of the page first. Below your blog title is the main menu bar. This contains links to all the main areas of the blog administration interface.
Below that is the main part of the Dashboard page. On the left, taking up a sizable portion of the page, are the three most recent posts from the WordPress development blog. Here, you will see news of any new versions of WordPress, news of security fixes, and so on. Below that are links to other stories from around the WordPress world.
On the right side of the page is a Latest Activity panel. This panel lists the last few posts and the last few comments from your blog. Right now, you will have only one of each, which the install script created for you. Below that you will see some blog statistics: number of posts, comments, and categories.
The first thing to do with your newly installed blog is to change the admin password to something you will remember. Click the Users tab across the top of the page. You’ll see a form with space to enter a lot of personal details about yourself, as shown in Figure 14-9. Near the bottom are the fields to enter a new password. You need to enter the password twice. This is to check that you didn’t mistype it.
You can go ahead and enter your other details while you are on the page. By default, none of these details other than your nickname and web address are ever visible on your blog. When you have finished entering all your details click Update Profile to save your changes.
Now you’re ready to configure WordPress.