August 23, 2006

Make your intranet more productive with XAMPP

Author: Mayank Sharma

A phenomenal amount of information is being managed by open source content management systems (CMS), wikis, and blogs. However, most of these content management systems work on the popular but difficult to configure LAMP (Linux, Apache, MySQL, PHP) stack, which makes setting up one fall within an administrator's domain. You can simplify your hosting tasks by turning to XAMPP, a full-featured Apache, MySQL, PHP, and Perl stack that works on Linux, Windows, Mac OS X, and Solaris. It can give you a fully integrated server environment within minutes.

The current version of XAMPP, 1.5.3a, is a 51MB package that includes Apache 2.2.2, MySQL 5.0.21, PHP 5.1.4 and 4.4.2, Perl 5.8.7, phpMyAdmin 2.8.1, Webalizer 2.01, and several other libraries, modules, and utilities that ensure XAMPP will work with any open source CMS. Download the package and install it from root with a command like sudo tar zxvf xampp-linux-1.5.3a.tar.gz -C /opt. After that, the command /opt/lampp/lampp start as root should start the various sub-servers. Pointing your browser to http://localhost will take you to the XAMPP control panel.

Securing XAMPP

XAMPP isn't designed for rolling out on a production server. Its goal is simply to ensure everything works, which makes it very insecure. For example, the MySQL admin has no password, the phpMyAdmin program and the MySQL daemon are accessible from over the network, and MySQL and Apache run under the same user. If you are using our XAMPP installation for a non-sensitive deployment, leaving these "holes" open won't do any harm. But some content management systems are designed to not work in a no-password environment. As a bare minimum, I'd recommend you assign the MySQL user a password.

With the server running, as root run /opt/lampp/lampp security. This brings up the quick security check. Keep answering no until you are asked to assign a password to the MySQL root user. To assist with the example installations below, let's enter the password as "xampp." You can assign passwords to other users and areas of XAMPP as well and fool around with the settings if you like. If you end up with a non-functional installation, as root, simply rm -rf /opt/lamp/, which will remove XAMPP so you can start afresh.

While you should be OK, if you need to look at the configuration files, Apache's is /opt/lampp/etc/httpd.conf, MySQL's is /opt/lampp/etc/my.cnf, PHP's is /opt/lampp/etc/php.ini, and phpMyAdmin's is /opt/lampp/phpmyadmin/config.inc.php.

Let's try to hook up our XAMPP installation with two content management systems, WordPress and MediaWiki.

Installing WordPress

WordPress is a popular blogging application that's easy to use and customize. In a corporate environment it can be used to post various kinds of documents, classified by department or usage, which can searched and retrieved over the network with a click.

Download the ~500KB WordPress tarball and as root unpack it under /opt/lampp/htdocs with:

tar zxvf latest.tar.gz -C /opt/lampp/htdocs

Now proceed with the normal installation instructions. To create a database for WordPress to use, head over to the phpMyAdmin tool under the XAMPP control panel (http://localhost/phpmyadmin). By default this should log you in without prompting for a password. Look for the "Create new database" field, enter "wordpress" (without the quotes), and click on the Create button. Continue by renaming the wp-config-sample.php file to wp-config.php and then, as instructed, edit it to fill the database details. In our case, the DB_NAME is wordpress, the DB_USER is root, the DB_PASSWORD is xampp, and DB_HOST is localhost.

Finally, head over to http://localhost/wordpress, and follow the instructions.

Installing MediaWiki

MediaWiki is the same wiki software that the popular free encyclopedia Wikipedia uses. Within an organization, it can serve as a bulletin board to post circulars to, and teams can use it to track their respective projects' status.

As before, download the 3.1MB MediaWiki tarball and unpack it as root under its own /opt/lampp/htdocs directory:


tar zxvf mediawiki-1.7.1.tar.gz -C /opt/lampp/htdocs
cd /opt/lampp/htdocs
mv mediawiki-1.7.1 mediawiki

As per the INSTALL file under this directory, before running the installation script make the "config" directory writable with chmod a+w /opt/lampp/htdocs/mediawiki/config. Then point your browser to http://localhost/mediawiki, which will direct you to the setup page. The important settings on this page are under "Database config." Select MySQL as the database type and leave localhost as your database host. Give root as DB username and xampp as the password, and leave the database name as wikidb. Repeat xampp as the superuser account's password, which will create the database for you once you click on the Install MediaWiki button. Finally, as it directs, move the config/LocalSettings.php file into the parent directory with mv config/LocalSettings.php /opt/lampp/htdocs/mediawiki/. It's also advisable to remove the config directory with rm -rf /opt/lampp/htdocs/mediawiki/config.

Your wiki should now be running and accessible at http://localhost/mediawiki.

While XAMPP is insecure and was designed primarily for testing purposes, it can be used safely for managing content within the controlled environment of an internal network. Setting it up is child's play. If you have always wanted to try a CMS to make your work more productive, try using it with XAMPP.

Category:

  • Open Source
Click Here!