搭建 CentOS 6 服务器(14) - CVS、SVN、Git

本文介绍了如何在Linux环境下安装配置CVS、SVN和Git三种版本控制系统,并提供了详细的步骤说明,包括安装依赖软件包、配置服务、创建用户及权限设置等。
(一)CVS 
安装xinetd 
Shell代码  收藏代码
  1. # rpm -q xinetd  
  2. # yum install xinetd  
  3. # chkconfig xinetd on  
  4. # /etc/init.d/xinetd start  


安装CVS 
Shell代码  收藏代码
  1. # rpm -q cvs  
  2.     cvs-1.11.23-15.el6.x86_64 (CentOS自带)  
  3. # yum install cvs  


创建用户 
Shell代码  收藏代码
  1. # groupadd cvsgroup  
  2. # useradd -G wheel,cvsgroup cvsuser  
  3. # passwd cvsuser  


设置 
Shell代码  收藏代码
  1. # mkdir /usr/local/cvsrepo  
  2. # cd /usr/local/cvsrepo  
  3. # cvs init  
  4. # chown -R root:cvsgroup /usr/local/cvsrepo  
  5. # chmod –R 775 /usr/local/cvsrepo  
  6.   
  7. # touch /etc/xinetd.d/cvs  
  8. # vi  /etc/xinetd.d/cvs  
  9.     service cvspserver  
  10.     {  
  11.         disable                 = no      # <-  
  12.         port                    = 2401  
  13.         socket_type             = stream  
  14.         protocol                = tcp  
  15.         wait                    = no  
  16.         user                    = root  
  17.         passenv                 = PATH  
  18.         server                  = /usr/bin/cvs  
  19.         env                     = HOME=/usr/local/cvsrepo  
  20.         server_args             = -f --allow-root=/usr/local/cvsrepo pserver  
  21.     }  
  22. # chmod 644 /etc/xinetd.d/cvs  
  23. # /etc/init.d/xinetd restart  


确认 
Shell代码  收藏代码
  1. # cvs -d ':pserver:root@localhost:/usr/local/cvsrepo' login  
  2. # cvs -d ':pserver:root@localhost:/usr/local/cvsrepo' logout  


(二)SVN 
安装 
Shell代码  收藏代码
  1. # yum list | grep "^subversion"  
  2. # cd /usr/local/src  
  3. # wget http://apache.fayea.com/subversion/subversion-1.8.13.tar.gz  
  4. # tar -zxvf subversion-1.8.13.tar.gz  
  5. # cd subversion-1.8.13  
  6. # ./configure --prifix=/usr/local/svn  
  7. # make  
  8. # make install  
  9. # svnserve --version  


设置 
Shell代码  收藏代码
  1. # mkdir -p /usr/local/svndata  
  2. # svnadmin create /usr/local/svndata/myproj/  
  3. # cd /usr/local/svndata/myproj/  
  4. # ls -l  
  5. # cd conf  
  6. # ls -l  
  7. # vi svnserve.conf  
  8.     [general]  
  9.     anon-access = none  
  10.     auth-access = write  
  11.     password-db = /usr/local/svndata/myproj/conf/passwd  
  12.     authz-db = /usr/local/svndata/myproj/conf/authz  
  13. # vi passwd  
  14.     [users]  
  15.     username=password  
  16. # vi authz  
  17.     [groups]  
  18.     project_p = pm  
  19.       
  20.     [project:/]  
  21.     @project_p = rw  
  22.     * =  


启动服务 
Shell代码  收藏代码
  1. # svnserve -d -r /usr/local/svndata/myproj/  


停止服务 
Shell代码  收藏代码
  1. # ps -aux|grep svnserve  
  2. # kill -9 ID号  


确认 
Shell代码  收藏代码
  1. # svn co svn://localhost/myproj  


(三)Git 
安装 
Shell代码  收藏代码
  1. # yum list | grep "^git"  
  2. # cd /usr/local/src  
  3. # wget https://www.kernel.org/pub/software/scm/git/git-2.3.2.tar.gz  
  4. # tar -zxvf git-2.3.2.tar.gz  
  5. # cd git-2.3.2  
  6. # ./configure  
  7. # make  
  8. # make install  
  9. # git --version  


设置 
Shell代码  收藏代码
  1. # touch /etc/xinetd.d/git-daemon  
  2. # vi /etc/xinetd.d/git-daemon  
  3.     service git  
  4.     {  
  5.         disable         = no      # <-  
  6.         socket_type     = stream  
  7.         wait            = no  
  8.         user            = nobody  
  9.         server          = /usr/libexec/git-core/git-daemon  
  10.         server_args     = --base-path=/var/lib/git --export-all --user-path=public_git --syslog --inetd --verbose  
  11.         log_on_failure  += USERID  
  12.     }  
  13. # /etc/init.d/xinetd restart  


创建repository 
Shell代码  收藏代码
  1. # mkdir -p /var/lib/git/public_git/test.git/  
  2. # cd /var/lib/git/public_git/test.git/  
  3. # git --bare init --shared  
  4. # groupadd gitgroup  
  5. # usermod -G wheel,gitgroup gituser  
  6. # passwd gituser  
  7. # chown -R gituser:gitgroup /var/lib/git/  


客户端确认 
Shell代码  收藏代码
  1. # cd /home/gituser/src  
  2. # mkdir test  
  3. # cd test  
  4. # echo "Git Test." > test.txt  
  5. # git init  
  6. # git add test.txt  
  7. # git commit -m "First Commit"  
  8. # git remote add test ssh://gituser@localhost:56722/var/lib/git/public_git/test.git  
  9. # git push origin master  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值