File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_setup_a_cvs_server.mdwn
Revision 1.4: download - view: text, annotated - select for diffs
Wed Sep 9 14:28:56 2020 UTC (4 months, 2 weeks ago) by kim
Branches: MAIN
CVS tags: HEAD
Use man template



#  What is CVS 

CVS is an abbreviation for Concurrent Versions System. 

#  Requirements 

Nothing. CVS comes with the NetBSD base installation. 

#  Setting up the repository 

First decide where you want to store all cvs repositories. Let's take /usr/cvsrepositories 
    # mkdir /usr/cvsrepositories

Now you can create directories for different projects. 
    # cd /usr/cvsrepositories
    # mkdir mycompany
    # mkdir myprivatestuff

This projects must have chmod 770 to separate them from each other. 
    # chmod 770 mycompany
    # chmod 770 myprivatestuff

#  Creating user groups 

You should create a group for projects, where people are working together. 
    # group add mycompanyname

You should now assign this group to the project directory they belong. 
    # cd /usr/cvsrepositories
    # chgrp mycompanyname mycompany/

#  cvs init 

Before you can either checkout or import anything, you have to init your projects root directory. To keep the path short for the CVSROOT environment variable, I recommend using symlinks to the repository from the root /. 
    # cd /
    # ln -s /usr/cvsrepositories/mycompany mycompany

Now create the cvs repository using 
    # cvs -d /mycompany/ init

#  Creating users 

Now create users that are allowed to check out from your repository. Keep company workers in the group you have created before. 
    # useradd -G mycompanyname -m john

And set a password for the user john 
    # passwd john

It's your decision if you want to grant the users shell access or not. 

#  Setting environment variables 

Please set the environment variables CVSROOT and CVS_RSH. Bash or ksh users please use export. 
    # export
    # export CVS_RSH=ssh

csh users set it like this: 
    # setenv CVSROOT
    # setenv CVS_RSH ssh

As you can see we use ssh as the transport protocol. This is recommended. Keep your transfers encrypted. 

#  Initial check in 

You should now proceed with the the initial check in of your (code)work. You can do this from another server aswell. Don't forget to set the environment variables there too. 

Now please change into the directory you wish to import initially. 
    # cd myproject

and import it to your cvs server. 
    # cvs import -m "myproject initial import" myproject myproject initial

this should produce an output like this: 
    N myproject/test.c
    N myproject/test.h
    N myproject/mi/mi.h
    N myproject/md/md.h
    No conflicts created by this import

#  checkout 

To checkout the work, set your environment variables and enter 
    # cvs co -PA myproject

This will checkout myproject. 

#  ssh config 

Please configure your ssh client to fit your need in .ssh/config, like using a different ssh port than 22. 

That's it. For more information about [[!template id=man name="cvs" section="1"]] and using it please read the manpage. 

#  See also 

  * [[!template id=man name="cvs" section="1"]]
  * [[!template id=man name="groupadd" section="8"]]
  * [[!template id=man name="useradd" section="8"]]

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb