Search:  
Gentoo Wiki

HOWTO_W3C_Validator

The W3C Validator is a useful tool for testing your web pages for standards compliance. This howto will help you install it locally on your Gentoo system. These instructions work for build 0.8.2 of the Validator; check this page against the official installation docs if using a different version.

The Validator is written in Perl, and requires several packages to make it work. I'm not a Perl expert, so please modify anything that seems incorrect.

Contents

Prerequisites

It is assumed that you have a working copy of the Apache web server already installed. You also need CVS installed in order to download a particular package.

Directories

This is a listing of where files will be installed:

In addition, all commands listed here can be executed out of whatever directory you choose. You may wish to create a working directory beneath your home directory, or within /tmp, to hold the files you download until you finish the installation process.

Getting the Software

Download all the files from the W3C. This includes the Validator code itself, and the DTD libraries.

# wget http://validator.w3.org/validator.tar.gz
# wget http://validator.w3.org/sgml-lib.tar.gz

Download the SGML::Parser::OpenSP code from CVS. Enter these commands separately, as the first is interactive:

# cvs -d:pserver:anonymous@spo.cvs.sourceforge.net:/cvsroot/spo login

The password is blank.

# cvs -z3 -d:pserver:anonymous@spo.cvs.sourceforge.net:/cvsroot/spo co -P spo

At this point, you should have the latest copy of the SGML::Parser::OpenSP code in a directory named spo.

Installing the Prerequisites

Install the following Perl packages:

# emerge CGI config-general HTML-Parser HTML-Template libwww-perl Net-IP URI XML-LibXML Text-Iconv

Install the following additional Perl packages (these aren't listed in the W3C's install documentation, but are required for SGML::Parser::OpenSP to install correctly):

# emerge Class-Accessor Test-Exception

Install the following non-Perl package:

# emerge opensp

Now, you also need several Perl packages not in Portage. The easiest way to do this, is to get them from CPAN. g-cpan allows you to do this, and still have the packages managed by Portage. It downloads the package from CPAN, and creates an ebuild for you automatically. It has the ability to use Portage overlays, if you have those defined, but I'm using it in its simplest form here. The generated ebuilds will be deleted once the packages are installed.

# emerge g-cpan

Next, install the remaining Perl packages:

# g-cpan --install Encode-HanExtra
# g-cpan --install Encode-JIS2K
# g-cpan --install HTML-Encoding

Finally, we need to install SGML::Parser::OpenSP by hand, since it isn't in Portage or CPAN.

# cd spo
# perl Makefile.PL
# make
# make test
# make install

Installing the Validator

Untar the code as follows:

# tar xvfz validator.tar.gz
# tar xvfz sgml-lib.tar.gz

Both of these files will uncompress into a directory called validator-0.8.2 (though the version may be different)

Now, create the directory for the application, and copy the code into place. /usr/local/validator is recommended by the W3C, and is this location is preconfigured in all the configuration files.

# mkdir /usr/local/validator
# cd  validator-0.8.2/
# mv htdocs /usr/local/validator/
# mv httpd/cgi-bin /usr/local/validator/
# mv share /usr/local/validator/

I'm choosing to store my Apache configuration in /usr/local/validator/httpd/conf/validator-httpd.conf. This file will be referred to from your main Apache configuration.

# mkdir -p /usr/local/validator/httpd/conf
# cp httpd/conf/httpd.conf /usr/local/validator/httpd/conf/validator-httpd.conf

Now, give the apache user ownership to all the files:

# chown -R apache:apache /usr/local/validator

Refer to the validator-httpd.conf file from your Apache virtual host configuration file. In /etc/apache2/vhosts.d/00_default_vhost.conf (or whatever you use), add the following line after any other Includes:

File: /etc/apache2/vhosts.d/00_default_vhost.conf
Include /usr/local/validator/httpd/conf/validator-httpd.conf

You may need to change validator-httpd.conf; by default, my Apache server did not allow users to access the directory containing the Validator. I added the following to the top of the file:

File: /usr/local/validator/httpd/conf/validator-httpd.conf
<Directory /usr/local/validator/cgi-bin/>
  Allow from all
</Directory>

Then, immediately after the line:

<Directory /usr/local/validator/htdocs/>

I added:

File: /usr/local/validator/httpd/conf/validator-httpd.conf
  Allow from all

The file also contains a <Proxy> section, which means Apache should have mod_proxy enabled. I'm not sure whether this can be removed, or surrounded by an <IfDefine> directive.

Finally, copy the Validator's configuration files into place

# mkdir /etc/w3c
# cp /usr/local/validator/htdocs/config/* /etc/w3c

You may wish to modify /etc/w3c/validator.conf with your specific server information.

Using the application

Restart Apache, then you should be able to access the application at: http://your.server.net/w3c-validator/

Retrieved from "http://www.gentoo-wiki.info/HOWTO_W3C_Validator"

Last modified: Fri, 05 Sep 2008 23:02:00 +0000 Hits: 2,437