Computer And Technologies

Computer And Technologies: Creating a CVS Repository(Linux/Unix)

Wednesday, 6 May 2009

Creating a CVS Repository(Linux/Unix)

Now, let's create a CVS repository. You will first need to decide on the location of the directory where you want to store the CVS repository. Here are several suggestions of directory locations for the repository:

  • /usr/local/cvsroot
  • /cvsroot
  • /home/cvsroot
  • /var/lib/cvsroot

If you want to follow the Filesystem Heirarachy Standard, (http://www.pathname.com/fhs/), then the preferred location for the repository would be: "/var/lib/cvsroot". That is the directory I will use in this example:

# mkdir /var/lib
# mkdir /var/lib/cvsroot

# chgrp cvsdev /var/lib/cvsroot
# ls -l /var/lib
total 2
drwxr-xr-x 2 root cvsdev 512 Jan 23 19:18 cvsroot

# chmod g+srwx /var/lib/cvsroot
# ls -l /var/lib
total 2
drwxrwsr-x 2 root cvsdev 512 Jan 23 19:18 cvsroot

# cvs -d /var/lib/cvsroot init
# ls -la /var/lib/cvsroot
total 6
drwxrwsr-x 3 root cvsdev 512 Jan 23 19:22 .
drwxr-xr-x 3 root other 512 Jan 23 19:18 ..
drwxrwsr-x 3 root cvsdev 1024 Jan 23 19:22 CVSROOT

# chown -R cvs /var/lib/cvsroot
# ls -l /var/lib
total 2
drwxrwsr-x 3 cvs cvsdev 512 Jan 23 19:22 cvsroot
Let's know examine the above commands:

  • We created a UNIX group named cvsdev and that will be used for group read/write to the repository. This will allow users that may be on this machine to access the repository.

  • We set the directory's SGID bit on the repository, so that files that get created in this directory have the same group ID as teh directory's group ID. (This is a very important step that can save a lot of headaches later!)

  • We made the directory group writable/readable/executable.

  • We also created a CVS repository using the command:
    cvs -d repository_root_directory init

  • For security reasons, we created a user (named cvs) to own the repository and the administrative files. We then did a chown on the respository's root directory and administrative files to that username.

No comments:

Post a Comment