The question shouldn’t be whether you’ve heard of Slashdot, but how often you visit. When you come across a site that’s so loaded with great Open Source information and discussions, it’s difficult not to make visiting it a regular part of your work routine. In addition to regular visitations, did you know that you could also use the entire structure behind Slashdot to create your own discussion forum? No purchasing, no licensing, no first-born children are necessary. The Slashdot structure is an open source application that you can download, install, use, and even modify. Think of what such a useful information and discussion site could mean to your users, customers, and vendors.

In this Daily Drill Down, I will show you how to install and configure this powerful discussion forum software. The instructions that are bundled with Slash are far less than detailed, so I will fill in the blanks to make the process easier. Once you get your own Slash server up and running, you’ll wonder how you ever managed without it.

Preinstallation set up
To make the Slash installation easier, you need to create a group named slash for all users related to Slash and create a user named slash by typing the following commands at the system prompt:
/usr/sbin/groupadd slash
/usr/sbin/useradd -g slash slash

Now, you are ready to move on to the Slash installation.

Installation
Slashcode requires that certain software be installed in order for it to function properly. You’ll need to have the following components up and running before installing and configuring Slashdot:

  • ·        Perl 5.005_03 or above
  • ·        MySQL 3.23 or above
  • ·        Apache 1.3.6 or above
  • ·        Mod_perl 1.21 or above
  • ·        Sendmail or another mail transport daemon

To show you how to set up each component for a Slashcode installation, I will walk through these software installations. Note that I am performing the entire installation as the root user.

MySQL
First, install MySQL by downloading the latest version from the MySQL Web site, which, as of this writing was version 3.23.49. This file will be placed in my home directory at /home/slowe/slash/mysql-3.23.49.tar.gz. Table A describes the steps for Installing MySQL.
Table A

Command Description
cd /home/slowe/slash Switches to the download directory for MySQL
gunzip ?dc mysql-3.23.49.tar.gz | tar xvf –
Extracts the source files from the MySQL distribution
cd mysql-3.23.49
Switches to the source directory
./configure –prefix=/usr/local/mysql
Configures MySQL to be compiled specifying the /usr/local/mysql as the MySQL directory
make
Compiles MySQL
make install
Installs the MySQL binaries in the specified location
cd scripts
Switches to the source scripts directory
./mysql_install_db
Sets up the initial MySQL databases
/usr/sbin/useradd mysql
Creates the MySQL user as specified during the MySQL setup
cd /var/lib/mysql
Switches to the MySQL database directory
chown -R mysql:root .
Assigns ownerships of the databases to the MySQL user
cd /usr/local/mysql/bin
Switches to the MySQL bin directory
pico safe_mysqld
Opens the MySQL startup script in the Pico text editor
Add the following two lines immediately before the “trap” statement:
TZ=GMT
export TZ
./safe_mysqld &
Starts MySQL in the background
/usr/local/mysql/bin/mysqladmin -u root password pw
Assigns a password ?pw? to the MySQL root user
/usr/local/mysql/bin/mysql -uroot -ppw
Starts the MySQL administrator
mysql> create database slash;
Creates a database from within the MySQL administrator to be used for the Slashcode application
mysql> GRANT all on slash.localhhost to “slash” identified by “pw”;
Creates a MySQL user named “slash” with a password of “pw”, as well as all privileges to the slash database

Perl
On my Red Hat Linux 7.2 server, Perl 5.6.0 is already installed. For most recent Linux servers, an acceptable version of Perl (5.005_03 or above) will already be installed. However, I highly recommend upgrading to Perl 5.6.1 before you even think about moving on to the next step. I attempted multiple installations using Perl 5.6.0 and CPAN insists on upgrading Perl at the end of the installation, rendering many of the installed libraries useless. If you upgrade to Perl 5.6.1 before moving on, you will find that the remainder of the installation goes much more smoothly.

Table B shows the easiest way to upgrade to Perl 5.6.1 using CPAN.

Table B
Command Description
perl -MCPAN -e shell Enters the Perl CPAN command shell
cpan> quit Exits CPAN
/sbin/init 6 Reboots the machine

After initially entering the CPAN command shell, you will be asked for configuration information. Accept all of the default answers, which should work fine for a Slash installation. After the setup, you may have to wait while CPAN downloads the Perl Bundle::libnet package and installs it. During this installation, you will be asked for geographic information and asked to pick FTP servers from a list. At this point follow the instructions on the screen. In my case, the Bundle::libnet package was upgraded, followed by the Perl upgrade. The Perl upgrade from 5.6.0 to 5.6.1 took some time, and I had to answer questions about my installation.

Apache and mod_perl
Installing MySQL and Perl for Slash was fairly simple. Apache and mod_perl, which is the Apache module for Perl, is another story. Slashcode requires a specific set of installation steps for these two components in order to function properly.

First, download Apache. As of this writing, the latest 1.x version of Apache is 1.3.24 and the file name is apache_1.3.24.tar.gz, which I have saved in /home/slowe/slash. The mod_perl 1.26 (mod_perl-26.tar.gz) file also needs to be downloaded. The mod_perl file is also placed in /home/slowe/slash.

After this is done, carefully follow the steps shown in Table C (substituting your own directory for mine). This installation looks very complex because it is. Unfortunately, without running all of these steps, Slashcode will never work.
Table C

Command Description
cd /home/slowe/slash Switches to my download directory
gunzip -dc apache_1.3.24.tar.gz | tar xvf –
Unpacks the Apache source archive
gunzip -dc mod_perl-1.26.tar.gz | tar xvf –
Unpacks the mod_perl source distribution
cd mod_perl-1.26
Switches to the mod_perl directory
perl Makefile.PL \
APACHE_SRC=/home/slowe/slash/
apache_1.3.24 DO_HTTPD=1 \
USE_APACI=1 PERL_MARK_WHERE=1 EVERYTHING=1 \
APACHE_PREFIX=/usr/local/apache
Runs the mod_perl configuration program, which also compiles Apache

Notice that I had to specify the location of the Apache source, as well as the Apache installation directory (apache_prefix).

make
Compiles Apache and mod_perl
make install
Installs the Apache and mod_perl binaries
perl -MCPAN -e shell

Enters the Perl CPAN command shell

You will be asked for configuration information. (Generally, accepting the default answers works fine for Slash installations.) After the setup, you may have to wait while CPAN downloads and installs the Perl Bundle::libnet package. During this installation, you will be asked for geographic information and to pick FTP servers from a list. Follow the instructions on the screen.

cpan> install Bundle::Slash

Installs the Perl Slash bundle by automatically downloading it from one of the FTP sites you specified during the CPAN setup

This might take a while. During this time, follow the instructions on the screen. You will be asked for a number of inputs, which will be based on what you have installed on your system. The installation for this bundle is too long to present in this article. The best course of action is to accept defaults wherever possible. Be prepared to sit in front of your server watching installation-status messages for up to an hour on a fast machine.

During the DBIx::Password module installation, it is critical that you provide the installer with appropriate information when it asks about the name of the virtual user. This is the name that you will later need when you begin to create Slash sites. For my installation, I used ?slash? and provided the MySQL username and password information for the ?slash? user that I created earlier.

cpan> quit
Exits CPAN

Onward, Slash!
With these software installations out of the way, it’s time to move onto the main event: installing Slashcode. First, get the Slashcode package. (As of this writing, Slashcode is at version 2.2.5). For my installation, I downloaded the Slashcode distribution into /home/slowe/slashcode. Follow the instructions in Table D to properly install Slashcode.

Table D
Command Description
cd /home/slowe/slash Switches to the Slashcode download directory
gunzip -dc slash-2.2.5.tar.gz | tar xvf –     Unpacks the Slashcode distribution archive
cd slash-2.2.5 Switches to the Slashcode source directory
make Builds Slashcode
make install Installs Slashcode

Problems
I ran into problems during this part of the installation because of modules that were not properly installed during the CPAN Bundle::Slash installation. Manually downloading and installing the libraries in question easily rectified these problems. The problem library was DBIx::Password. I found that Bundle::Slash was not installing because the DBD::mysql supporting module was not installing properly. Because MySQL files were not in the location that Perl expects to find them on a Red Hat system, DBD::mysql was not installing properly. Since DBD::mysql is essential to Slash, I had to manually install DBD::mysql without using CPAN by downloading the source distribution to /home/slowe/slash. Then I followed the steps shown in Table E.
Table E

Command Description
cd /home/slowe/slash Switches to my download directory
gunzip -dc DBD-mysql-2.1017 | tar xvf –
Unpacks the DBD::mysql distribution
cd DBD-mysql-2.1017
Switches to the DBD directory
perl Makefile.PL –cflags=-I/usr/local/mysql/include/mysql –libs=”-L/usr/local/mysql/lib/mysql -lmysqlclient -lz” \
–testdb=test \
–testhost=localhost\
–testuser=root –testpassword=pw
This command installs DBD::mysql using the settings for the MySQL installation. The MySQL include directory is /usr/local/mysql/include/mysql and the libraries are in /usr/local/mysql/lib/mysql.
make Compiles everything
make install
Installs DBD::mysql
perl -MCPAN -e shell Gets back into CPAN
Cpan> install DBIx::Password Reinstalls DBIx::Password now that the MySQL support module is working properly

When completed, this default Slashcode installation installs into /usr/local/slash and assigns the nobody user and group as the owner of its files. An Apache configuration file is also created and is needed in order for Apache and Slashcode to work together. For my installation, I included this file in my Apache configuration with the following commands:
cd /usr/local/apache/conf
pico httpd.conf

At the end of the file, I inserted the line:
include “/usr/local/slash/httpd/slash.conf”

Install a Slash site
With Slash installed and configured, you can create your first Slash site. To use the command that Slash has included for this purpose, you’ll need the name of the virtual user that you created in the DBIx::Password installation above. I used mysql, therefore I will use the following command to create my Slash site.
[root@dhcppc4 bin]# ./install-slashsite -u slash

Listing A shows the question and answer session that I had to go through to get this site functional.

For my installation, I had to tell Apache where to look for this Slash site because the Apache default document directory was not located where Slash installs its files. To do this, I opened up /usr/local/apache/conf/httpd.conf (in my favorite text editor, Pico) and changed the line marked DocumentRoot to /usr/local/slash/site/dhcppc4/htdocs. Where did I get this configuration? During the Slash site installation, Slashcode created a configuration file named /usr/local/slash/site/dhcppc4/dhcppc4.conf, which had the values required for portions of the httpd.conf file. For my setup, the only two changes required to the Apache httpd.conf file were the addition of the Include directive and the relocation of the document root. Once I made this last change, I restarted Apache with the following two commands:
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start

For everything to work properly, I also needed to make sure that the machine named dhcppc4 was in my DNS or hosts file on the client machines.

Testing it
Did it work? There’s only one way to find out. I browsed to http://dhcppc4. Figure A shows the default Slash site, which means it worked!

Figure A
My Slash site is up and running

Is it all worth it?
The installation of a Slash site is very difficult, to say the least. In comparison to many other applications (such as Adaptive Website Framework, Dreamweaver, and FrontPage) Slashcode will challenge your installation knowledge to its fullest. But is going through all of this pain worth getting a Slash site up and running? I can answer this with a hearty YES. To see how powerful this technology can be, all you need to do is visit Slashdot. Slashcode allows an enormous amount of users to post, reply, and read a great deal of user-driven content.

Slashcode won’t get your e-commerce site up and running, but it will help you offer employees, vendors, or customers a very flexible and user-friendly location to find and post information.