[phpwiki] Remote Access CVS

Purpose

To setup a working version control server using Concurrent Version System (cvs) and access it remotely via SSH.

Whether working alone or working in a team, keeping track of different version during development can be a real pain. While cvs is not perfect, tools such as this is essential for serious development. An alternative to cvs is svn, it offers additional functionalities. We use cvs in this exercise as it is probably the most popular and most accessible at the time of this writing. By the end of this you will have a centralized cvs accessible remotely via ssh.

Some basics features of cvs:

Always make proper backup before proceeding.
Please report problems and direct all inquiries to Contact US.


Prerequiste


Procedures

1. Installation

From a terminal console in the server, run as root or use sudo:

 # apt-get install cvs openssh-server

For the workstation, run as root or use sudo in a terminal console. We are getting cvs, openssh-client and eclipse.

 # apt-get install cvs openssh-client eclipse

2. Configuration

The following steps are done in the server. Root access or the use of sudo is required.

2.1 Create System Account, Group

CVS installation in Debian Lenny by default does not create a dedicated owner and group. But we will create a system user id 'cvs', it will be without a home directory and is login disabled. A group by the same name will be created and each user accessing the repository will need to be added to this group 'cvs'. These will be the owner of '/home/cvsroot' directory which we will create.

 # adduser --no-create-home --disabled-login --system cvs
 # addgroup --system cvs
 # adduser cvs cvs

2.2 Create CVS Repository

CVS allows for multiple repositories. A repository requires quite a bit of space, we are creating one in the home filesystem for this exercise, pick another location to suit your needs. After the creation of '/home/cvsroot', tell cvs to initialize the directory and then assign the ownership to 'cvs' user id and 'cvs' group.

 # mkdir -p /home/cvsroot
 # cvs -d /home/cvsroot init
 # cd /home
 # chown -R cvs:cvs cvsroot

2.4 Modify Binary File Handling

Tell cvs how to identify binary files and how to handle them. Modify '/home/cvsroot/CVSROOT/cvswrappers' with vi or your favourite editor.

The option -kb tells cvs it is a binary file, preventing it from inadvertent line ending conversion, keyword expansion or merging.

Add binary file extensions and the options into cvswrappers. Sample cvswrappers

	 *.GIF   -k 'b'
	 *.JPG   -k 'b'
	 *.avi   -k 'b'
	 ...
	 *.bin   -k 'b'
	 *.tbz   -k 'b'
	 *.tgz   -k 'b'
	 *.tif   -k 'b'
	 *.tiff  -k 'b'

2.4 Update Default Profile

Set the enviornment variable $CVSROOT with the cvs repository. Edit '/etc/profile' with vi or your favourite editor. Append the following to the file:

	CVSROOT="/home/cvsroot"
	export CVSROOT

Make it effective immediately:

 # source /etc/profile

2.5 Setup User Access

In the server, setup the user account and add user to the 'cvs' group.

 # adduser user cvs

note: Since we are using SSH to connect to the remote repository each time, it might be easier to authenticate using public key rather than manually entering passwords each time we connect to the repository. See SSH Key Authentication Setup in OpenSSH

2.6 Add Repository into Eclipse (Optional)


3. Test and Verify

The following are done from the remote workstation.

3.1 Setup CVS Option File

For convenience, a cvs command options file can be setup to help safe typing. We will put in a global option for the repository. Create the ~/.cvsrc file and append the following into it.

	cvs -d:extssh:user@server.domain.com:/home/cvsroot

For other servers, you can override the default by explicitly specifying the repository. So, it would be the above with import, checkout, commit, etc after it.

3.2 Import Project

Go into the module directory with the contents, import the project module.

 $ cd project/module
 $ cvs import project/module vendorTag start

For large projects, you may need to import it from the server.

3.3 Checkout Project

Move the project module first, then checkout the project. Change contents in module.

 $ mv project/module project/module.bak
 $ cvs checkout project/module
 $ cd project/module
 $ vi filename.txt

3.4 Update and Commit Changes

Try out the different actions.

 $ cvs status
   cvs status: Examining .
   ===================================================================
   File: filename.txt      Status: Locally Modified
      Working revision:    1.1
      Repository revision: 1.1     /home/user/project/module/filename.txt,v
      Commit Identifier:   EEzcPa6M32sBARdu
      Sticky Tag:          (none)
      Sticky Date:         (none)
      Sticky Options:      (none)
  ===================================================================
  File: sleep.png        	Status: Up-to-date
     Working revision:	1.1.1.1
     Repository revision:	1.1.1.1	/home/user/project/modulel/images/sleep.png,v
     Commit Identifier:	XzEORxoACpNINBdu
     Sticky Tag:		(none)
     Sticky Date:		(none)
     Sticky Options:	-kb

Notice images have the sticky option of -kb, indicating the cvswrapper is working.

 $ cvs update
   cvs update: Updating .
   M filename.txt
 $ cvs tag release-2-0
   cvs tag: Tagging .
   T filename.txt
 $ cvs commit -r 2.0
   cvs commit: Examining .
   /home/user/project/module/filename.txt,v  <--  filename.txt
   new revision: 2.0; previous revision: 1.1

Note: If you run into problem with sticky tags, use 'update -A' option to resolve it.

We are done. For further reading, please checkout the references.


References


Page locked (last edited December 7, 2009) [info] [diff])
FindPage by browsing or searching
5 best incoming links: FrontPage (4)
5 best outgoing links:
5 most popular nearby: FrontPage (2048)