WordPress as CMS

Introduction

This is a simple HOWTO on installing WordPress 3.0 on a Linux box running a high-performance web server and the MySQL database server with the bbPress (forum) and BuddyPress (social n/w) modules.

Setup

SMTP server

So WordPress can send forgotten passwords.

MySQL

  1. apt-get install mysql-server mysql-client
  2. Provide password for user root@localhost
  3. Create user specifically for WordPress database and grand all privileges:
    1. mysql> CREATE DATABASE wordpressdb;
    2. mysql> CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'test123';
    3. mysql> GRANT ALL PRIVILEGES ON wordpressdb.* TO 'wordpress'@'localhost' WITH GRANT OPTION;
    4. mysql> SHOW GRANTS FOR 'wordpress'@'localhost';
    5. mysql> EXIT
    6. # mysql -u wordpress -p
    7. mysql> EXIT

If you need to start over, remove the WordPress database in MySQL:

  1. DROP DATABASE wordpressdb;
  2. DROP USER 'wordpress'@'localhost';

Web server

WordPress

  1. Download and unzip the WordPress application:

    cd /tmp
    wget -c http://wordpress.org/latest.tar.gz
    tar -xzvf latest.tar.gz
     
  2. mv ./wordpress /var/www/

    Or if the web server is on a remote host:

    apt-get install ncftp
    ncftpput –R –v –u "username" ftp.server.com /remotedir /localdir
     
  3. chown /var/www/wordpress? www-data.www-data by default
  4. cd /var/www/wordpress, cp wp-config-sample.php wp-config.php
  5. vi wp-config.php (instructions)
  6. Remove wp-config.php for security reason?
  7. Aim your browser at http://wp-server/wp-admin/install.php
  8. Write down admin password

Use suPHP so that WordPress runs with a user's username instead of the server's default shared username.

FAQ Installation

FAQ Troubleshooting

bbPress

  1. In MySQL, it's easier to just re-use the database + user/password that is used by WordPress. WordPress and bbPress use different tables with different prefixes, so data don't get mixed.
  2. cd /tmp
  3. wget -c http://bbpress.org/latest.tar.gz -O bbpress.latest.tar.gz
  4. tar xzvf bbpress.latest.tar.gz
  5. mv bbpress /var/www/wordpress/ (ie. bbPress must be underneath WordPress. Some documents say it's OK to install bbPress in the same directory as WordPress, although I don't know if it's safe)
  6. http://mysrv/wordpress/bbpress/
  7. Follow the instructions to have a working bbPress site.

If you want to start over:

  1. rm /wordpress/bbpress/bb-config.php
  2. In MySQL: drop table bb_ tables?

Integrating WordPress and bbPress

Based on Integration with WordPress and WP to BBP/Integration, here's how to integrate WordPress and bbPress:

  1. vi /wordpress/wp-config.php, comment out everything between lines 45-48 and paste the following (in "vi": 45G -> go to line 45):

    /*
    define('AUTH_KEY',         'put your unique phrase here');
    define('SECURE_AUTH_KEY',  'put your unique phrase here');
    define('LOGGED_IN_KEY',    'put your unique phrase here');
    define('NONCE_KEY',        'put your unique phrase here');
    define('AUTH_SALT',        'put your unique phrase here');
    define('SECURE_AUTH_SALT', 'put your unique phrase here');
    define('LOGGED_IN_SALT',   'put your unique phrase here');
    define('NONCE_SALT',       'put your unique phrase here');
    */
    define('AUTH_KEY',         '+O=v1]Bg7Ka=2-#?y T=e1-?U-+6lhDvBsbo;|Acb4diI0R}eH`n0oZ+?~Ll!>0(');
    define('SECURE_AUTH_KEY',  'V]PGk-ZD>.6j~qO~G2s@WVJJ^*EZn:V{ggTlsN=R F#8(Cfz(-%gk6,/C52dvBNc');
    define('LOGGED_IN_KEY',    '&ZO~DvB=hx1&MBYVM`N(+ufW$^b0K8hM+YsMtK!8)la-iNe-zKQ1RQr.rQbMVF76');
    define('NONCE_KEY',        '|&*&@*)Q1#h^it0M* 6]c-Kp@J1}S?sG{|pbj#flZ[)VU]xc*wX2-~RXY{^7SBzg');
    define('AUTH_SALT',        '_Q*x[os|9hE)8B|Cg`K?wZmf,]kkkXHe{>Ym*42P;:%ktJ3:Wx+:MqI4THO,FNUg');
    define('SECURE_AUTH_SALT', 'Sd=;;.iBJ,C0?c@[7t*K0?3-P)xp(ig]4Z; H1%6|)V`G|TRRBd^J)G?!`UqOB#}');
    define('LOGGED_IN_SALT',   ':.c@V4{WJiIacp{VSIq?/eEk3nc;)`mKv&rny}t^e;*NT`;8JjBgHMbJB,9R1N=<');
    define('NONCE_SALT',       'btp5*CFP2:=k9Z(B[_FBO4p5w+y|+t,[Q:qIk)R:5>PBzVR-E;]?BW/%n(B~T]6r');


    Save wp-config.php but leave it open.
     
  2. In another terminal window, vi /wordpress/bbpress/bb-config.php, and 41G: Comment out the lines between BB_AUTH_KEY and BB_NONCE_KEY, paste the same instructions and prepend each line with BB_: 

    define('BB_AUTH_KEY',         '+O=v1]Bg7Ka=2-#?y T=e1-?U-+6lhDvBsbo;|Acb4diI0R}eH`n0oZ+?~Ll!>0(');
    define('BB_SECURE_AUTH_KEY',  'V]PGk-ZD>.6j~qO~G2s@WVJJ^*EZn:V{ggTlsN=R F#8(Cfz(-%gk6,/C52dvBNc');
    define('BB_LOGGED_IN_KEY',    '&ZO~DvB=hx1&MBYVM`N(+ufW$^b0K8hM+YsMtK!8)la-iNe-zKQ1RQr.rQbMVF76');
    define('BB_NONCE_KEY',        '|&*&@*)Q1#h^it0M* 6]c-Kp@J1}S?sG{|pbj#flZ[)VU]xc*wX2-~RXY{^7SBzg');
    define('BB_AUTH_SALT',        '_Q*x[os|9hE)8B|Cg`K?wZmf,]kkkXHe{>Ym*42P;:%ktJ3:Wx+:MqI4THO,FNUg');
    define('BB_SECURE_AUTH_SALT', 'Sd=;;.iBJ,C0?c@[7t*K0?3-P)xp(ig]4Z; H1%6|)V`G|TRRBd^J)G?!`UqOB#}');
    define('BB_LOGGED_IN_SALT',   ':.c@V4{WJiIacp{VSIq?/eEk3nc;)`mKv&rny}t^e;*NT`;8JjBgHMbJB,9R1N=<');
    define('BB_NONCE_SALT',       'btp5*CFP2:=k9Z(B[_FBO4p5w+y|+t,[Q:qIk)R:5>PBzVR-E;]?BW/%n(B~T]6r');
    /*
    define( 'BB_AUTH_KEY', 'blah' );
    define( 'BB_SECURE_AUTH_KEY', 'blah' );
    define( 'BB_LOGGED_IN_KEY', 'blah' );
    define( 'BB_NONCE_KEY', 'put your unique phrase here' );
    */


    Save bb-config.php but leave it open.
     
  3. Log out of WordPress and bbPress, and clear the cache of your web browser (CTRL-SHIFT-Del in Google Chrome)
  4. Log into WP as admin (/wordpress/wp-admin/). In the Dashboard section on the left, select Plugins > Add New
  5. Search for "bbpress", and select "bbPress Integration": Install and activate the plugin.
  6. In the Settings section on the left, select bbPress Integration.
  7. Fill out the information:

    bbPress URL = http://192.168.0.8:8787/wordpress/bbpress
    Select "WordPress MU" > Save Changes
     
  8.     From the grey box at the bottom of the page ("COOKIEHASH", etc.), copy information into the clipboard
  9. Go back to wp-config.php that you left open above, go to line 16 (before it says "// ** MySQL settings"), and paste clipboard. Save and close file.
  10. Go back to bb-config.php, and paste the same data at line 13 (before it says "// ** MySQL settings"). Save and close file.
  11. The bbPress plugin is no longer needed: In the WP Dashboard, go back to the Plugins section, deactivate and delete bbPress Integration plugin.
  12. Clear cache in your web browser
  13. Log into bbPress (/wordpress/bbpress/) as admin, click on Admin at the top. In the Dashboard section on the left, open Settings > WordPress Integration: For "WordPress Administrator", pick "bbPress Key Master". Until you're comfortable with WordPress/bbPress, other items should be set to "bbPress Member". Click "Save Changes".
  14. Scroll down and make sure the "auth" cookie salt, "secure auth" cookie salt, and "logged in" cookie salt are not editable and have an icon of lock. If OK, continue to the next step; If NOK, go through this whole procedure again...

Deep Integration: Optional. Used so that bbPress will have access to WordPress' functions. In bb-config.php:

  1. At the very end of the file, right before ?>, add include_once('/your/absolute/path/to/wordpress/wp-load.php');
  2. Add require_once(dirname(__FILE__) . '/path/to/wp-load.php');
  3. Clear browser cache
  4. Log into your WP Dashboard and navigate to Plugins
  5. Delete the plugin "bbPress Integration"

More information:

 

Customizing

Now that the default site is up and running, here's the major things you might want to customize:

Adding favicon.ico

Adding icon left of title bar in homepage

Add bbPress for forums

Add BuddyPress for social networking

Disable comments on blog entries

Solid anti-troll solution for forums

Q&A

Can WP scale out?

Can the homepage be statically generated to reduce accesses to DB?

How to change the admin password?

Log on through /wp-login.php, choose Users in the left-hand menu > Users > admin > Scroll down to "New Password"

How to use FluxBB for forum?

http://www.develophp.org/2010/05/23/integrate-fluxbb-1-4-with-a-wordpress-site-part-1/

How to get the list of most popular plugins?

  1. http://wordpress.org/extend/plugins/
  2. "Highest Rated"
  3. "Search Plugins"
  4. "No results found." :-/

Resources

Books

Sites