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

本文详细介绍了如何在操作系统上安装并配置CVS、SVN、Git三种版本控制系统,包括安装步骤、创建用户、设置权限、初始化仓库及验证操作等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[b](一)CVS[/b]
安装xinetd
# rpm -q xinetd
# yum install xinetd
# chkconfig xinetd on
# /etc/init.d/xinetd start


安装CVS
# rpm -q cvs
cvs-1.11.23-15.el6.x86_64 (CentOS自带)
# yum install cvs


创建用户
# groupadd cvsgroup
# useradd -G wheel,cvsgroup cvsuser
# passwd cvsuser


设置
# mkdir /usr/local/cvsrepo
# cd /usr/local/cvsrepo
# cvs init
# chown -R root:cvsgroup /usr/local/cvsrepo
# chmod –R 775 /usr/local/cvsrepo

# touch /etc/xinetd.d/cvs
# vi /etc/xinetd.d/cvs
service cvspserver
{
disable = no # <-
port = 2401
socket_type = stream
protocol = tcp
wait = no
user = root
passenv = PATH
server = /usr/bin/cvs
env = HOME=/usr/local/cvsrepo
server_args = -f --allow-root=/usr/local/cvsrepo pserver
}
# chmod 644 /etc/xinetd.d/cvs
# /etc/init.d/xinetd restart


确认
# cvs -d ':pserver:root@localhost:/usr/local/cvsrepo' login
# cvs -d ':pserver:root@localhost:/usr/local/cvsrepo' logout


[b](二)SVN[/b]
安装
# yum list | grep "^subversion"
# cd /usr/local/src
# wget http://apache.fayea.com/subversion/subversion-1.8.13.tar.gz
# tar -zxvf subversion-1.8.13.tar.gz
# cd subversion-1.8.13
# ./configure --prifix=/usr/local/svn
# make
# make install
# svnserve --version


设置
# mkdir -p /usr/local/svndata
# svnadmin create /usr/local/svndata/myproj/
# cd /usr/local/svndata/myproj/
# ls -l
# cd conf
# ls -l
# vi svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = /usr/local/svndata/myproj/conf/passwd
authz-db = /usr/local/svndata/myproj/conf/authz
# vi passwd
[users]
username=password
# vi authz
[groups]
project_p = pm

[project:/]
@project_p = rw
* =


启动服务
# svnserve -d -r /usr/local/svndata/myproj/


停止服务
# ps -aux|grep svnserve
# kill -9 ID号


确认
# svn co svn://localhost/myproj


[b](三)Git[/b]
安装
# yum list | grep "^git"
# cd /usr/local/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.3.2.tar.gz
# tar -zxvf git-2.3.2.tar.gz
# cd git-2.3.2
# ./configure
# make
# make install
# git --version


设置
# touch /etc/xinetd.d/git-daemon
# vi /etc/xinetd.d/git-daemon
service git
{
disable = no # <-
socket_type = stream
wait = no
user = nobody
server = /usr/libexec/git-core/git-daemon
server_args = --base-path=/var/lib/git --export-all --user-path=public_git --syslog --inetd --verbose
log_on_failure += USERID
}
# /etc/init.d/xinetd restart


创建repository
# mkdir -p /var/lib/git/public_git/test.git/
# cd /var/lib/git/public_git/test.git/
# git --bare init --shared
# groupadd gitgroup
# usermod -G wheel,gitgroup gituser
# passwd gituser
# chown -R gituser:gitgroup /var/lib/git/


客户端确认
# cd /home/gituser/src
# mkdir test
# cd test
# echo "Git Test." > test.txt
# git init
# git add test.txt
# git commit -m "First Commit"
# git remote add test ssh://gituser@localhost:56722/var/lib/git/public_git/test.git
# git push origin master
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值