Friday, July 11, 2008

CVS: Install on Linux Enterprice 5

The version I download is cvs-1.11.23.tar.gz
Create new folder for CVS
1. Create folder under /opt called "cvs".
2. Copy the file cvs-1.11.23.tar.gz to /opt/cvs
3. Create folder under root called "cvs".
4. Create folder under /cvs called cvsroot

Create new group and user:
1. Create group cvs: groupadd cvs
2. useradd -g cvs -G cvs -d /cvs/cvsroot cvsuser
3. Add password: passwd cvsuser

Change folder owner and group to cvs and cvsuser
1. chgrp -R cvs /cvs
2. chown -R cvsuser /cvs
3. chmod 775 /cvs/cvsroot

Install CVS:
1. Go back to /opt/cvs (Should have the cvs-1.11.23.tar.gz in there)
2. Enter: gunzip cvs.tar.gz
3. Enter: tar -xf cvs.tar
4. Enter: ./configure
5. Enter: make
6. Enter: make install

Setup initial state in /cvs/cvsroot
Enter: cvs -d /cvs/cvsroot init (This will create a CVSROOT and related file under CVSROOT folder).

Create password for user:
1. Enter: vi /cvs/cvsroot/CVSROOT/passwdgen.pl
Content in file should be:

#!/usr/bin/perl
  srand (time());
  my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
  my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
  my $plaintext = shift;
  my $crypttext = crypt ($plaintext, $salt);
  print "${crypttext}\n";


2. Save it.
3. Create a encrypted password: For exampel if password in plant text is "test"
Enter: ./passwdgen.pl "test"
4. Enter: vi /cvs/cvsroot/CVSROOT/passwd
Content should be:
username1:encrptedpassword1:cvsroot
username2:encrptedpassword2:cvsroot

Create Service for CVS:
1. Enter: vi /etc/services
2. Add following tow line in proper placs and save it.

cvspserver 2401/tcp #pserver cvs service
  cvspserver 2401/udp #pserver cvs service

3. Go to: cd /etc/xinetd.d
4. Enter: vi cvspserver
Content should be like this:

service cvspserver
  {
disable = no
port = 2401
socket_type = stream
protocol = tcp
wait = no
user = root
#user = cvsuser
group = cvs
passenv = PATH
server = /usr/bin/cvs
#server = /opt/cvs/cvs-1.11.23
#env = HOME=/var/cvs
#server_args = -f --allow-root=/var/cvs pserver
server_args = -f --allow-root=/cvs/cvsroot pserver
# bind = 127.0.0.1
  }

5. Save it.
6. Restart service: /etc/rc.d/init.d/xinetd restart
7. Check if cvs is running: netstat -l |grep cvspserver
8. Result should be like this:
tcp 0 0 *:cvspserver *:* LISTEN
9. Log into CVS
cvs -d :pserver:username1@202.204.114.37:/cvs/cvsroot login

10. Set path
PATH=$PATH:/usr/bin
export PATH
CVSROOT=/home/cvsroot
export CVSROOT

If we want to move old projects to new projects.
1. Copy from old machine /cvs/cvsroot to new machine /cvs/cvsroot
2. Change group and owner:
chgrp -R cvs /cvs
chown -R cvsuser /cvs

2 comments: