The W3C Markup Validator provides Perl/CGI/SGML/XML/DTD-based validation of a variety of document types. SGML and DTDs are older technologies that never found wide use on the Web, so for checking of HTML documents using modern technologies, you probably want to instead use the W3C HTML Checker. To do that,
If for some reason you'd rather run a service based on the same source as the W3C Markup Validator, this page provides the following information:
Rather than trying to install and run an instance of the W3C from the sources, it's much easier to install one of a variety of pre-built packages. The sections below provide information about packages available for various systems.
Fedora RPM packages of the validator are included in Fedora. The name of the validator package is w3c-markup-validator, use the standard automated package management tools of the distribution (such as yum) to install it along with its dependencies.
For Red Hat Enterprise Linux and derivative distributions, the w3c-markup-validator package is available in EPEL.
openSUSE/SUSE Linux RPM packages of the validator are available, courtesy of Sierk Bornemann, at software.openSUSE.org, <http://software.opensuse.org/>. Starting with openSUSE 10.3, the latest stable validator package and all its dependencies are included in the official stable openSUSE distribution. The name of the validator package is w3c-markup-validator, use the standard automated package management tools of the distribution (such as YaST, zypper, smart, apt4rpm or yum) to install it along with its dependencies.
Additionally, you can also get these and other needed packages from the openSUSE Software Repository at <http://software.opensuse.org/package/w3c-markup-validator>
A Debian package is available, courtesy of Frédéric Schütz.
Starting with Debian 3.1 ("Sarge"), the package and all its dependencies are included in the official Debian distribution, and can be installed by running the command apt-get install w3c-markup-validator as root.
If you just want to glance at the code, or see its revision history, you can browse it directly in Github.
The most interesting files are currently a CGI script called "check" that does pretty much everything, and possibly also the httpd.conf configuration file snippet for Apache. Select the topmost revision numbers on these pages to see the most recent revision of each file.
To actually install and run an instance of the W3C Markup Validator from the sources, see the installation manual.