Wednesday, June 23, 2010

Setting up CVS on Solaris 10





     Having worked on multiple workstations,I often have issues related to versioning of data, availability of data. Have tried on many windows freewares for file sychonization. But that introduced lot of compatibility issues between OS and were relatively very slow to work. So, switched to the traditional way ie, the CVS way. Having setting up the CVS successfully, I am sharing the steps here.

Getting the dependency packages


1. libintl-3.4.0-sol10-sparc-local.gz 
2. libiconv-1.13.1-sol10-sparc-local.gz 
3. libgcc-3.4.6-sol10-sparc-local.gz
4. cvs-1.12.13-sol10-sparc-local.gz

Here I have used SPARC binaries. If you are using x86/x64 hardware, you can download the specific binaries from the same source.

Installation 

bash-3.00# gunzip libgcc-3.4.6-sol10-sparc-local.gz
bash-3.00# gunzip libintl-3.4.0-sol10-sparc-local.gz libiconv-1.13.1-sol10-sparc-local.gz cvs-1.12.13-sol10-sparc-local.gz
bash-3.00# pkgadd -d libgcc-3.4.6-sol10-sparc-local
bash-3.00# pkgadd -d libintl-3.4.0-sol10-sparc-local
bash-3.00# pkgadd -d libiconv-1.13.1-sol10-sparc-local
bash-3.00# pkgadd -d cvs-1.12.13-sol10-sparc-local

Add /usr/local/bin to PATH

/etc/profile
PATH=/usr/local/bin:/usr/X11/bin:/usr/openwin/bin:/export/home/fenxi-2.1a/dist/s
export LOGNAME PATH

launch new terminal

Setting up the Filesystem

bash-3.00# newfs /dev/dsk/c0t1d0s7 
bash-3.00# mount /dev/dsk/c0t1d0s7 /mydisk

Avaliability feature is not available in this setup. If you are concerned of the Disk failures then follow this blog entry Enabling High Availability in Solaris 10 via SVM(Solaris Volume Manager)

Adding group and user

bash-3.00# groupadd cvs
bash-3.00# useradd -m -g cvs -s /bin/bash -d /users/cvs cvs
bash-3.00# passwd cvs

CVS Initialization

bash-3.00# chgrp cvs /mydisk/cvsroot/
bash-3.00# chmod g+srwx /mydisk/cvsroot/
bash-3.00# cvs -d /mydisk/cvsroot/ init
bash-3.00# chown -R cvs:cvs /mydisk/cvsroot/
bash-3.00# ls -la /mydisk/cvsroot/
total 6
drwxr-xr-x   3 cvs      cvs          512 May 26 00:21 .
drwxr-xr-x   4 root     root         512 May 26 00:19 ..
drwxrwxr-x   3 cvs      cvs         1024 May 26 00:21 CVSROOT

Adding Environment Variables

bash-3.00# su - cvs
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
-bash-3.00$ cd
-bash-3.00$ pwd
/users/cvs
-bash-3.00$ more .bash_profile
CVSROOT=/mydisk/cvsroot
export CVSROOT
CVSEDITOR=/bin/vi
export CVSEDITOR

Add User entries to passwd file for PSERVER protocol

-bash-3.00$ su - root

Perl script
-----------
#!/usr/bin/perl
$cvsroot="/mydisk/cvsroot";
$user = shift @ARGV || die "cvspasswd user\n";
print "Enter password for $user: ";
system "stty -echo";
chomp ($plain = <>);
system "stty echo";
print "\n";
@chars = ('A'..'Z', 'a'..'z', '0'..'9');
$salt = $chars[rand(@chars)] . $chars[rand(@chars)];
$passwd = crypt($plain, $salt);
open(PASSWD,">>$cvsroot/CVSROOT/passwd") || die("Cannot Open File");
print PASSWD "$user:$passwd:cvs\n";
close PASSWD;
#-End

bash-3.00# perl myperl.pl user1
Enter password for laptop:
bash-3.00# perl myperl.pl user2
Enter password for ofmac1:
bash-3.00# cat /mydisk/cvsroot/CVSROOT/passwd
user1:xxxxxxxxxxxxx:cvs
user2:xxxxxxxxxxxxx:cvs

For security reasons make sure only root has the permission to passwd file.

Add the following lines to /etc/services file

more /etc/services
cvspserver 2401/tcp # CVS Client/server operations
cvspserver 2401/udp # CVS Client/server operations

Moving Inetd entries to SMF services

using file cvs_inetd to hold the inetd entry
bash-3.00# more cvs_inetd
cvspserver stream tcp nowait cvs /usr/local/bin/cvs -f --allow-root=/mydisk/cvsroot pserver
bash-3.00# inetconv -f -i ./cvs_inetd
cvspserver -> /var/svc/manifest/network/cvspserver-tcp.xml
Importing cvspserver-tcp.xml ...Done

Changes /var/svc/profile/inetd_services.xml

Add the following lines to /var/svc/profile/inetd_services.xml

<service name='network/cvspserver-tcp' version='1' type='service'>
<instance name='default' enabled='true'/>
</service>

Restart Network Service

svcadm restart svc:/network/inetd:default

CVS is ready and waiting for client to connect at port 2401.

Command line CVS access
cvs -d :pserver:user1@machinename:2401/mydisk/cvsroot checkout project1

GUI based access


1 comment: