This is a simple run through on how to get the W3C Validator up and running on your Ubuntu 10.04+ system. While you can already have Apache installed and running, this walk through assumes you are installing the validator on a brand new Ubuntu install.
First we need to install some packages to prepare the system to run the validator.
sudo apt-get install build-essential opensp libosp-dev apache2-mpm-prefork libapache2-mod-perl2 sudo perl -MCPAN -e shell
Run through config and answer appropriate questions. If asked for CPAN mirror, view http://www.cpan.org/SITES.html to find one close to you. Once the configuration is complete, install the Validator required Perl modules.
o conf prerequisites_policy follow install Bundle::W3C::Validator exit
Download the source tree for the validator and it’s DTDs and extract. This will grab the latest stable branch. If you wish, you can use Mercurial to grab the latest development code.
mkdir ~/src cd ~/src wget http://validator.w3.org/validator.tar.gz wget http://validator.w3.org/sgml-lib.tar.gz tar -xf validator.tar.gz tar -xf sgml-lib.tar.gz cd validator-1.1
Create some new directories for installing the validator code.
sudo mkdir -p /usr/local/validator sudo mkdir -p /etc/w3c
Move the needed files to the validator directory and copy the config files to the /etc/w3c directory.
sudo mv htdocs/ share/ httpd/cgi-bin/ /usr/local/validator sudo cp /usr/local/validator/htdocs/config/* /etc/w3c/
If you will be validating documents on the private network, you need to enable that in /etc/w3c/validator.conf by adjusting the ‘Allow Private IPs’ option to yes.
Test the validator out to make sure it’s configured properly.
cd /usr/local/validator/cgi-bin ./check uri=http://www.w3.org
Now configure Apache (I assume you have installed Apache from Aptitude, if not, adjust these instructions as necessary).
sudo cp ~/src/validator-1.1/httpd/conf/httpd.conf /etc/w3c/httpd.conf sudo ln -s /etc/w3c/httpd.conf /etc/apache2/conf.d/w3c-validator.conf
Normally on my Apache installs, I edit /etc/apache2/conf.d/security and uncomment the lines that Disallow access to all directories. So I have to edit /etc/w3c/httpd.conf to allow access to the validator files. Add the following in /etc/w3c/httpd.conf in the Directory section
Order Allow,Deny Allow from all
We need to enable a few more Apache modules before restarting and testing it out.
sudo a2enmod rewrite sudo a2enmod expires sudo a2enmod include sudo apache2ctl restart
And now you can navigate to http://localhost/w3c-validator/ and give it a whirl. I had trouble with the validator running when using the perl module so I had to disable it (
sudo a2dismod perl) and restart Apache, after which it worked perfectly.