Set Up A WordPress Blog

From CS Support Wiki
Jump to: navigation, search

Overview

This article will show you how to set up WordPress in your UVA CS personal web space. Much of this procedure is inherited from Christophe Coenraets' excellent related article [1].

The summary of the procedure is as follows.

  • Set up MySQL database
  • Download WordPress
  • Configure WordPress

This tutorial uses mst3k as the example user id. Replace this with your own.

Set up MySQL database

The MySQL database is managed by ITS. We will set up WordPress to run on the CS server but the database will be on dbm2.

Navigate to the UVA ITS MySQL Self Service page

If you haven't already, Create a MySQL Account

Create a database and call it 'blog'

Download WordPress

Log in to one of the UNIX machines power1 ... power6

cd to your ~/public_html directory

This tutorial assumes that you want your blog to be accessible at www.cs.virginia.edu/~mst3k/blog

Grab the latest WordPress

wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
mv wordpress blog

Configure WordPress

Create the WordPress config file:

cd blog
mv wp-config-sample.php wp-config.php
nano wp-config.php

Modify the database connection parameters as follows:

define(‘DB_NAME’, ‘blog’);
define(‘DB_USER’, ‘mst3k’);
define(‘DB_PASSWORD’, ‘YOUR_PASSWORD’);
define(‘DB_HOST’, ‘dbm2.itc.virginia.edu’);

Type CTRL+x then y to write the file and quit nano

Navigate to http://www.cs.virginia.edu/~mst3k/blog to complete the install configuration

Optional

Redirecting from the ITS web server

Personal web space is provided to CS students both by the CS department and ITS. I prefer to maintain the CS one and just redirect to it from the ITS one. This will show you how to set up redirecting on the ITS web server so that all requests to people.virginia.edu/~mst3k go to www.cs.virginia.edu/~mst3k.

Note: If you follow these instructions, requests to people.virginia.edu/~mst3k/blog will not go to www.cs.virginia.edu/~mst3k/blog. To set up URL rewriting, you'd have to have access to the Apache config, so this is the only option you have as a student. You can certainly set up another redirect on blue.unix at public_html/blog if you wish.

Log in to blue.unix

cd to ~/public_html directory

Create a small PHP redirect script:

nano index.php

Populate it with this line:

<?php header( 'Location: http://www.cs.virginia.edu/~mst3k' ) ; ?>

Type CTRL+x then y to write the file and quit nano

Installing WordPress packages

Under this configuration, you will not be able to install themes or plugins, or anything that requires downloading and installing a package from WordPress. WordPress does allow updates by FTP or SFTP, but the CS servers don't run an FTP server, and the currently installed configuration of Apache doesn't have PHP bindings for libssh2, so SFTP is not available either.

These instructions will show you a workaround to installing WordPress packages so you can install any plugins or themes you'd like.

First, open the wp-config.php file back up:

nano wp-config.php

Then add the following line:

define('FS_METHOD', 'direct');

Type CTRL+x then y to write the file and quit nano


If you have sudo access, then follow these instructions to enable installation of WordPress themes or plugins.

cd to your ~ directory

Then run:

chown -R www-data: public_html
chmod -R 755 public_html

Note: I do not have sudo access, so I wasn't able to test this, but this is how I would do it if it was my machine :)


If you are like me and you do not have sudo access, then this is a workaround for you. However, please note that it includes a step that has to be reversed to maintain security, so follow the directions the whole way through. An update to this section would be appreciated if anyone has a better idea of how to do this given the limitations of student credentials.

cd to your ~ directory

Temporarily allow global write write access to your public_html directory:

chmod -R 777 public_html

Then go install the WordPress package.

Finally, put the permissions back:

chmod -R 755 public_html

Note: This isn't a really elegant solution because now everything that WordPress downloaded and installed will not be accessible to you. Again, edits to this article would be appreciated. However, such details will never be noticeable to visitors of your site.

--Mp3t 00:41, 21 December 2012 (EST)