Good news! So if you have apache2 already installed, you install W3C Validator and Perl:
sudo apt-get install w3c-markup-validator libapache2-mod-perl2
The issue is that the w3c-markup-validator package hasn't been updated to install properly on 13.10+ (I'm on 14.04). To fix it manually:
sudo ln -s /etc/w3c/httpd.conf /etc/apache2/conf-enabled/w3c-markup-validator.conf
I then had an issue where /usr/lib/cgi-bin
didn't have the correct permissions. This is due to a problem in /etc/apache2/conf-available/serve-cgi-bin.conf
where it will only give the correct permission if the module is being loaded. It appears this version of perl isn't listed in the IfModule statement. To fix this:
sudo gedit /etc/apache2/conf-available/serve-cgi-bin.conf
You want it to look like this:
<IfModule mod_alias.c>
<IfModule mod_cgi.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfModule mod_cgid.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfModule mod_perl.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfDefine ENABLE_USR_LIB_CGI_BIN>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
</IfDefine>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Once you're done with these steps you have to symlink validator's html directory to /var/www/html:
sudo ln -s /usr/share/w3c-markup-validator/html /var/www/html/w3c-validator
Once the file is linked and the changes are in place, all you have to do is restart the Apache server:
sudo service apache2 restart
Check that it's all working
http://localhost/w3c-validator
CSS might be missing from validator page in the browser, but validation should work well.
/usr/lib/cgi-bin/w3c-markup-validator/check
. Also: stackoverflow.com/a/16673201/2943276