Steps:
1. install cvs and xinetd on the server
$yum install cvs$yum install xinetd
NOTE: check whether cvs (or xinetd) has been installed:
$rpm -qa | grep cvs
create your CVS home repository:
mkdir /var/local/cvshome
add it as CVSROOT and export to profile
vim /etc/profile
##add line
export CVSROOT=/var/local/cvshome
2. set up cvs group and user on the server:
$groupadd cvsusers$useradd -g cvsusers -G cvsusers -d /var/local/cvshome cvsadmin
$passwd cvsadmin # set up password for cvsadmin
Add harun to the cvs group:
$usermod -G harun cvsusers
Check whether harun is in the cvs group:
$groups harun
3. change owner of /home/cvsroot if necessary, chmod for /home/cvsroot:
$chown -R cvsadmin:cvsusers /var/local/cvshome$chmod -R 775 /var/local/cvshome
4. initialize cvs:
(login as cvsroot)$cd /var/local/cvshome
$cvs -d /var/local/cvshome init # full path is required
$chmod 644 /var/local/cvshome/CVSROOT/config
5. create file for CVS self-startup, as xinetd type
(login as root)$cd /etc/xinetd.d
$cp cvs cvspserver
$vim cvspserver # do the following modifications:
# default: off
# description: The CVS service can record the history of your source \
# files. CVS stores all the versions of a file in a single \
# file in a clever way that only stores the differences \
# between versions.
service cvspserver
{
disable = no # modify
port = 2401
socket_type = stream
protocol = tcp
wait = no
user = root
passenv = PATH
server = /usr/bin/cvs
env = HOME= /var/local/cvshome # modify
server_args = -f –allow-root= /var/local/cvshome pserver # modify
}
If you want to create multiple repository, add an additional --allow-root=[repository path] argument for each repository.
6. add CVS as a service:
$vim /etc/servicesAdd two lines if not in the file:
cvspserver 2401/tcp #pserver cvs service
cvspserver 2401/udp #pserver cvs service
7. restart xinetd:
$/etc/init.d/xinetd restart8. check if cvspserver has started
$netstat -anlp |grep cvspservershould return:
tcp 0 0 *:cvspserver *:* LISTEN
9. manage users (Optional)
$cp /etc/shadow /home/cvsroot/CVSROOT/passwd # owner of passwd should be cvsroot:cvs($cd /home/cvsroot/CVSROOT)
$chmod 644 passwd
modify passwd, delete all lines except users cvsroot and mike (you can keep some lines if needed)
for every line, delete all the content after the second “:”, and append cvsroot to that “:”
10. on client c.com, log in to the CVS server:
$export CVSROOT=:pserver:harun@s.com:2401/var/local/cvshome$cvs login
11. on client c.com, import a project /home/mike/myproject onto CVS server:
$cd /home/harun/myproject$cvs import -m “my project” myproject harun start
12. errors:
1) As follows:[mike@c.com ~]$ cvs -d :pserver:mike@s.com:/home/cvsroot login
Logging in to :pserver:mike@s.com:2401/home/cvsroot
CVS password:
cvs [login aborted]: unrecognized auth response from localhost: cvs pserver: cannot open /home/cvsroot/CVSROOT/config: Permission denied
Solution: turn off SELinux on s.com.
Turn it off now:
$setenforce 0
Turn it off after next restart:
$vim /etc/selinux/config
modify SELINUX=enforcing to
SELINUX=disabled
//Or can be another solution
- At this point, CVS has been configured but SELinux will still deny logins and file access. To demonstrate this, set the
$CVSROOTvariable oncvs-clientand try to log in remotely. The following step should be performed oncvs-client:[cvsuser@cvs-client]$
export CVSROOT=:pserver:cvsuser@192.168.1.1:/cvs[cvsuser@cvs-client]$ [cvsuser@cvs-client]$cvs loginLogging in to :pserver:cvsuser@192.168.1.1:2401/cvs CVS password: ******** cvs [login aborted]: unrecognized auth response from 192.168.100.1: cvs pserver: cannot open /cvs/CVSROOT/config: Permission deniedSELinux has blocked access. In order to get SELinux to allow this access, the following step should be performed oncvs-srv: - Change the context of the
/cvs/directory as the root user in order to recursively label any existing and new data in the/cvs/directory, giving it thecvs_data_ttype:[root@cvs-srv]#
semanage fcontext -a -t cvs_data_t '/cvs(/.*)?'[root@cvs-srv]#restorecon -R -v /cvs
2) As follows:
[mike@c.com ~]$ cvs login
Logging in to :pserver:mike@s.com:2401/home/cvsroot
CVS password:
cvs [login aborted]: connect to [s.com]:2401 failed: No route to host
Solution: turn off firewall on s.com, or allow 2401 port in the firewall
Turn off firewall now:
service iptables stop
Turn off firewall after next restart:
$chkconfig iptables off # or $/sbin/chkconfig –level 2345 iptables off
Check firewall status:
$/etc/init.d/iptables status
Comments