If you’re building a site based on a content management system, it makes sense to install the CMS on your personal development platform first, crafting the design and data behind the scenes until is it ready to be pushed to a live production server. That way experiments and mistakes can be made locally, rather than in front of a live audience.
After a decade of continuous development most CMSes have streamlined installation to a point-and-click procedure, but there are a few steps that often confuse first-timers. In this article I’ll take you through the process of installing a modern version of Wordpress (3.8, as of this writing) on your local machine, while sharing some best practices and precautions.
There are a few things you need in place before we begin. The most important component is a local server environment that features PHP and MySQL. I’m using MAMP for my server, although there are many other options. If you don’t yet have a web development server, go read up on installing one for Mac OS X or Windows before returning here.
Make sure that your local server is up and running. Be certain that you understand the following:
- where the Apache Document Root is, and how to set it
- the username and password for the MySQL server
- how to make a new database in MySQL
Download a copy of Wordpress from Wordpress.org. Uncompress the downloaded archive file and rename the result. At this point, you have two choices:
- If you want to use WordPress for your entire site, rename the wordpress folder to reflect the name of your site (webdevguru, for example).
- If you only want to use WordPress to manage a portion of your site, rename the wordpress folder to blog, articles, or something else appropriate, and place it inside another folder that represents your entire site (webdevguru).
Move the folder representing your site to a logical location: I use Sites in my home folder.
Go to your server preferences and set the Document Root to the location of your site folder. (The server may restart after you’ve reset the document root).
Go to the default server URL in a browser on the same machine. In MAMP, that’s http://localhost:8888/ You’ll be shown a prompt: go ahead click on Create A Configuration File.
Next, we need to create a database for Wordpress to use. There are many possible methods for doing so: perhaps the easiest way is from your MySQL administration page. (In MAMP, that’s found at http://localhost:8888/MAMP/, and clicking on the phpMyAdmin button at the top of the page.)
Click on the Databases tab at the top of the page to create a new database. You can name the new database almost anything you wish: I’ll call mine devedge. It’s a good practice not to name your WordPress database anything too obvious, to avoid direct attacks.
Switch back to the browser tab that contains the Wordpress configuration process and click on the Let’s Go button. At this point we’ll fill out the information required for connecting Wordpress to our database. If you’re using MAMP, it would look like this
Change the table prefix to something other than wp_ as a basic precaution, and click the Run The Install button.
Enter the Site Title, a username, your administration password, and your eMail. Pick a unique username: do not use admin or administrator, as those are easy targets for brute force attacks. The WordPress installation provides an indication of password strength. Because this is the “master account”, it should have a very secure password: if the account is compromised, it can have huge effects on the entire site.
At this stage, you’re all done with the installation. Click on the confirmation buttons, and log into your WordPress installation with the username and password you provided.
Optimizing Your WordPress Install
I would suggest that you add several plugins to make your work in WordPress easier:
- TinyMCE Advanced
- Provides advanced editing capabilities in WordPress
- Broken Link Checker
- Does exactly what it says: alerts you to changed or broken links in your site.
- WP Smush.it
- Optimises images as they are added to posts or pages.
- WP Migrate DB Pro
- Allows the easy synchronisation of a local WordPress database with a remote server.
You’ll need to click on the Install Now option for each plugin , then Activate Plugin. (WP Migrate DB Pro will have to be purchased seperately).
Once you have your own copy of WordPress running, you can experiment with making your own CMS-driven site, variations of which I’ll be showing in future articles.
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.