350 likes | 367 Views
Installing and Configuring WordPress. Richard Boakes rjb@boakes.org. Introduction. A talk based on experiences A view from orbit with zoom where necessary A necessarily incomplete view covering just the bits I use avoiding the obvious An invitation to get involved. Introduction (You).
E N D
Installing and Configuring WordPress Richard Boakes rjb@boakes.org
Introduction • A talk based on experiences • A view from orbit • with zoom where necessary • A necessarily incomplete view • covering just the bits I use • avoiding the obvious • An invitation • to get involved
Introduction (You) • You are: • a) Poised to install this second • b) Planning on installing soon • c) Might install one day • d) Just vaguely interested • e) Catching up on email
Agenda Key Features Reasons to use WP Installing WordPress Pre-Requisites Getting the code The Famous 5-minute Install Updating WordPress Content Backups Extending WordPress Finding and Using Plugins Particularly Useful Plugins Creating and Extending Plugins Closing thoughts Integrating with WordPress The Future of WordPress
Key Features An editor For weblog articles & For static pages. Runs on many common hardware & OS combinations. Win32/64, Linux, Solaris Adheres to open standards e.g. XHTML, RSS, ATOM, CSS, XML-RPC. Sound program architecture. Easy to maintain. Easy to adapt. Easy to extend. Handles all visitor interaction Including comments, trackbacks & pingbacks. Sanitized and Salted. Robust anti-spam solutions. Over 3 yrs & 300,000 spams. None were published. Export and Import mechanisms Easy to backup and restore. Easy to move your data if you don’t get on with it.
Pre-Requisites • Required • Web Server Apache – v2 • with rewrite module enabled • PHP – v4.3 • MySQL –v4.0 • Optional • a subversion client
Decide where you are working • Work on the server, over SSH • Great when hacking about & setting up. • Only mildly scary on a live service • Take temp copies for safety • Work on a client • Great if it’s a private or local site • For servers: • Manually upload using sftp, etc. • Use sync tool
Locate your httpd.conf • Windows • C:\Program Files\Apache Group\Apache2\conf • Linux • /etc/apache2/httpd.conf • Mac OS X • /etc/apache2/httpd.conf
Remember your DocumentRoot • DocumentRoot is defined in httpd.conf • common values are: • /home/www/yourserver/htdocs • /Library/WebServer/Documents • You’ll need it later
Configure httpd.conf • Enable PHP (Win) • LoadModule php5_module • "C:/Program Files/PHP/php5apache2.dll“ • Enable PHP (Linux) • LoadModule php5_module libexec/apache2/libphp5.so • Enable PHP index pages • DirectoryIndex index.php index.html
Configure httpd.conf • Allow .htaccess override • <Directory /> • Options FollowSymLinks • AllowOverride All • Order deny,allow • Deny from all • </Directory>
Configure PHP • On Windows • The MSI does everything for you • you need to specify the MySQL extension • On Mac OS X • An extra step is sometimes needed • cp /etc/php.ini.default /etc/php.ini • sudo chmod +w /etc/php.ini • sudo /usr/sbin/apachectl restart • On linux • ??? (lets see what breaks)
Locate your MySQL • Windows • C:\Program Files\MySQL\MySQL Server 5.0\bin\ • Linux (apt-get) • /usr/bin/ • Mac OS X • /usr/local/mysql-5.1.32-osx10.5-x86/bin/ • Got root? find it with • sudo find / –name mysql
Configure MySQL • Login to mysql • mysql -u adminusername -p • Enter password: • Create a database for wordpress to use • mysql> CREATE DATABASE mydbname; • Query OK, 1 row affected (0.00 sec)
Configure MySQL • Create a DB user for WordPress • mysql> GRANT ALL PRIVILEGES • ON mydbname.* • TO “myusername"@“myhostname“ • IDENTIFIED BY “mypassword"; • Query OK, 0 rows affected (0.00 sec) • Force the changes through • mysql> FLUSH PRIVILEGES; • Query OK, 0 rows affected (0.01 sec) • mysql> EXIT
Get the code • either • download the code from http://wordpress.org/download/ • unpack it to your DocumentRoot • or • Navigate to your DocumentRoot, and svn co http://svn.automattic.com/ wordpress/tags/2.7.1 wordpress
Configure WordPress • Copy the sample config file • cp wp-config-sample.php wp-config.php • Edit your new config file • define('DB_NAME', mydbname'); • define('DB_USER', myusername'); • define('DB_PASSWORD', mypassword'); • define('DB_HOST', ‘myhostname'); • … and make up 4 random auth keys…
The moment of truth… • Visit • http://yourserver/wordpress/
Congratulations! • You up and running (hopefully) • …but • Vulnerabilities arise • so update regularly. • Things go wrong • so make backups
Updating WordPress! • When an update is released • either • download the code • unpack it • copy it into your existing folder • or • Use subversion to switch to the latest stable tagged build • i.e. svn switch http://svn.wordpress.org/the/tagged/version
Content Backups • Use mysqldump to backup • mysqldump.exe • -uroot –ppassword • --all-databases >c:\backup.sql • And recover using mysql • mysql.exe -uroot –ppassword <c:\backup.sql • Or use a plugin…
Admin Screen • http://yourserver/wordpress/wp-admin
Pretty Permalinks • Default URLs are not descriptive • http://example.com/?p=1 • Pretty Permalinks are better • http://example.com/helloworld • Open the Settings/Permalinks • Select “Custom Structure” • Enter /%postname% • Save changes
Quick notes on publishing • Adding content • Adding tags • Editing a published article • Renaming a published article
Widgets • Add handy things to your pages • In the admin interface • Open Appearance / Widgets • Add widget plugins for more capabilities • e.g. Twitter
Finding and Using Plugins • How to find • http://wordpress.org/extend/plugins • Search Engines • How to install • Web • Automated installation • Web upload • Command line • Manual installation • SVN installation
Particularly Useful Plugins Anti-spam Akismet (installed) BadBehaviour Anti-slashdot WPSuperCache Identity OpenID
Creating and Extending Plugins • Source Control • Subversion over HTTP • The Plugin Format • Descriptive Header • PHP Code • Actions (aka Events, Hooks, Callbacks) • do_action(“my_action”); • add_action(“action_name”, “function_name”)’
A NeSC Plugin <?php /* Plugin Name: NeSCPlugin URI: http://nesc.ac.uk/made/up/url Description: This adds the word NeSC to every page on the admin screen Author: Rich Boakes Version: 0.1 */ function nesc_tagline() { echo "<p class='floaty'>" . wptexturize( "NeSC" ) . "</p>"; } function nesc_css() { echo "<style type='text/css'>.floaty { position: absolute; top: 5em; right: 5em; }</style>"; } add_action('admin_head', 'nesc_css'); add_action('admin_footer', 'nesc_tagline'); ?>
Integrating with WordPress • XML-RPC interface • editing articles, • publishing, • moderating comments • For example: • iphone.wordpress.com
The Future of WordPress • 3.6million downloads of v2.7 • GNU Public License v2 • Three releases per year • features are voted for by the user community • Further Help • WordCampUK • Cardiff, 18-19 July 2009 (a weekend) • http://uk.wordcamp.org • Web • http://wordpress.org • IRC • #wordpress
Where to find out more • WordCampUK • Cardiff, 18-19 July 2009 (a weekend) • http://uk.wordcamp.org • Web • http://wordpress.org • IRC • #wordpress • Or ask me • rich@boakes.org