Help:RCS

From OpenLiteSpeed
Jump to: navigation, search

OpenLiteSpeed comes with RCS integration starting in version 1.4. This wiki explains what RCS is and the basics of how to use it with OpenLiteSpeed.

What is RCS?

Revision Control System (RCS) is a software for managing multiple revisions of files. It was created by Walter F. Tichy of Purdue University in 1982.

Installing RCS

RCS is installed by default on many but not all OSs. If your system does not have RCS, you can generally install it with a package manager like yum or APT.

RCS yum search.png

Note: If you do not have RCS installed, you will see the following error when starting OpenLiteSpeed 1.4 from the command line: sh: ci: command not found. This error can be ignored if you do not want to use RCS.

RCS start error.png

RCS Use in OpenLiteSpeed

OpenLiteSpeed uses RCS to keep track of changes in configuration files. RCS keeps a log of all changes in configuration files and allows users to easily switch back to older configurations. Changes made in configurations are saved to the appropriate RCS file every time OpenLiteSpeed is reset.

We will review some common commands for RCS and the method for reverting back to a previous version of an OpenLiteSpeed configuration file. Full documentation for RCS can be found from GNU.

Basic Background

RCS is a simple version control system. It creates an RCS file for each file being worked on (the files being worked on are called "working files"). In OpenLiteSpeed's use of RCS, all RCS files end in 0,v. RCS files are stored in the same directory as the configuration files they apply to.

RCS uses the checkin ci and checkout co commands to control what version of the configuration you use. This wiki will only show use of the checkout command because it is necessary for restoring a previous configuration.

Viewing the RCS File

The rlog command allows you to see how many versions the RCS file contains and how many lines were edited in each change.

cd /usr/local/lsws/conf
rlog httpd_config.conf0,v
RCS files.png
RCS rlog.png

In the screenshot above, we can see that there are three versions (1.1, 1.2, and 1.3) of the configuration file we are looking at. Version 1.3 (the latest version) is the configuration file we are using now.

Viewing Differences in the Different Versions

The rcsdiff command allows you to view differences in the different versions. With OpenLiteSpeed, the command must be used with the -r option to stipulate which versions are to be compared. The user must stipulate two versions. In OpenLiteSpeed's implementation (because the RCS files have slightly different names than the working files), a version may not be compared to the working file.

rcsdiff -r1.2 -r1.3 httpd_config.conf0,v
RCS rcsdiff.png

In the screenshot above, we can see that only the Max Keep-Alive Requests setting was changed.

Reverting to a Previous Version

Use the co (checkout) command to create a new file from a previous version in your RCS file.

co -r1.2 httpd_config.conf0,v
RCS co.png

This creates a new file with just a 0 at the end. To revert to this version of your configurations, you will have to replace you current configuration file with this new file.

mv httpd_config.conf0 httpd_config.conf
RCS mv.png

The new file, though, does not have the correct permissions and ownership to be read and modified by the WebAdmin console (which runs as the user lsadm). Update the permissions and ownership to match other configuration files.

chown lsadm:lsadm httpd_config.conf
chmod 600 httpd_config.conf
RCS chmod.png

Finally, restart OpenLiteSpeed to save your changes.