W3C Validator in Ubuntu 14.04.1

Since Ubuntu 14.04.1 has just been released recently, I want to see if there’s anything improved in installing the w3c markup validator with it. The basic information is covered by Simply Testable here.

But there’s some extra steps you need for the latest changes. So I’m just putting the extra steps along with the original steps to get it going.

To start, fire up the Terminal app.

Most nuts and bolts are installed by default so you only need to take care a few things.

First, you’ll need to manually create the directory

sudo mkdir /etc/apache2/conf.d

because this is where the w3c-markup-validator package wants to install. Otherwise you’ll end up with a bunch of error messages to trace.

You would want to install these 7 extra packages proceeding further.

sudo apt-get install apache2 mercurial subversion python openjdk-6-jdk git libapache2-mod-perl2

Then install the w3c validator package should run smoothly:

sudo apt-get install w3c-markup-validator

git wasn’t mentioned elsewhere because this is a recent change in the HTML5 validator. Thus you will need git to get the latest source.

The perl module is required for the w3c validator actually, and there’s some changes you need to make to the conf file.

You will need to do these before w3c validator works

sudo ln -s /etc/w3c/httpd.conf /etc/apache2/conf-enabled/w3c-markup-validator.conf

Added the mod_perl module part to the cgi-bin conf:

sudo gedit /etc/apache2/conf-available/serve-cgi-bin.conf

It will look like the following:

<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

Low and behold, you will need to actually enable CGI-BIN for Apache first. Otherwise you will end up with error when you try to check any url.

sudo a2enmod cgi

Now restart apache with:

sudo service apache2 restart

You should now be able to reach http://localhost/w3c-validator/ and do a basic validation.


To install the HTML5 validator at /usr/share/html5-validator, do the following:

sudo ln -s /usr/lib/jvm/java-6-openjdk-amd64 /usr/lib/jvm/java-6-openjdk
sudo gedit /etc/enviroment

Append the following lines:

JAVA_HOME=/usr/lib/jvm/java-6-openjdk
PATH=$PATH:$JAVA_HOME/bin

and then save the file. For more details, please read setting JAVA_HOME for all users.

To make the JAVA_HOME available to sudo commands, type at command line:

sudo visudo

Then add at the bottom of the file and save.

Defaults env_keep += "JAVA_HOME PATH"

Back to Terminal, do the followings:

sudo mkdir /usr/share/html5-validator && cd /usr/share/html5-validator
sudo hg clone https://bitbucket.org/validator/build build
sudo python build/build.py --legacy all
sudo python build/build.py --legacy all

The HTML5 validator is running now and you can verify by going to http://localhost:8888/

But there’s not good enough for our daily use, right? We want it to start upon startup. Let’s just Ctrl-C to break the HTML5 validator for now. Then we’ll create the startup script at

sudo gedit /etc/init/html5-validator.conf

Put the following into it.

description "Validator.nu HTML5 Validator"
start on runlevel [234]
stop on runlevel [0156]
chdir /usr/share/html5-validator
exec python build/build.py --legacy --control-port=8889 run
respawn

With this, the HTML5 validator will start upon reboot, and you can start and stop it with:

sudo service html5-validator start/stop

The last item here is to enable w3c validator to work with private IP and HTML5 validation.

sudo gedit /etc/w3c/validator.conf

Change

Allow Private IPs = no

to

Allow Private IPs = yes

Uncomment the following line. (Do NOT put the extra HTML at the end of the URL)

HTML5 = http://localhost:8888/html5/

Restart Apache

sudo service apache2 restart

Now we got a fully working w3c validator!

OS X 10.9 certificate issue persists

Just recently I noticed I can’t load GitHub on Safari and turns out it’s the SSL certificate causing the issue. However it doesn’t seem like it’s GitHub’s fault but rather it’s OS X’s new policy (introduced at 10.9.2?) Firefox is just working fine btw.

It’s supposed to be fixed already as I’m using 10.9.4 now.

To get around this, people suggested to delete the DigiCert High Assurance CA-3 and alike. That doesn’t work for me.

Once you load github.com, this very item will be regenerated in Keychain Access.

A temporary solution is to set the SSL to be “Always Trusted” to bypass this annoying issue. But that’ll make your Mac vulnerable to sites pretending to use certificates from this authority. Joy!

This seem to be a nasty OS X bug since I found others are having the exact issue persisting through 10.9.4

A very drastic solution is “Reset My Default Keychain” via Keychain Access’s Preferences > General.

Keychain Access Reset My Default Keychain

Accessibility does matter

Accessibility is a rather less respected area during a web build by many. But it does matter to build a better web despite all the crazy visual fuss dominating the wow effects.

Read this article “Accessibility and Building a web for everyone because sometimes it’s not all about us”.

More reads from W3C that may make you head banging.