Installing WordPress on the main CS Webserver (www.cs.jhu.edu)

WordPress is a popular blogging and content management system. This page describes how to set up WordPress in your CS website. (It's really easy!)

This procedure has been tested with WordPress version 3.8. Other versions should work in the same way, but if you run into problems, please email support@cs.jhu.edu for assistance.

Prerequisites

  • You will also need to have a database on the department MySQL server that you can create tables in. If you requested a database when your account was created, that database should be sufficient. If you need a database created or if you're unsure whether you have a database to use, please email support@cs.jhu.edu for assistance.
  • And finally, make a note of your MySQL account name, password, and the name of the database you will use.

NOTE: CS IT does not create or edit webpage content for users. You are responsible for your own website design and troubleshooting.

Installing WordPress

Download WordPress

Go to https://wordpress.org/download/. Use the button on the right to download the .zip version of WordPress.

If you didn't download the file while using one of our Linux Clients, you'll need to transfer the file to one of them with scp or some similar program.

Unpack the Download

Extract the .zip file into your ~/public_html directory. If you're at a lab machine, that's as easy as double-clicking on the downloaded file and telling it to extract into your public_html directory. From the command line, you can run the following command:

unzip -d ~/public_html latest.zip

The default location for the WordPress site will be http://www.cs.jhu.edu/~your-account/wordpress. If you want it somewhere else, simply put the files somewhere else within your ~/public_html directory. If you want your home page to be WordPress, move the contents of the ~/public_html/wordpress/ directly into the ~/public_html/ directory. From the command line, this will do it:

mv ~/public_html/wordpress/* ~/public_html/
rmdir ~/public_html/wordpress

Configure Database Access

In your wordpress directory, rename the wp-config-sample.php file to wp-config.php .

Edit that file, either by double-clicking on it or by running pico wp-config.php from the command line.

Find the MySQL settings in the file. Enter your MySQL account name, password, and database into the appropriate fields. For DB_HOST, use 'mysql.cs.jhu.edu'. That part of the file should look something like this:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'example');

/** MySQL database username */
define('DB_USER', 'example');

/** MySQL database password */
define('DB_PASSWORD', 's3kr1t');

/** MySQL hostname */
define('DB_HOST', 'mysql.cs.jhu.edu');

Find the section labeled "Authentication Unique Keys and Salts". In your web browser, go to https://api.wordpress.org/secret-key/1.1/salt/, which will generate unique values for each setting for you. Copy the text of that page and paste it into the wp-config.php file, replacing all of the lines that contain "put your unique phrase here".

Save the config file.

Secure Your Configuration

This part needs to be done from a command line. Open a terminal window and type the following commands:

cd ~/public_html/wordpress
chmod 0600 wp-config.php

(Obviously, if you put your WordPress files somewhere else, change to that directory instead of ~/public_html/wordpress.)

These commands will make sure that no one but you can read the file with your MySQL password in it.

Finish Setting up WordPress

Now go to http://www.cs.jhu.edu/~your-account/wordpress (or wherever you installed WordPress) in your browser. The page will present you with a form that you must fill out to create a WordPress account for yourself. This account does not have to be the same as your CS account, nor does it have to use the same password. After you submit the data in that form, your site will be set up and ready to go.