Blog With XAMPP and WordPress

Want to blog? Grab XAMPP and WordPress and just add prose!

If you haven’t noticed, everyone is blogging. From your college roommate to your chief executive, blogs are quickly becoming the preferred way to build personal Web sites and communicate to the masses, on any subject you can possibly write about. Alas, I too am a blogger, and you can find my own mindless drivel about food (you really want to know what chili dog I ate last week, right?), technology, and science fiction (doesn’t everyone have juvenile fantasies about Battlestar Galactica’ s Number Six?) at http://www.offthebroiler.com.

Many people choose to host blogs on free sites such as MovableType.com, Blogger, and TypePad, but this month, let’s look at how to deploy blog software on either your desktop PC or a workgroup server. Why? Well, why not?
Actually, there’s a much better reason than just” why not?”. By installing the blog software on a system that you have administrative control over, you’ve got a lot more flexibility with what you can do with it. For example, many popular blog hosting services, such as WordPress.com and the ones I mentioned above, give you limited control over your blog templates (the web pages that form the aesthetics and layout of the site) and don’t allow you to run custom external scripts or even run Web advertising banners. Also, you may be behind a corporate firewall and want to create a blog to serve out to your internal network, such as via a corporate newsletter or Intranet-related blog application, such such as food reviews of your cafeteria’s lunch menu.(” Wednesday’s chipped beef on toast was over-salted and prompted severe gastrointestinal consequences later on that afternoon. However, the lime Jello had a pleasant texture and the artificial citrus flavoring had a nice aftertaste.”)
It shouldn’t be a surprise, however, that blog software also requires some fairly complicated software to be installed, and most people choose to go the hosted route despite its limitations because it’s the easy way to get a blog up and running. But there’s a solution to getting Apache, PHP, and the MySQL database running without reading a pile of O’Reilly books: it’s called XAMPP.

XAMPP Me!

XAMPP is essentially a complete Apache/PHP/MySQL stack, that’s completely pre-built, requires no special configuration on your desktop system, and runs entirely self-contained in its own directory. You simply download the XAMPP software, unzip it to its own directory, and fire up the start-up script, and you’ve got a fully functioning Web server with everything you need to serve dynamic Web applications from your desktop PC. If you’re a web developer, its an absolute godsend.
The first thing to do is head over to the XAMPP Web site at http://www.apachefriends.org/en/xampp.html. In addition to a Linux version, XAMPP also offers flavors for Windows and Mac OS X. The former requires a few extra configuration steps; the latter is a simple download, install, and launch.
At the time of this writing, the current version of XAMPP for Linux was 1.5.4 and is available at http://www.apachefriends.org/download.php?xampp-linux-1.5.4.tar.gz. However, be sure to download the most current version.
After downloading the file to your home directory, open a terminal window and issue the following command:
# tar xzvf xampp-linux-1.5.5.tar.gz
You should now have a directory called lampp in your home directory. (XAMPP used to be called LAMPP, but there were some trademark issues, so the software was recently renamed, but the directory structure and names stuck.)
Next, issue a su root from the terminal to gain superuser privileges and launch your favorite file manager, such as Konqueror or Nautilus. Then drag the entire lampp directory into your /opt directory within the root filesystem. While XAMPP has no problems running within your home directory, I like to move it to /opt/lampp, because should you ever need to move the software onto a different machine, the /opt directory is universal to every Linux box and any we bsites you build that depend on filesystem paths won’t break.
Next, start XAMPP:
# /opt/lampp/lampp start
You should see a series of messages that XAMPP has started:
Starting XAMPP for Linux 1.5.4...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.
You should now be able to open a web browser to http://localhost/xampp or http://127.0.0.1/xampp or connect to your workstation’s IP address via a remote web browser and view the local XAMPP home page and test the demo applications.
XAMPP is now running as a background process, so its okay to close down the terminal windows if you want. The next time you reboot your workstation, however, you’ll want to start the script up again. Before shutting down your workstation, simply make sure you issue a /opt/lampp/lampp stop to gently shut down all of the server processes.

Creating a Blog Database and DB user account

To get the blog software to run, let’s create a database in MySQL first. Now, now, sit back down. Don’t go running away and screaming, XAMPP makes this easy.
From your local XAMPP for Linux home page, click on phpMyAdmin from the Tools menu. You should then be presented with a new browser window and the phpMyAdmin user interface. Onscreen, you should see a text entry box that says” Create new database”. Type in wordpress and click on the Create button. Congratulations, you’ve created a database.
Next, you must have create a user to own that database. On the left hand column of the browser window, you should see an icon of a house (home page). Click on the icon to return to the main phpMyAdmin screen. Underneath the Home Page icon there’s a drop down box for Database; pick wordpress.
From the home screen again, click on Privileges. You’ll then see the list of MySQL authorized users. Click on the Add a New User link. You should then get the” Add a New User” Page. Under user name, keep the” Use text field” default from the drop down and enter wordpress in the text entry box. Under Host, change the drop down selection to Local. The software automatically changes the hostname to localhost. Under password, keep the” Use Text Field” drop down defaults and enter a password. Re-type the password in the entry box below.In the Global privileges section, click on Check All. Finally, at the bottom of the screen, click on Go.
Great! You’re now ready to install your blog software.

Getting and Installing WordPress

WordPress is by far the most powerful and extensible Open Source blog software available today, and its also quite easy to install, especially since XAMPP is already up and running.
Fire up a web browser and head over to the WordPress Web site at http://www.wordpress.org. (Pay attention to the .org. It provides the source code to WordPress. WordPress.com is where you can register for a free blog account if you want them to host a blog for you. Does your mom or your best buddy want a blog? Send them over there.) You’re installing WordPress locally.
At the time of this writing the current version of WordPress was 2.0.4. Click on” Download” from the top-right of the wordpress.org home page, and choose Download.tar.gz. As with the XAMPP download, you’ll want to fire up a terminal window and un- tar the archive:
# tar xzvf wordpress-2.0.4.tar.gz
You should now have a wordpress directory below your home directory. Again, with your favorite file manager, move this entire directory to /opt/lampp/htdocs/, the Web site document root for XAMPP’s Apache implementation.
Next, open the WordPress configuration file, /opt/lampp/htdocs/wordpress/wp-config-sample.php in a text editor such as kwrite or gedit. It should appear like the following:
<?php
define(’DB_NAME’, ’wordpress’);
define(’DB_USER’, ’wordpress’);
define(’DB_PASSWORD’, ’mypassword’);
define(’DB_HOST’, ’localhost’);
$table_prefix = ’’;
define (’WPLANG’, ’’);
define(’ABSPATH’, dirname(__FILE__).’/’);
require_once(ABSPATH.’wp-settings.php’);
?>
I removed the comment fields and replaced the variable names to correspond with the database name and the database user name and password that was created earlier. The table_prefix field should be left empty; it’s only needed for multi-blog WordPress installations.
Save the file as /opt/lampp/htdocs/wordpress/wp-config.php and exit the editor.
Next, connect with a web browser to http://localhost/wordpress/wp-admin/install.php. You will be guided thru a short installation process that initializes the database, and you’ll be issued an initial admin account password. Write down the password!
You should now be able to connect to your blog administration interface via http://localhost/wordpress/wp-admin or http://my.ip.address/wordpress/wp-admin. To make WordPress your default home page for http://localhost and for your default IP address, simply change the /opt/lampp/htdocs/index.html file to reflect content=”0,url=/wordpress/” instead of content=”0,url=/xampp/”.
If you’re using a residential gateway router such as a Linksys, you can make your blog Internet-accessible by going into your router’s web interface and enabling the DDNS (Dynamic DNS) configuration and HTTP TCP port 80 redirection. You’ll also want to go over to the DynDNS.org website and create a free, dynamic DNS account. DynDNS.org allows you to choose from a number of pre-configured domain names, or will allow you to use your own domain name for a extra charge. (Make sure your ISP permits you to accept incoming traffic, too. Violating your ISP’s terms of use can endanger your connectivity.)

Extra Stuff You’ll Want

In addition to the default WordPress configuration, there are a number of things you’ll probably want to make your life easier and your blog prettier.
The first is WordPress plugi-ns. Plug-ins enhance the basic features of WordPress and extend it to do other things. Plug-ins are distributed as .zip files of directories that you unpack and copy over to your /opt/lampp/htdocs/wordpress/wp-content/plugins/ directory. Once in place, you can enable each plug-in under the” Plugins” tab in the administrative interface.
The plugins to install and enable right away include:
*wp-cache is a high-performance page cache that creates a static file from pages in your WordPress database. It really increases the performance of your blog, as WordPress is database-intensive. Download it at http://mnm.uib.es/gallir/wp-cache-2/.
*With the Flickr Gallery plug-in, you can display galleries of all your photographs, grouped by tags, integrated right into your blog, and also select photos from your Flickr photostream using the WordPress posting interface. Download it at http://tantannoodles.com/toolkit/photo-album/.
*Sidebar Widgets, available from http://automattic.com/code/widgets/, gives you the extra features that are built into the hosted blogs at WordPress.com, such as the ability to display RSS feeds from your favorite sites, and custom text boxes that you can cut and paste HTML and Javascript code segments like Google Adsense, Amazon affiliate boxes, and Google Analytics counters.
For example, in my demo site, I have the Flickr Zeitgeist (http://www.flickr.com/fun/zeitgeist/) , a flash application that displays my Flickr photo stream. To add the feature, all I did was cut and paste a few lines of code from the Flickr Zeitgeist page into a sidebar widget, and presto, it works! Widgets are enabled in the” Presentation” menu in the WordPress administrative interface.
*Themes are templates for your blog that allow you to alter the aesthetics of your pages, such as custom colors and logos. You can get them at http://themes.wordpress.net/. Be sure to click on” widget ready” when sorting themes to look at, as regular WordPress themes don’t work with widgets.
I’m particularly partial to the” blogtxt” theme (http://themes.wordpress.net/columns/2-columns/484/blogtxt-12/) because its simple, black text on a white background, is Widget-enabled, and is easy to customize.
*If you’re a WordPress and Flickr addict, the best and easiest way to manage both and have a integrated browsing and blog posting experience is to get Flock, a souped-up, tweaked-out version of Firefox, with all sorts of built-in stuff like the ability to view your Flickr photostream, upload photos to Flickr, read RSS feeds, and make blog posts. Check it out at http://www.flock.com.
With a little software and even less time, you can blog to your heart’s content.

Got any interesting ideas for” On the Desktop?” Email Jason Perlow at class="emailaddress">perlow@linux-mag.com.

Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62