Wordpress

Wordpress can be installed such that a common installation is used by several Web sites. To do this, first get a copy of the install file from http://wordpress.org/download/. Untar the install file and rename the install directory to match the version number:

     tar -xvzf wordpress-a.b.yy.tar.gz
     mv wordpress wordpress-a.b.yy

Create a shared top level directory in the Web tree and copy all of the Wordpress files there:

     mkdir /var/www/Blog
     cp -r wordpress-a.b.yy/* /var/www/Blog
     mv /var/www/Blog/wp-config-sample.php /var/www/Blog/wp-config.php

Hack the config file to include the database name, user name and password. Add conditional code to select the database table prefix, depending on which Web site is invoking the blog. The table prefix should be a unique prefix for each of the Web sites so that all of the blogs can coexist in one database:

     define('DB_NAME', 'Wordpress');
     define('DB_USER', 'Wordpress');
     define('DB_PASSWORD', 'secretpassword');
     if (preg_match('/KittyBlog/', $SERVER['DOCUMENTROOT']))
       $table_prefix  = 'kb_';
     else die('Unknown blog name!  Check for your document root (' .
       $SERVER['DOCUMENTROOT'].') in wp-config.php');

Create a symbolic link from a blog directory under the Web site's top level HTML directory to the Wordpress shared top level directory:

     ln -s /var/www/Blog /var/www/KittyBlog/html/blog

If you haven't already done so, add a virtual host to the Apache config file for the Web site. Point the PHP include path at the blog directory, if you are going to be invoking the blog via a Web page at another level (see index.php below):

/etc/httpd/conf/httpd.conf:

.

       .

##
## Kitty Blog Virtual Host Context
##
Listen 8680

     <VirtualHost default:8680>
     #
     #  Document root directory for KittyBlog html.
     #
     DocumentRoot "/var/www/KittyBlog/html"
     <Directory "/var/www/KittyBlog/html">
         Options +Includes
     </Directory>
     #
     #  Blog directory used to point to Wordpress.
     #
     Alias /blog "/var/www/KittyBlog/blog"
     #
     # Define the properties of the directory above.
     #
     <Directory "/var/www/KittyBlog/blog">
         AllowOverride None
         Options FollowSymLinks
         Order allow,deny
         Allow from all
     </Directory>
     #
     #  Directories defined in the main server that we don't want people to see
     #  under this port.
     #
     Alias /manual "/var/www/KittyBlog/limbo"
     Alias /doc "/var/www/KittyBlog/limbo"
     #
     # ScriptAlias: This controls which directories contain server scripts.
     # ScriptAliases are essentially the same as Aliases, except that
     # documents in the realname directory are treated as applications and
     # run by the server when requested rather than as documents sent to the
     # client.  The same rules about trailing "/" apply to ScriptAlias
     # directives as to Alias.
     #
     ScriptAlias /cgi-bin/ "/var/www/KittyBlog/cgi-bin/"
     #
     # Define the properties of the directory above.
     #
     <Directory "/var/www/KittyBlog/cgi-bin">
         AllowOverride None
         Options ExecCGI FollowSymLinks
         Order allow,deny
         Allow from all
     </Directory>
     #
     # Point the PHP include path at the blog directory.  This lets us include
     # stuff without worrying about where we are running from.
     #
     php_value include_path ".:/var/www/KittyBlog/blog:/usr/local/lib/php"
     </VirtualHost>
          .
          .
          .

Create the MySQL database that will be used by all of the Wordpress blogs (change the secretpassword to something really super secret):

     $ mysql -u adminusername -p password
     mysql> create database Wordpress;
     mysql> grant all privileges on Wordpress.* to Wordpress@localhost
                  identified by "secretpassword";
     mysql> flush privileges;
     mysql> quit

Invoke the blog from the blog directory (this is very important). For example:

     http://192.168.1.1:8680/blog/

Follow the link to the install page and set up the blog.

If you'd like to invoke the blog from somewhere else (e.g. the top level of the html directory), copy the index.php file from the Web site's blog directory to the top level directory (or elsewhere):

     cp /var/www/KittyBlog/blog/index.php /var/www/KittyBlog/html

Because PHP is brain dead, you will have to hack this file to load from the library list:

     require('wp-blog-header.php');

This will use include_path set up in the httpd.conf file to find the relative include in the blog directory via the library search list. Users can run the blog via the blog directory or the copied file. You can also invoke the blog from any other PHP file in this manner or you can link to it in the blog directory.

Finish off your blog by choosing a theme. Log in to the blog as the admin user and, from the Dashboard page, choose the Appearance menu item. You'll be shown a list of themes that you can choose from. Pick the one that you like and you're in business.

If you'd like a custom theme (i.e. you'd like to hack the page heading, author's picture, links, etc., etc.) you can easily make one up. Begin by selecting one of the many, many Wordpress templates that are available on the Internet or one of the standard templates that come pre-installed. Create a new theme directory under your common blog directory, copy the theme to it, and give it the proper permissions:

     mkdir /var/www/Blog/wp-content/themes/KittyBlog
     cp -R /my/themes/crazy-kitty/* /var/www/Blog/wp-content/themes/KittyBlog
     chown wordpress:joe -R /var/www/Blog/wp-content/themes/KittyBlog
     chmod g+w -R /var/www/Blog/wp-content/themes/KittyBlog

Hack the style.css file in the custom theme directory to identify the new theme (Wordpress uses the comments at the top of this file to identify it, when it is displayed to the administrator, to assist them in choosing which theme they want). You hacks should look something like this:

style.css:

     /*
         Theme Name: Kitty Blog
         Theme URI: http://www.kittyblog.com/
         Description: A theme based on Kubrick v1.2.5 for WordPress 2.x that \
                      includes a gray head on a light gray background in the \
                      space above the page.  Title is fixed at "Kitty Blog".  \
                      There is room for an author description.
         Version: 2.0 rev. g
         Author: Kitty Kat
         Author URI: http://www.kittyblog.com/
     */
     /*
         This is the "Kitty Blog" Template For WordPress 2.x
         designed by Kitty
         http://www.kittyblog.com
      This template is based entirly upon the amazing work of 
      Michael Heilemann which inluces his source completely.
      said source:
      Kubrick v1.2.5  for  WordPress 1.2
      http://binarybonsai.com/kubrick/
    
      For "Kitty Blog" layout and design support, please contact
      http://www.kittyblog.com