This guide provides a step-by-step walk-through to build and install the W3C CSS Validation Service (herein referred to as CSS Validator) from its source files. It assumes minimal prior system administration experience, uses the latest versions and includes all functionality of the validator. The target Linux distribution is Ubuntu Precise, though each step will be similar for any distribution.
Note: this section can be skipped if you're already familiar with installing Ubuntu and/or have a Linux system running.
We will be using a Vagrant managed VirtualBox install as a base system.
-
Download and install Vagrant from a pre-built package
-
From the command line, download an Ubuntu Precise box with:
vagrant box add precise32 http://files.vagrantup.com/precise32.box
-
Create an instance of Ubuntu Precise with:
mkdir cssvalidator cd cssvalidator vagrant init
-
Edit the generated
Vagrantfile
and tell Vagrant to use theprecise32
box:config.vm.box = "precise32"
-
Uncomment and edit the following line in the generated
Vagrantfile
to enable port forwarding:config.vm.forward_port 8080, 8080
-
Launch the virtual machine:
vagrant up
Your Ubuntu virtual machine should now be up and running. Confirm by running:
vagrant ssh
-
Install build packages:
sudo apt-get update sudo apt-get install build-essential cvs
-
Install CSS Validator dependencies:
sudo apt-get install default-jdk ant
Download CSS Validator
mkdir ~/build
cd ~/build
export CVSROOT=":pserver:[email protected]:/sources/public"
cvs login
CVS password: anonymous
cvs get 2002/css-validator
Here, we'll be using Tomcat but the same principles apply to any Java Servlet container.
-
Install Tomcat
sudo apt-get install tomcat7
-
Configure CSS Validator to use Tomcat by replacing the following line in
~/build/2002/css-validator/build.xml
:<property name="servlet.lib" value="/usr/share/java/servlet-2.3.jar"/>
... with
<property name="servlet.lib" value="/usr/share/java/tomcat-servlet-api-3.0.jar"/>
To build the CSS Validator WAR file, run:
cd ~/build/2002/css-validator
ant war
Deploy the CSS Validator WAR file with:
sudo cp ~/build/2002/css-validator/css-validator.war /var/lib/tomcat7/webapps
Note: Ubuntu's default configuration starts Tomcat on install and at system startup.
Start Tomcat using:
sudo service tomcat7 start
Validator should now be set up and ready to go. Browse to http://localhost:8080/css-validator to see it running.
The author would like to thank the CSS Validator Team's official install guide, which forms the basis of much of this document.
Copyright 2012 Tom Vincent http://tlvince.com/contact, licensed under the Creative Commons Attribution 3.0 Unported License.