Note: Suggest using a 64bit version of Ubuntu 12.04LTS for the HTML5 validation component.
Steps from here: http://www.mattzuba.com/2011/03/install-w3c-markup-validation-service-on-ubuntu/
$ sudo apt-get install \
build-essential opensp libosp-dev \
apache2-mpm-prefork libapache2-mod-perl2 \
libxml-libxml-perl-
$ sudo perl -MCPAN -e shell -
Accept the first
yesprompt -
Press enter to
local::lib -
Press enter to
yesfor selecting CPAN mirror -
Note: things might crash out here back to shell, but it doesn't seem to matter, just re-run
sudo perl -MCPAN -e shelland continue. -
Now enter the following (will take some time to install - be patient):
o conf prerequisites_policy follow install Bundle::W3C::Validator exit
$ mkdir ~/w3cvalidatorsrc && cd ~/w3cvalidatorsrc
$ 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.gzNote:
~/w3cvalidatorsrc/validator-1.3is contents ofvalidator.tar.gz~/w3cvalidatorsrc/validator-1.1is contents ofsgml-lib.tar.gz
$ sudo mkdir -p /usr/local/validator
$ sudo mkdir -p /etc/w3c
$ cd validator-1.3
$ sudo mv htdocs share httpd/cgi-bin /usr/local/validator
$ sudo cp /usr/local/validator/htdocs/config/* /etc/w3cMove sgml-lib from sgml-lib.tar.gz into place:
$ cd ../validator-1.1
$ mv htdocs/sgml-lib /usr/local/validator/htdocs
$ cd ..
$ sudo cp validator-1.3/httpd/conf/httpd.conf /etc/w3c
$ sudo ln -fs /etc/w3c/httpd.conf /etc/apache2/conf.d/w3c-validator.conf-
$ sudo nano /etc/w3c/httpd.conf -
Add following lines to
<Directory>section (just inside opening block is fine):Order Allow,Deny Allow from all
Update /etc/w3c/httpd.conf so validator answers on the root of the virtual website - not under the /w3c-validator/ alias:
-
Change first two
AliasMatchlines to:AliasMatch ^/+check(/+referer)?$ /usr/local/validator/cgi-bin/check AliasMatch ^/+feedback(\.html)?$ /usr/local/validator/cgi-bin/sendfeedback.pl -
Change
<LocationMatch>line to:<LocationMatch "^/+(check(/+referer)?|feedback(\.html)?)$"> -
Change
Aliasline to:Alias / /usr/local/validator/htdocs/ -
Change
RewriteBaseline to:RewriteBase /
May wish to trim back number of StartServers, MinSpareServers and MaxSpareServers servers in /etc/apache2/apache2.conf to help keep memory usage a little leaner:
<IfModule mpm_prefork_module>
StartServers 1
MinSpareServers 2
MaxSpareServers 2
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
$ sudo a2enmod rewrite
$ sudo a2enmod expires
$ sudo a2enmod include
# Disable mod_perl - otherwise DTD checks will fail under certain validator requests
$ sudo a2dismod perl
$ sudo /etc/init.d/apache2 stop
$ sudo /etc/init.d/apache2 startAt this point you will be able to validate documents up to XHTML - but we want HTML5 validation (don't we?)...
Note: it seems installation of the Validator.nu HTML5 validator requires Ubuntu 64bit, I haven't been successful with building/running using a 32bit Ubuntu OS (stackoverflow errors).
$ sudo apt-get install git default-jdk
$ sudo su
$ export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
$ mkdir ~/validator.nu && cd ~/validator.nu
$ git clone https://github.com/validator/validator.git build
# Note: the below build commands are run twice on purpose - this is not a typo, and expect to wait a long time for this to download/install
$ python build/build.py all
$ python build/build.py all- Validator.nu server will now be running on
http://127.0.0.1:8888. Ctrl-Cto exit- Place
html5validator.confinto/etc/initdirectory $ sudo start html5validator- Now Validator.nu is running as a backgrounded daemon.
Some final tweaks required to w3c validator config to pass HTML5 documents onto the Validator.nu server:
-
$ sudo nano /etc/w3c/validator.conf -
Uncomment last two lines to proxy HTML5 document w3c validator requests to Validator.nu:
<External> ## Enable checking documents via external services. ## The example config below assumes that you have installed the validator.nu ## engine on the same machine as the markup validator. ## See http://about.validator.nu/ for installation instructions. HTML5 = http://localhost:8888/html5/ CompoundXML = http://localhost:8888/ </External> -
Finally, restart apache web server:
$ sudo /etc/init.d/apache2 stop $ sudo /etc/init.d/apache2 start
To update and re-build the Validator.nu server issue the following commands:
$ sudo su
$ stop html5validator
$ export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
$ cd ~/validator.nu
$ python build/build.py all
$ start html5validatorThe Validator should now should be present at either of the following URLs - depending if you did the optional /etc/w3c/httpd.conf modifications:
http://[serverIP]/w3c-validator/orhttp://[serverIP]/
If runing the validator as a VM within VirtualBox you have the option of exposing the validator web server back to the host machine localhost on an alternative port via VirtualBox's port forwarding feature.
Firstly, make the following edits to /etc/apache2/ports.conf so Apache2 listens on 0.0.0.0:80:
#NameVirtualHost 0.0.0.0:80
ServerName localhost
Listen 0.0.0.0:80
Restart Apache2:
$ sudo /etc/init.d/apache2 stop
$ sudo /etc/init.d/apache2 startNow open settings for the VirtualBox instance:
- Goto Network
- Ensure Adapter 1 is set to NAT
- Open Advanced and click Port Forwarding
- Add a new entry:
- Protocol: TCP
- Host IP: 127.0.0.1
- Host Port: 5000 (or another random unused port)
- Guest IP: 0.0.0.0
- Guest Port: 80
With this set you should now have the validator listening on http://localhost:5000/.
I think there's a typo here:
Shouldn't it be
https://github.com/validator/validator.git?