Difference between revisions of "Concurrent Versions System"

From ArchWiki
Jump to: navigation, search
m (Section 06 had cvs initialise command arranged incorrectly.)
(Cleaned up the page, as it was much needed.)
Line 2: Line 2:
 
[[Category:HOWTOs (English)]]
 
[[Category:HOWTOs (English)]]
  
01) Open up a shell
+
This is a guide to setup the latest CVS server on the latest Arch Linux machine. Best of luck.
  
 +
== Installation ==
  
02) su to root
+
Update or install to the latest version of cvs and xinetd (as root):
 +
# pacman -Sy cvs xinetd
  
  
03) Make sure you have the latest version of CVS
+
Create the cvs group - members of this group will have write access to the repository (as root):
  pacman -Sy cvs
+
  # groupadd cvs
  
  
04) Make sure you have the latest version of xinetd
+
Create the cvs user in the cvs group (-md makes the home directory) (as root):
  pacman -S xinetd
+
  # useradd -md /home/cvsroot -g cvs -p Insecure0 cvs
  
  
05) Now create the directory that will become your CVS repository.
+
== Initialization ==
mkdir /home/cvsroot
+
  
 +
Initialize your CVS repository (as cvs):
 +
cvs% cvs -d /home/cvsroot init
  
06) Initialize your CVS repository
 
cvs -d /home/cvsroot init
 
  
 +
The permissions on the directory (not the files inside, however) should be 2775 (drwxrwxr-x), but if not, run (as cvs):
 +
cvs% chmod 2775 /home/cvsroot
  
07) Create a group called cvs - members of this group will have write access to the repository
 
groupadd cvs
 
  
 +
Add any users that you want to have local access to the repository to the group cvs by using the following two steps. The 'adduser' script is very handy.
  
08) Create a user named cvs
 
useradd -d /home -g cvs -p password cvs
 
  
 +
You can add pre-existing users to the cvs group with the command (as root):
 +
# gpasswd -a username cvs
  
09) Set the owner and group of the repository
 
chown -R cvs:cvs /home/cvsroot
 
  
 
+
Make a file in /etc/xinetd.d/ called cvspserver with these contents (as root):
10) Set the proper permissions for the repository(set group ID, owner: read write execute, group: read write execute, others: read execute)
+
chmod 2775 /home/cvsroot
+
 
+
 
+
Add any users that you want to have local access to the repository to the group cvs by using the following two steps.
+
 
+
 
+
11) Get a list of the groups for a user.
+
groups someuser
+
 
+
 
+
12) Set the groups for the user. The group1 group2 etc. are the groups you got from the previous step. '''NOTE: make sure not to use spaces when listing the additional groups'''
+
usermod -g users -G group1,group2,group3,cvs someuser
+
 
+
 
+
13) Make a file in /etc/xinetd.d/ called cvspserver with these contents:
+
  
 
  service cvspserver
 
  service cvspserver
Line 65: Line 49:
 
  }
 
  }
  
14) Edit /etc/services and add cvspserver service if does not exist:
 
cvspserver 2401/tcp #CVS PServer
 
  
 +
Edit /etc/services and add this line containing the information for cvspserver service if does not exist (as root):
 +
cvspserver 2401/tcp    #CVS PServer
  
15) Create some files in CVSROOT
+
Edit /etc/hosts.allow and add this line to allow users to connect (as root):
  /home/cvsroot/CVSROOT/passwd  # user and passwd, refer to the following
+
cvs:ALL
 
+
  anonymous::
+
  lnzju:YKy0EJBP5vDpY:cvs
+
  
 +
Now restart xinetd (as root):
 +
/etc/rc.d/xinetd restart
 +
 +
== Configuration ==
  
  /home/cvsroot/CVSROOT/writers  #  users that have write permission of the repository,every user take a newline
+
Become cvs ("su cvs") and create a 'passwd' file in ~/CVSROOT:
  lnzju
+
  # Format is username:password:group
  /home/cvsroot/CVSROOT/readers # users that have read permission of the repository,every user take a newline
+
  anonymous
+
 
+
16)Allow clients to connect to the Server
+
edit /etc/hosts.allow ,add a newline ,as the following
+
 
   
 
   
  cvs:ALL
+
anonymous::
 +
luser:HopefullySecure0:cvs
 +
other:Insecure0:cvs
  
  
17) You must unset the variable HOME before you restart xinetd
+
Now create a 'writers' file in ~/CVSROOT, which grants write privileges to the users you created in 'passwd':
  unset HOME
+
  luser
 +
other
  
  
18) Restart the xinetd server
+
Now create a 'readers' file in ~/CVSROOT, which grants read privileges to the users you created in 'passwd':
  /etc/rc.d/xinetd restart
+
  anonymous
 +
 
  
 +
== Use ==
  
 
You can test out the server using the following commands:
 
You can test out the server using the following commands:

Revision as of 20:45, 23 January 2008


This is a guide to setup the latest CVS server on the latest Arch Linux machine. Best of luck.

Installation

Update or install to the latest version of cvs and xinetd (as root):

# pacman -Sy cvs xinetd


Create the cvs group - members of this group will have write access to the repository (as root):

# groupadd cvs


Create the cvs user in the cvs group (-md makes the home directory) (as root):

# useradd -md /home/cvsroot -g cvs -p Insecure0 cvs


Initialization

Initialize your CVS repository (as cvs):

cvs% cvs -d /home/cvsroot init


The permissions on the directory (not the files inside, however) should be 2775 (drwxrwxr-x), but if not, run (as cvs):

cvs% chmod 2775 /home/cvsroot


Add any users that you want to have local access to the repository to the group cvs by using the following two steps. The 'adduser' script is very handy.


You can add pre-existing users to the cvs group with the command (as root):

# gpasswd -a username cvs


Make a file in /etc/xinetd.d/ called cvspserver with these contents (as root):

service cvspserver
{
        port            = 2401
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        passenv         = /home/cvsroot
        server          = /usr/bin/cvs
        server_args     = -f --allow-root=/home/cvsroot pserver
}


Edit /etc/services and add this line containing the information for cvspserver service if does not exist (as root):

cvspserver 2401/tcp     #CVS PServer

Edit /etc/hosts.allow and add this line to allow users to connect (as root):

cvs:ALL

Now restart xinetd (as root):

/etc/rc.d/xinetd restart

Configuration

Become cvs ("su cvs") and create a 'passwd' file in ~/CVSROOT:

# Format is username:password:group

anonymous::
luser:HopefullySecure0:cvs
other:Insecure0:cvs


Now create a 'writers' file in ~/CVSROOT, which grants write privileges to the users you created in 'passwd':

luser
other


Now create a 'readers' file in ~/CVSROOT, which grants read privileges to the users you created in 'passwd':

anonymous


Use

You can test out the server using the following commands:

export CVSROOT=:pserver:my_user_name@127.0.0.1:/home/cvsroot
cvs login
mkdir ~/sandbox
mkdir ~/sandbox/myproject
cd ~/sandbox/myproject
echo "this is a sample file" > myfile
cvs import -m "description of myproject" myproject v1 r1
cd ..
rm -R myproject
cvs checkout myproject
cd myproject
echo "some changes to the file" >> myfile
cvs commit -m "Explain changes here" myfile