August 21, 2003

Installing Slash for Weblogs

- by Sergey Tsalkov -
Today it's easy for anyone to set up a powerful Weblog system on a Linux server. These advanced forum-like systems have an unlimited number of potential uses, ranging from online diaries to group collaboration. Slash, an open source application developed by OSDN, the publishers of this site, is a good tool for running such Weblog. This article walks users through the complexities of installing Slash.
Why Slash?

Once you start using Weblog software, moving your database to a different program is a difficult process, so it helps to choose well before you start. Slash is not for everyone. In recent years, a large number of competitors have sprung up, many of which offer a product that's superior in many ways. Because of the difficultly of setting up and running a Slash-based Weblog, you should choose Slash if you need its unique advantages:

  • Security -- Since it's one of the most mature Weblog systems, its maintainers have had plenty of time to get the bugs out. Slashdot.org, being such a popular geek site, has always been a target for hackers, and despite this has an excellent security track record. Although slashdot.org itself has been hacked, slashcode was not the culprit. If security is important to you, Slash is definitely a good choice.
  • Advanced moderation system -- This is extremely useful for any public Weblog that expects to get a large number of comments to a story. Essentially, this unique system hands out partial moderation control to the most frequent visitors, allowing them to flag certain comments as unique. Readers can then easily view just those unique comments.
  • Speed -- While other Weblog systems usually have to conduct several database calls for every page they generate, Slash's advanced caching system can often skip the numerous calls and serve up pages much faster. The same applies to comments -- while other systems may choke if forced to deal with insane quantities of comments, Slash will not. All of this will make for a much faster system -- but, once again, only for popular sites.

Slash may be impressive, but it is far from perfect. Here are some key disadvantages of Slash:

  • Resource usage -- Slash was designed to serve large communities with relative ease. However, it uses a considerable chunk of system resources whether or not your community is of considerable size.
  • Difficulty of installation and use -- Another major negative point for Slash is how difficult it is to set up. The installation process can take over an hour (that's assuming everything goes well), and a good level of knowledge of both Linux in general and Perl in particular is needed.

You need root access to begin installing Slash.

  1. Edit MySQL Configuration File
    Add these two lines to the beginning of /usr/bin/safe_mysqld:
    TZ=GMT
    export TZ

    Then restart MySQL for the change to take effect:

    /etc/rc.d/init.d/mysql restart

  2. Create a MySQL Database For Slash
    Type the following commands to create a database for Slash to use. Make sure to replace "slashuser" and "slashpass" with a username and password of your choice.

    mysql --user=root mysql

    You'll get a MySQL prompt, at which you'll enter these commands:

    > CREATE DATABASE slashdb;

    > GRANT ALL PRIVILEGES ON slashdb.* TO slashuser@localhost IDENTIFIED BY 'slashpass';

    > exit

    If you've previously set a password on MySQL root (not system root), remove it now.

  3. Install expat
    Expat is an XML parser which Slash uses to interpret RSS pages. Basically, it lets you insert the most recent posts of somebody else's Weblog into a block on yours. Whether or not you plan to use this functionality, you'll probably need the module installed. Download expat-1.9x.tar.gz, then use the following commands to compile and install it:

    tar -zxvf expat-1.9x.tar.gz

    cd expat-1.9

    ./configure

    make

    make install

  4. Install Apache and mod_perl
    Before you install Slash's Perl modules, Apache and mod_perl must be set up properly. First, download the latest version of Apache in the 1.3.x series, then download mod_perl 1.27. Run the following commands to set them up. Make sure to replace /usr/download/ with wherever you downloaded Apache and mod_perl to.

    tar -zxvf apache_1.3.28.tar.gz

    tar -zxvf mod_perl-1.27.tar.gz

    cd mod_perl-1.27

    perl Makefile.PL APACHE_SRC=/usr/download/apache_1.3.28/src DO_HTTPD=1 USE_APACI=1 PERL_MARK_WHERE=1 EVERYTHING=1 APACHE_PREFIX=/usr/local/apache

    make

    make test

    make install

    Note: Ignore any non-fatal errors during the "make test" step.

  5. Install Perl modules
    CPAN stands for Comprehensive Perl Archive Network, and it's a database of a variety of tools, modules, etc. related to Perl. We're interested in Perl's own CPAN client, which will connect to that database to download and install Perl modules with relative ease. Start the CPAN module with the command:

    perl -MCPAN -e shell

    If this is the first time you've run it, it will ask you a series of questions. Just press Enter if you don't know the answer to any of them. If you're unsure of which mirrors you want to use, type "21, 27" when asked. When you get to then cpan> prompt, type the following commands. If it ever asks you if you want to stop the installation and install the required updates, choose Y:

    conf make_install_arg UNINST=1

    install Bundle::CPAN

    reload cpan

    install XML::Parser

    install Net::Cmd

    install Net::Telnet

    If the Net::Telnet module install fails, run these commands to force it to install:

    force install Net::Telnet

    install Bundle::CPAN

  6. Install Bundle::Slash
    This one's going to take a lot longer than the others. It's going to ask you a series of questions; the answers you should type are bolded.

    PAN.pm: Going to build J/JW/JWIED/Msql-Mysql-modules-1.2216.tar.gz

    Which drivers do you want to install?

    1) MySQL only
    2) mSQL only (either of mSQL 1 or mSQL 2)
    3) MySQL and mSQL (either of mSQL 1 or mSQL 2)
    4) mSQL 1 and mSQL 2
    5) MySQL, mSQL 1 and mSQL 2

    Enter the appropriate number: [3] 1

    Do you want to install the MysqlPerl emulation? You might keep your old
    Mysql module (to be distinguished from DBD::mysql!) if you are concerned
    about compatibility to existing applications! [n] y

    Where is your MySQL installed? Please tell me the directory that
    contains the subdir 'include'. [/usr] /usr

    Which database should I use for testing the MySQL drivers? [test] slashdb

    On which host is database slashdb running (hostname, ip address
    or host:port) [localhost] localhost

    User name for connecting to database slashdb? [undef] slashuser

    Password for connecting to database slashdb? [undef] slashpass

    Creating files for MySQL ..........................

    A little while later, you'll be faced with a series of questions starting with:

    What is the name of the Virtual User?

    At this point, use these answers:

    virtslash
    mysql
    slashdb
    localhost
    *just hit ENTER*
    slashuser
    slashpass
    *just hit ENTER*
    *just hit ENTER*

    Alternatives to Slash

    There are numerous alternative Weblog systems that perform well in areas where Slash does poorly, among them PHPnuke, GeekLog, and Scoop.

    PHPnuke started out as a fork of thatware and has grown into the most popular choice for small Weblogs. PHPnuke has a large list of built-in features and more add-on modules than you can shake a stick at. It's ridiculously easy to install and use. The project itself has but a single developer, and he has made his priorities clear: features are important, and bugs are not. The result is very buggy code that's difficult to follow (much less modify) and an awful security track record.

    The Geeklog project was started a little while after PHPnuke, and although it has matured over the last three years, its community of supporters remains relatively small. Unlike PHPnuke, Geeklog's team of developers put quality of code above features. Despite being just as easy to install and use as PHPnuke, it has a far cleaner codebase that makes code hacking a pleasure, and a security track record that would make your mother proud. Because of its small fan base, there are still relatively few add-ons (in comparison to PHPnuke), but more are added almost every week.

    Scoop is a popular choice for community-oriented Weblogs, partially because it combines some of the unique features of Slash with some of the ease-of-use of PHP-based Weblogs. Like Slash, the Scoop code evolved to handle large databases and serve up pages efficiently, making it a good choice for large, popular Weblogs. Also like Slash, its installation is quite difficult and its security record is squeaky clean. Like PHPnuke, its Web-based administration and user interfaces are fairly easy to understand and use. What makes Scoop unique is its user-oriented story moderation system. When a user submits a story, other Weblog readers get to vote on it, to decide if it's good enough to be on the Weblog's front page, or to be on the Weblog at all. If you have the Linux knowledge to set it up, Scoop can be a good alternative to Slash for medium and large Weblogs that PHPnuke can't handle.

    If you do not have sendmail installed, the Mail::Sendmail package install test may take five minutes or more until it times out. Do not break the install with Ctrl-C. Let it finish or Slash will not run, and you may cause the Email::Valid package error I referred to, as well as other problems. I suggest making sure sendmail is installed using a packaged binary release such as RPM or .DEB.

    After Bundle::Slash installation completes, pay close attention to any problems it might have encountered. If, for example, it says at the end of the install it had problems installing Email::Valid, enter the command install Email::Valid. If the install still errors out, force it to install by entering force install Email::Valid.

    It has been reported that DBD::mysql may error out in some cases, and may also affect DBIx::Password, causing this module not to install as well. Watch after the Mysql-modules package has been installed for all installation problem messages. Personally, I've never been able to reproduce this particular error, but it has been reported that forcing it to install via force install 'module-name-here' will result in a working Slash.

    If your system's hostname isn't set correctly, LWP (the set of Perl modules that provide an interface to the Web) may not install correctly. If this happens, you'll see the error during the "make test" phase of the installation. You can correct it by entering the command hostname localhost at a bash command prompt, then attempting another installation.

  7. Edit /etc/passwd
    Change the default shell for the user "nobody" from /sbin/nologin to /bin/bash.

  8. Install Slash itself
    Download the latest copy of Slashcode and run the following commands to compile it and attach it to your Apache Web server:


    tar -zxvf slash-2.2.6.tar.gz

    cd slash-2.2.6

    make

    make install

    echo 'Include /usr/local/slash/httpd/slash.conf' >> /usr/local/apache/conf/httpd.conf

  9. Create a new Slash site
    First run these commands to begin creating your Slash site:

    cd /usr/local/slash/bin

    ./install-slashsite -u virtslash

    Now specify your site's hostname (for example, "www.slashdot.org") when asked, and accept the default answer for the other questions -- except for where you're asked to create an administrator account.

  10. Time to start Slash!
    We're almost done. Now you just need to start Apache and Slash:

    /usr/local/apache/bin/apachectl start

    /etc/rc.d/init.d/slash start

You should now be able to access your Slash site by pointing your browser to "http://localhost." To learn more about customizing and running your new Slash site, you should check out
The Slashcode FAQ. If you want an even more in-depth guide to everything there is to know about slash, check out the book Running Weblogs With Slash.

Sergey Tsalkov is a Webmaster, sysadmin-in-training, and Weblog fan who has been using Linux for four years.

Category:

  • Open Source
Click Here!