Background
I have developed many Drupal sites over the last few years. They have varied in scale and scope, but one thing has
remained consistently annoying to me with each site: the update process. When I have installed sites in the past, I have simply downloaded Drupal core and contributed modules from the Drupal homepage. This installation process is very straightforward and easy for beginning Drupal site development. However, once you have several sites under your care, the frequent updates of Drupal code can be overwhelming. Every time that a new version of Drupal or a contributed module is released you have to download large files, extract them and move them to your server. Until recently I was not aware of any solution to make the update process faster and easier. However, I have now been introduced to the wonderful world of "version control" with CVS.
What is CVS?
CVS is a version control system. There are many such systems, including CVS, Subversion, Git and others. The purpose of these systems is to manage the many code changes that take place over time with software development. As various changes and improvements are made on a project, the maintainers can essentially create "snapshots" of the project, associating a version number with each snapshot. The version control system keeps track of all changes that take place in the code (line removals, additions, edits, etc.) from snapshot to snapshot.
As mentioned above, CVS is just one of the many version control options available to software projects. I am not entirely certain which options were around when the Drupal project setup its version control system, but for whatever reason they have decided to use CVS. There is often discussion on the Drupal development mailing list about switching to other systems, but CVS remains in use to-date.
Initial Setup
As a Drupal site maintainer, you can leverage the power of CVS to make installation and updates simple and fast. In order to do so, you need to have the ability to run cvs from the command line on the computer that will house your site. If your site will be on a Unix (Mac) or Linux computer, then you should have the cvs command line ability built-in. If you are trying to house a site on a Windows machine, then you will probably need to install something like Cygwin to enable cvs command line ability. I should note that most readers will probably be hosting their site on a Linux shared-hosting machine. As such, their site will exist on a computer that should already has cvs command line capabilities, meaning no additional sofware needs to be installed on the server. Nevertheless, the user still needs a way to run cvs commands on the server from their own local computer.
Thankfully, there is a useful utility called Putty which allows users to connect to other machines and run commands on said machine via SSH. There are many tutorials on the web about how to connect your local computer to your server with Putty. So I will spare most of the details here. It should be noted that before using Putty to connect to your server, you will probably have to setup a username and password with your webhosting company. Then you simply configure Putty to connect to your server and authenticate with your username and password. Once you are logged into the server, you are ready to start running cvs commands.
Installing Drupal Core with CVS
I will assume that you are starting a site from scratch. In the future I will write a follow-up post on converting an existing Drupal site over to CVS-controlled Drupal. However, the following information pertains to fresh installations.
The first step in using CVS to manage a Drupal site is to "checkout" the version of Drupal core that you want to start with. You are essentially telling Drupal's CVS "repository" that you want it to deliver a certain version of Drupal to your server. You do so with a command like this:
cvs -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -d path/to/site-root -r DRUPAL-X-X drupal
The previous command runs the cvs program and then logs into Drupal's main CVS repository as an anonymous user and navigates to the "cvs/drupal" directory. It then "checks out" the version of Drupal that you specify (e.g. 'DRUPAL-5-12). The downloaded contents are placed into the directory that you specify (e.g. 'path/to/site/root'). The proper value for this option will vary depending on your server/hosting setup. Once you run this command, you will see the progress that CVS makes as it downloads the appropriate files to your server. Once the CVS code has completed running, you will have your desired version of Drupal waiting for you to configure it. You will still have to go through the usual steps of setting up database information, site names, etc. However, CVS will have saved you the time of downloading the "tarbal" from drupal.org, decompressing it and FTPing the files to your serever.
Installing Contributed Modules with CVS
Since you plan on using CVS to manage installation and updates of Drupal core, it makes sense to do the same for your site's contributed modules. The first step in doing so is to use the 'cd' command to change your current directory to 'site-root/sites/all'. Then run a cvs command like this:
cvs -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d modules -l contributions/modules
This command is again logging into Drupal's repository as an anonymous user and checking out an empty folder named 'modules' so that 'site-root/sites/all/modules' is created. It is imperative to keep the '-l' portion of the command intact. If you do not include it, cvs will check out every module in the Drupal contributed modules repository. This is surely not what you want.
Now that you've created your modules folder, you should again use the 'cd' command to change into the 'site-root/sites/all/modules' directory that you just created. Now you can checkout individual modules using commands like this:
cvs -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d module_name -r DRUPAL-5--X-X contributions/modules/module_name
This will download the version of the contributed module that you desire into the 'site-root/sites/all/modules/module_name' directory. You will have to
run one such command for each contributed module that you want to use on your site. The appropriate value of 'DRUPAL-5--X-X' to use can be found be exploring cvs.drupal.org. Please not that this version number is not necessarily the version of Drupal core that you are using; it is specific to the contributed module that you are installing.
Updating Drupal with CVS
As you probably know, Drupal core and contributed modules have many updates that are hard to keep up-to-date with. It is hard to find the time to backup all your files, download the new files and move them to your server. This is where the ease and power of CVS will shine through. Updating your version of Drupal core is simple with CVS. You first use the 'cd' command to move to your site's root directory. Then you enter the command:
cvs update -r DRUPAL-5-X -dP
This performs any necessary changes to your site's core codebase, bringing it up to date with the version number that you specified. There is no need to manually download, extract and upload files. Updating contributed modules is just as easy. You again use cd to move to the specific module's directory. Then you run a command like this:
cvs update -r DRUPAL-5--x-x -dP
The contributed module is brought up to speed with whatever version number you specify. It's as simple as that.
As you can see, learning to harness the power of CVS will make your job as a Drupal site maintainer faster and easier. You can keep your site shiny, fresh and secure with the latest core and contributed updates. Good luck! Please let me know if you have any questions or comments.


a few links
mikeOct 30
I wanted to direct readers to a few other links that relate to installing Drupal via CVS: