Wordpress installation and configuration

The educational technology and digital learning wiki
Jump to navigation Jump to search

Introduction

Wordpress (WP) is quote “a state-of-the-art publishing platform with a focus on aesthetics, web standards, and usability. WordPress is both free and priceless at the same time. More simply, WordPress is what you use when you want to work with your blogging software, not fight it.” (retrieved on Jan 19 2010).

This is a short installation and configuration manual. Please, also read the fine official Installing Wordpress. The only reason I created this article, was to to have a shorter piece I could use with a projector in a web applications class and give out as handout - Daniel K. Schneider 16:31, 19 January 2010 (UTC).

Installation

Installation includes four fairly easy steps:

  1. Create a MySQL database (or find information regarding the database you may use)
  2. Download the software package and unpack it to a web server directory
  3. Modify a PHP configuration file
  4. Launch the web installer (and answer 2 questions)

Creating a database

WP needs a MySQL database. The installation procedure will create many tables that normally should sit in their own database. You may find yourself in different web hosting situations.

(1) If you have a cheap or free provider or if you have a student account, you only may have access to a single database of the database system. This means that WP will have to co-exist with other applications in the same database. That is usually not a big problem, since most applications add a prefix to each table. By default, WP will add a 'wp_' prefix to each table.

(2) If you want to install WP with a "normal" shared webhosting provider, then you likely may use several databases. Consult the admin interface. Usually there is a tool that allows you to manage databases, e.g. add users and tune permission.

(3) If you have your own MySQL server, then you should install WP in its own database that you'll have to create, i.e.

  • Create a database user (that WP will then use to connect to the database)
  • Create a database that database user can access and fill up with table (and later, data)

In both cases you must create and/or remember:

  • The name of the database
  • The name of the database user
  • The password of the database user

In this tutorial, we shall now cover one variant of situation (3):

Creating a database and database user with phpMyAdmin

PhpMyAdmin is a popular database management system that is installed with most providers and that you also should install on servers you own. With this web-based administration, you can create a new database and user in different orders. The most easiest way is to use the following procedure:

(1) Click on the Privileges tab on the top horizontal menu

(2) Click on Add User at the bottom

  • Then choose a user name, e.g. 'blog'
  • Then select host=local or type localhost
  • Enter the password twice (and remember it)
  • Important: Tick Create database with same name and grant all privileges (this will create a new database)
  • Crucial: Never grant any global privileges on a production server. Each database should have its own life (and hacking attacks).
PhpMyAdmin 3.1.2 User and Database creation

If you do it right, you'll have

  • database name = blog
  • database user name = blog
  • password = rumpelstilskin

Remark: Do not confound the mysql user and password with the wordpress administrator user and password that you will have to create later. The mysql user will be used by the PHP scripts of the WP software.

Wordpress installation

Download and put code in place
  1. Download the WordPress package from http://wordpress.org/download/
  2. Create a directory somewhere and call it junk
  3. Dezip the package within the junk directory. You will see a directory called wordpress
  4. If you wish to have a URL on your server like http://xxxx/blog, then rename the wordpress directory to blog for example.
  5. Then, transfer this directory to the web server tree, e.g. via FTP to a provider, to a local "www" directory or somewhere on your local area network. If you happen to use a WAMP system, the directory might typicall be something like c:\....\www, e.g. c:\servers\mowes\www or c:\wamp\www
Edit the configuration file

(1) Rename the wp-config-sample.php file to wp-config.php. Make sure to get this right !

(2) Edit this file (wp-config.php) in a text editor. Do not use Word or Notepad ! Change information below, i.e. adapt to the database and database user names that you just defined above.

Base information:

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

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

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

Change some security related parameters (you may skip this step if you test drive WP on a local server on your PC). In order to make cracking more difficult your wordpress will add extra characters to user's cookies, making it harder to crack encrypted passwords. You only need to do this once and you don't need to type these passwords ever. So use the online generator to generate this salt. Good examples would be:

define('AUTH_KEY',        ':dr+%/5V4sAUG-gg%aS*v;&xGhd%{YKC^Z7KKGh j>k[.Nf$y7iGKdJ3c*[Kr5Bg');
define('SECURE_AUTH_KEY', 'TufWOuA _.t>#+hA?^|3RfGTm>@*+S=8\"\4+\"}]<m#+}V)p:Qi?jXLq,<h\\`39m_(');
define('LOGGED_IN_KEY',   'S~AACm4h1;T^\"qW3_8Zv!Ji=y|)~5i63JI |Al[(<YS<2V^$T])=8Xh2a:b:}U_E');
define('NONCE_KEY',       'k1+EOc-&w?hG8j84>6L9v\"6C89NH?ui{*3\\(t09mumL/fFP_!K$JCEkLuy ={x{0');

Watch out:

  • Both arguments of the define must be enclosed in quotes ' .... ' and each one must finish with semi-colon. Also, do not use unquoted quotes inside the security keys, else php will be confused. If you don't understand what this means, just use the generator and copy/paste.
define ('constant', 'value'); 
  • For programmers who don't know PHP: define is an instruction that just defines a named constant at runtime.
  • If you only own a single database and already have a wordpress installed, you also need to change the prefix towards the end of the configuration file. Else two different WP installations will use the same tables (very messy!)

So double check what you did and then save the file.

Run the installer script

(1) Access wp-admin/install.php from your webbrowser. E.g. on your local test server the URL might be something like:

http://localhost/blog/

You actually will be redirected to the following page:

 http://localhost/blog/wp-admin/install.php

Remark: If you can't see the page or get an error message, please fix the syntax mistakes you just made before in the configuration file. I you can't find the mistake by yourself, look at the server log. E.g. open file c:\...\apache2\logs\error.log. Else, ask a local expert to help.

(2) The script will then ask you to provide a name for the blog and an email address (the email address can bogus for a test system)

  • Make absolutly sure to copy/paste the generated password to a safe place !!

(3) Log in

  • Change immediately the password to a complicated one that you can remember well.

.... enjoy :)

Configuration

Read:

If you log in as admin, you will automatically see the dashboard, i.e. what is often called the backend.

Wordpress dashboard 2.9.1

From the official Administration Panel article, retrieved 17:55, 19 January 2010 (UTC), we reproduce: “Each Panel, referred to as SubPanel, that is accessed via the main navigation menu, is presented in the boxes below. The links in those boxes will lead you to sections of this article describing those SubPanels. From those sections, you can navigate to articles detailing more information about each SubPanel” Links will lead to the codex.wordpress web site therefore middle-click or right-click->Open in New Tab or Window if you like ....).

Dashboard

Posts

Media

Links

Pages

Comments

Appearance

Plugins

Users

Tools

Settings

Maybe start with the following:

  • Add an article (Add New)
  • Change the theme
  • Remove some links and add other ones
  • Create two users, each beloging to a different category.
  • Install plugins. This is really easy with Wordpress (just try)

Database structure

Since we use Wordpress to teach about web databases, we include both a database entity relationship diagram (WP 2.7) and a dump of a relatively fresh WP below

Wordpress 2.7 Database Schema by Jaymin Kapish

Jaymin Kapish in his blog published alternative database diagrams for several wordpress versions, of which we reproduce the 2.7 version here as a thumbnail, that you also may enlarge.

As you can see, Jaymin regroups various tables according to what kind of thing they describe. E.g. Roughly speaking, there are 4 tables to talk about Posts. He also uses a different notation for links. A 1-N relationship is shown as "X to Y" in the label. Arrows go from table to table (and not from field to field).

-- phpMyAdmin SQL Dump
-- version 3.1.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 26, 2010 at 09:39 PM
-- Server version: 5.1.35
-- PHP Version: 5.3.0

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: 'wordpress'
--

-- --------------------------------------------------------

--
-- Table structure for table 'wp_commentmeta'
--

CREATE TABLE wp_commentmeta (
  meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  comment_id bigint(20) unsigned NOT NULL DEFAULT '0',
  meta_key varchar(255) DEFAULT NULL,
  meta_value longtext,
  PRIMARY KEY (meta_id),
  KEY comment_id (comment_id),
  KEY meta_key (meta_key)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_comments'
--

CREATE TABLE wp_comments (
  comment_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  comment_post_ID bigint(20) unsigned NOT NULL DEFAULT '0',
  comment_author tinytext NOT NULL,
  comment_author_email varchar(100) NOT NULL DEFAULT '',
  comment_author_url varchar(200) NOT NULL DEFAULT '',
  comment_author_IP varchar(100) NOT NULL DEFAULT '',
  comment_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  comment_date_gmt datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  comment_content text NOT NULL,
  comment_karma int(11) NOT NULL DEFAULT '0',
  comment_approved varchar(20) NOT NULL DEFAULT '1',
  comment_agent varchar(255) NOT NULL DEFAULT '',
  comment_type varchar(20) NOT NULL DEFAULT '',
  comment_parent bigint(20) unsigned NOT NULL DEFAULT '0',
  user_id bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (comment_ID),
  KEY comment_approved (comment_approved),
  KEY comment_post_ID (comment_post_ID),
  KEY comment_approved_date_gmt (comment_approved,comment_date_gmt),
  KEY comment_date_gmt (comment_date_gmt)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_frm_fields'
--

CREATE TABLE wp_frm_fields (
  id int(11) NOT NULL AUTO_INCREMENT,
  field_key varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  description text,
  `type` text,
  default_value longtext,
  `options` longtext,
  field_order int(11) DEFAULT '0',
  required int(1) DEFAULT NULL,
  field_options longtext,
  form_id int(11) DEFAULT NULL,
  created_at datetime NOT NULL,
  PRIMARY KEY (id),
  KEY form_id (form_id)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_frm_forms'
--

CREATE TABLE wp_frm_forms (
  id int(11) NOT NULL AUTO_INCREMENT,
  form_key varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  description text,
  logged_in tinyint(1) DEFAULT NULL,
  editable tinyint(1) DEFAULT NULL,
  is_template tinyint(1) DEFAULT '0',
  default_template tinyint(1) DEFAULT '0',
  `status` varchar(255) DEFAULT NULL,
  prli_link_id int(11) DEFAULT NULL,
  `options` longtext,
  created_at datetime NOT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_frm_items'
--

CREATE TABLE wp_frm_items (
  id int(11) NOT NULL AUTO_INCREMENT,
  item_key varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  description text,
  form_id int(11) DEFAULT NULL,
  parent_item_id int(11) DEFAULT NULL,
  created_at datetime NOT NULL,
  PRIMARY KEY (id),
  KEY form_id (form_id),
  KEY parent_item_id (parent_item_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_frm_item_metas'
--

CREATE TABLE wp_frm_item_metas (
  id int(11) NOT NULL AUTO_INCREMENT,
  meta_key varchar(255) DEFAULT NULL,
  meta_value longtext,
  field_id int(11) NOT NULL,
  item_id int(11) NOT NULL,
  created_at datetime NOT NULL,
  PRIMARY KEY (id),
  KEY field_id (field_id),
  KEY item_id (item_id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_links'
--

CREATE TABLE wp_links (
  link_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  link_url varchar(255) NOT NULL DEFAULT '',
  link_name varchar(255) NOT NULL DEFAULT '',
  link_image varchar(255) NOT NULL DEFAULT '',
  link_target varchar(25) NOT NULL DEFAULT '',
  link_description varchar(255) NOT NULL DEFAULT '',
  link_visible varchar(20) NOT NULL DEFAULT 'Y',
  link_owner bigint(20) unsigned NOT NULL DEFAULT '1',
  link_rating int(11) NOT NULL DEFAULT '0',
  link_updated datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  link_rel varchar(255) NOT NULL DEFAULT '',
  link_notes mediumtext NOT NULL,
  link_rss varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (link_id),
  KEY link_visible (link_visible)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_mngl_board_comments'
--

CREATE TABLE wp_mngl_board_comments (
  id int(11) NOT NULL AUTO_INCREMENT,
  author_id int(11) NOT NULL,
  message text,
  board_post_id int(11) NOT NULL,
  created_at datetime NOT NULL,
  PRIMARY KEY (id),
  KEY author_id (author_id),
  KEY board_post_id (board_post_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_mngl_board_posts'
--

CREATE TABLE wp_mngl_board_posts (
  id int(11) NOT NULL AUTO_INCREMENT,
  owner_id int(11) NOT NULL,
  author_id int(11) NOT NULL,
  message text,
  `type` varchar(255) DEFAULT 'post',
  `source` varchar(255) DEFAULT NULL,
  visibility varchar(255) DEFAULT 'public',
  created_at datetime NOT NULL,
  PRIMARY KEY (id),
  KEY owner_id (owner_id),
  KEY author_id (author_id),
  KEY `type` (`type`),
  KEY `source` (`source`),
  KEY visibility (visibility)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_mngl_friends'
--

CREATE TABLE wp_mngl_friends (
  id int(11) NOT NULL AUTO_INCREMENT,
  user_id int(11) NOT NULL,
  friend_id int(11) NOT NULL,
  `status` varchar(255) DEFAULT NULL,
  created_at datetime NOT NULL,
  PRIMARY KEY (id),
  KEY user_id (user_id),
  KEY friend_id (friend_id),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_mngl_friend_requests'
--

CREATE TABLE wp_mngl_friend_requests (
  id int(11) NOT NULL AUTO_INCREMENT,
  user_id int(11) NOT NULL,
  friend_id int(11) NOT NULL,
  friend_record_a_id int(11) NOT NULL,
  friend_record_b_id int(11) NOT NULL,
  created_at datetime NOT NULL,
  PRIMARY KEY (id),
  KEY user_id (user_id),
  KEY friend_id (friend_id),
  KEY friend_record_a_id (friend_record_a_id),
  KEY friend_record_b_id (friend_record_b_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_options'
--

CREATE TABLE wp_options (
  option_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  blog_id int(11) NOT NULL DEFAULT '0',
  option_name varchar(64) NOT NULL DEFAULT '',
  option_value longtext NOT NULL,
  autoload varchar(20) NOT NULL DEFAULT 'yes',
  PRIMARY KEY (option_id),
  UNIQUE KEY option_name (option_name)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=220 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_postmeta'
--

CREATE TABLE wp_postmeta (
  meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  post_id bigint(20) unsigned NOT NULL DEFAULT '0',
  meta_key varchar(255) DEFAULT NULL,
  meta_value longtext,
  PRIMARY KEY (meta_id),
  KEY post_id (post_id),
  KEY meta_key (meta_key)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_posts'
--

CREATE TABLE wp_posts (
  ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  post_author bigint(20) unsigned NOT NULL DEFAULT '0',
  post_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  post_date_gmt datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  post_content longtext NOT NULL,
  post_title text NOT NULL,
  post_excerpt text NOT NULL,
  post_status varchar(20) NOT NULL DEFAULT 'publish',
  comment_status varchar(20) NOT NULL DEFAULT 'open',
  ping_status varchar(20) NOT NULL DEFAULT 'open',
  post_password varchar(20) NOT NULL DEFAULT '',
  post_name varchar(200) NOT NULL DEFAULT '',
  to_ping text NOT NULL,
  pinged text NOT NULL,
  post_modified datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  post_modified_gmt datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  post_content_filtered text NOT NULL,
  post_parent bigint(20) unsigned NOT NULL DEFAULT '0',
  guid varchar(255) NOT NULL DEFAULT '',
  menu_order int(11) NOT NULL DEFAULT '0',
  post_type varchar(20) NOT NULL DEFAULT 'post',
  post_mime_type varchar(100) NOT NULL DEFAULT '',
  comment_count bigint(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (ID),
  KEY post_name (post_name),
  KEY type_status_date (post_type,post_status,post_date,ID),
  KEY post_parent (post_parent)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_terms'
--

CREATE TABLE wp_terms (
  term_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(200) NOT NULL DEFAULT '',
  slug varchar(200) NOT NULL DEFAULT '',
  term_group bigint(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (term_id),
  UNIQUE KEY slug (slug),
  KEY `name` (`name`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_term_relationships'
--

CREATE TABLE wp_term_relationships (
  object_id bigint(20) unsigned NOT NULL DEFAULT '0',
  term_taxonomy_id bigint(20) unsigned NOT NULL DEFAULT '0',
  term_order int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (object_id,term_taxonomy_id),
  KEY term_taxonomy_id (term_taxonomy_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_term_taxonomy'
--

CREATE TABLE wp_term_taxonomy (
  term_taxonomy_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  term_id bigint(20) unsigned NOT NULL DEFAULT '0',
  taxonomy varchar(32) NOT NULL DEFAULT '',
  description longtext NOT NULL,
  parent bigint(20) unsigned NOT NULL DEFAULT '0',
  count bigint(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (term_taxonomy_id),
  UNIQUE KEY term_id_taxonomy (term_id,taxonomy),
  KEY taxonomy (taxonomy)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_usermeta'
--

CREATE TABLE wp_usermeta (
  umeta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  user_id bigint(20) unsigned NOT NULL DEFAULT '0',
  meta_key varchar(255) DEFAULT NULL,
  meta_value longtext,
  PRIMARY KEY (umeta_id),
  KEY user_id (user_id),
  KEY meta_key (meta_key)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=22 ;

-- --------------------------------------------------------

--
-- Table structure for table 'wp_users'
--

CREATE TABLE wp_users (
  ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  user_login varchar(60) NOT NULL DEFAULT '',
  user_pass varchar(64) NOT NULL DEFAULT '',
  user_nicename varchar(50) NOT NULL DEFAULT '',
  user_email varchar(100) NOT NULL DEFAULT '',
  user_url varchar(100) NOT NULL DEFAULT '',
  user_registered datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  user_activation_key varchar(60) NOT NULL DEFAULT '',
  user_status int(11) NOT NULL DEFAULT '0',
  display_name varchar(250) NOT NULL DEFAULT '',
  PRIMARY KEY (ID),
  KEY user_login_key (user_login),
  KEY user_nicename (user_nicename)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;