WebGUI Content Manager

From OptionC

Table of contents

Introduction

The purpose of this document is to document the approach for installing Plain Black's (http://www.plainblack.com/spreadwebgui) WebGUI, an open source web content management system. WebGUI does not (currently) have a Debian package, so it's a little more complicated than other installations on this wiki. There is nothing in this document that makes it Xen-specific, so it can be used directly on a physical machine.

Conventions

Throughout this document we have used "webguitest" as the name of the domain.

Base Installation

Start with a base system, such as the one detailed here. You will need to have a larger amount of diskspace -- a minimum of 512MB with 1GB being the optimal minimum.

On this system, we need to have both Apache 2 and MySQL installed:

apt-get update
apt-get install apache2 mysql-server

Installation of WebGUI

We now need to begin the actual installation of WebGUI. First we must install the remaining packages on which WebGUI depends. Most of these are standard Debian packages.

apt-get install make perlmagick libapache2-mod-perl2 \
                libwww-perl libdbi-perl libdbd-mysql-perl \
                libarchive-tar-perl libcompress-zlib-perl \
                libio-zlib-perl libhtml-parser-perl \
                libsoap-lite-perl libcache-cache-perl \
                libdate-manip-perl liblog-log4perl-perl \
                libtie-ixhash-perl libhtml-template-perl \
                libxml-simple-perl libnet-ldap-perl

One or two required packages are not available from Debian. These are Perl libraries for which we will use CPAN.

perl -MCPAN -e shell

If this is the first time using CPAN you'll need to go through the configuration. Most of the defaults are safe, though you will need to choose the appropriate continent, country, and ftp sites to actually download the packages. Once CPAN is running, enter the following:

cpan> install Tie::CPHash
cpan> install Parse::PlainConfig
cpan> install HTML::TagFilter

Download the WebGUI source. I used webgui-6.6.4-gamma.tar.gz.

Untar it and move the resulting directory to a place that will be accessible by the web server:

tar -zxvf webgui-6.6.4-gamma.tar.gz
mkdir /data
mv WebGUI /data
Editorial note: I'm not personally in favour of requiring a "/data" directory. However it appears that it's the standard way for WebGUI and that the "/data" directory is hard-coded in some of the source files. If it is indeed hard-coded, it would be nice if the developers would make it so that a single configuration variable could be changed according to personal taste or security requirements.

Apache Configuration

Our installation was based upon a single site being run on the machine. As such, the modifications to the configuration files were made to the /etc/apache2/sites-available/default file. If the machine is hosting multiple domains then each of the files will need to be modified appropriately.

In the /etc/apache2/sites-available/default file, find the <Directory /var/www/> section. The "Options" line should look like:

Options ExecCGI Indexes FollowSymLinks MultiViews

After the <Directory> section make the following additions:

<Files ~ "index\.pl$">
    SetHandler perl-script
    PerlHandler ModPerl::Registry
</Files>
PerlRequire /data/WebGUI/sbin/preload.perl
Alias /extras /data/WebGUI/www/extras

Finally, find the DocumentRoot line in the file. Make the following changes/additions:

DocumentRoot /var/www/domains/webguitest/www/public
ServerName webguitest
ServerAlias webguitest
ErrorDocument 404 /index.pl/page_not_found
CustomLog /var/www/domains/webguitest/www/logs/access_log combined

The differences are highlighted below:

NameVirtualHost *
<VirtualHost *>
       ServerAdmin webmaster@localhost
       DocumentRoot /var/www/domains/webguitest/www/public
       ServerName webguitest
       ServerAlias webguitest
       ErrorDocument 404 /index.pl/page_not_found
       CustomLog /var/www/domains/webguitest/www/logs/access_log combined

       <Directory />
               Options FollowSymLinks
               AllowOverride None
       </Directory>
       <Directory /var/www/>
               Options ExecCGI Indexes FollowSymLinks MultiViews
               AllowOverride None
               Order allow,deny
               allow from all
               # This directive allows us to have apache2's default start page
               # in /apache2-default/, but still have / go to the right place
               # RedirectMatch ^/$ /apache2-default/
       </Directory>

       <Files ~ "index\.pl$">
           SetHandler perl-script
           PerlHandler ModPerl::Registry
       </Files>
       PerlRequire /data/WebGUI/sbin/preload.perl
       Alias /extras /data/WebGUI/www/extras

       ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
       <Directory "/usr/lib/cgi-bin">
               AllowOverride None
               Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
               Order allow,deny
               Allow from all
       </Directory>

       ErrorLog /var/log/apache2/error.log

       # Possible values include: debug, info, notice, warn, error, crit,
       # alert, emerg.
       LogLevel warn

       CustomLog /var/log/apache2/access.log combined
       ServerSignature On

   Alias /doc/ "/usr/share/doc/"
   <Directory "/usr/share/doc/">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride None
       Order deny,allow
       Deny from all
       Allow from 127.0.0.0/255.0.0.0 ::1/128
   </Directory>
</VirtualHost>

Directory Configuration

Now we make the directories and so forth. First we link the directory into our more usual scheme of having Apache directories in /var/www:

ln -s /data/domains /var/www/domains

Next we make directories that are based on the Domain Name -- webguitest.

mkdir -p /data/domains/webguitest/www/public
cd /data/domains/webguitest/www
mkdir logs
cp /data/WebGUI/etc/WebGUI.conf.original /data/WebGUI/etc/webguitest.conf
cd public
cp /data/WebGUI/www/index.pl ./
cp -R /data/WebGUI/www/uploads ./
chown nobody uploads

Next we create the log file:

touch /data/webgui.log
chown nobody /data/webgui.log

Finally we set up a cron job to run the maintenance functions:

crontab -e

Inside the cron file:

0 * * * * cd /data/WebGUI/sbin/; perl runHourly.pl > /dev/null 2>&1

Database Setup

In order to setup the database, the following steps should be taken:

cd /data/WebGUI/etc
mysql -p
mysql> create database webguitest
mysql> grant all privileges on webguitest.* to webgui@localhost identified by 'password'
mysql> flush privileges
mysql> exit
mysql -uwebgui -ppassword webguitest < /data/WebGUI/docs/create.sql

WebGUI Configuration

Now we edit the /data/WebGUI/etc/webguitest.conf to match the database settings. The following values should be set:

sitename = webguitest
dsn = DBI:mysql:webguitest
dbuser = webgui
dbpass = password
logfile = /data/webgui.log
extrasURL = /extras
uploadsURL = /uploads
uploadsPath = /data/domains/webguitest/www/public/uploads

We then modify the WebGUI gateway to use the new configuration file.

vi /data/domains/webguitest/www/public/index.pl

Find the line that looks like the following:

$configFile = "www.example.com.conf";

Change it to the name of our configuration file:

$configFile = "webguitest.conf";

And finally we restart Apache:

apachectl -k restart

Check to see that Apache is running by looking for processes running /usr/sbin/apache2. If it's not, refer to the log files in the /var/log/apache2 directory and see what's gone wrong.

Final Configuration

If you've got this far then it's time to run WebGUI. Point your browser to the machine/domain on which you have installed WebGUI. You should see a page which shows the Username and Password prefilled. This will get you into the website ready for your configuration.

Note: You should change the Admin password as soon as you log in.

The setup of an actual site running WebGUI is beyond the scope of this document. Play and have fun.