1. 建立cvs用户和组
Create a CVS user.
endor# adduser
Enter username [a-z0-9_-]: cvs
Enter full name []: CVS User
Enter shell bash csh date no sh tcsh [sh]:
This means that anyone with the CVS user's password can access the repository without using their own username/password.
Enter home directory (full path) [/home/cvs]:
Uid [1003]:
Enter login class: default []:
Login group cvs [cvs]:
Everyone that you want to have access to the repository will belong to this group. If you already have such a group (for instance, you may have a coders group), you can use that group instead.
Login group is "cvs''. Invite cvs into other groups: guest no
[no]:
Enter password []:
Enter password again []:
Name: cvs
Password: ****
Fullname: CVS User
Uid: 1003
Gid: 1003 (cvs)
Class:
Groups: cvs
HOME: /home/cvs
Shell: /bin/sh
OK? (y/n) [y]:
Added user ``cvs''
Add another user? (y/n) [y]: n
endor#
Add any users that you wish to have access to the CVS repository to the CVS group.
cvs:*:1003:cvs,andrew
2. 创建cvs仓库
/exports/cvsroot seems to be the typical place to throw a CVS repository. As I didn't have a /exports, I created it under /usr and symlinked to it from /.
endor# mkdir /usr/exports
endor# cd /
endor# ln -s /usr/cvsroot
Create the CVS directory, owned by the user and group you just created, and writable by both.
endor# mkdir /exports/cvsroot
endor# chown cvs:cvs /exports/cvsroot
endor# chmod 775 /exports/cvsroot
As the CVS user, initialise the repository.
endor# su cvs
$ cvs -d /exports/cvsroot init
That's it! You can now use CVS as a local user, or as a remote user over SSH/RSH to import modules, add, update, commit, etc. As a local user, set the CVSROOT to /exports/cvsroot. As a remote user, set the CVSROOT to :ext:username@host:/exports/cvsroot.
If using SSH, under Unix you'll want to set CVS_RSH to ssh. From WinCvs on Windows using PuTTY, go into Admin->Preferences->Ports and type in the path to a copy of plink.exe as the "alternate rsh." Note that you'll need to set up private key authentication for this to work, as otherwise WinCvs will choke when plink asks for the password
3. 设定pserver
Pserver is an alternative to RSH/SSH access for users accessing the repository remotely.
Make sure the pserver port is in /etc/services. It already is in FBSD-4.5.
cvspserver 2401/tcp #CVS network server
Add the pserver line in /etc/inetd.conf. It's already mostly there in FreeBSD 4.5 - uncomment it and point it to /exports/cvsroot. Note that tabs are commonly used between columns, spaces between the arguments to cvs.
cvspserver stream tcp nowait root /usr/bin/cvs cvs --allow-root=/exports/cvsroot pserver
Check to see if inetd is running, and if it is, send it a HUP signal so it re-reads /etc/inetd.conf.
endor# ps ax | grep inetd
20194 ?? Is 0:00.00 /usr/sbin/inetd
endor# kill -1 20194
If it isn't running, start it ...
endor# /usr/sbin/inetd
... and add the following line to /etc/rc.conf so it will be automatically started when the system comes up.
inetd_enable="YES"
You can now access the repository remotely using the pserver. Set CVSROOT to :pserver:username@host:/exports/cvsroot. When using the pserver you'll need to do a cvs login before anything else.