第一步:CVS安裝
| 代碼如下 |
複製代碼 |
| sudo apt-get install cvs |
初始化CVS
| 代碼如下 |
複製代碼 |
|
$ sudo cvs -d /var/lib/cvsd/cvsroot init
$ sudo apt-get install cvsd |
當前的使用者能在建立的目錄下,最好跳出到根目錄。
第二步: CVS伺服器的配置
安裝完之後的第一件事就是要配置CVS伺服器的設定檔,使其能正常的工作。首先在/etc/services檔案中添加cvspserver,使其成為Linux的一種服務也就是cvs伺服器常式的入口,配置如下:
| 代碼如下 |
複製代碼 |
|
cvspserver 2401/tcp # cvs client/server operations
cvspserver 2401/udp # cvs client/server operations |
如果檔案中已經存在上面的兩行文字,就不用添加了。
配置完畢
| 代碼如下 |
複製代碼 |
|
/etc/init.d/cvsd start |
第三步.建立cvs使用者組和cvsroot使用者
| 代碼如下 |
複製代碼 |
|
groupadd cvs
useradd cvsroot –g cvs
passwd cvsroot
chown -R cvsroot:cvs /backup/cvsroot/
chmod 755 /backup/cvsroot/ |
建立檔案passwd
| 代碼如下 |
複製代碼 |
|
htpasswd -c /backup/cvsroot/CVSROOT/passwd yuexiaosheng |
yuexiaosheng是登陸cvs伺服器的使用者名稱
如果再加一個使用者
| 代碼如下 |
複製代碼 |
| htpasswd -bc /backup/cvsroot/CVSROOT/passwd yuexaosheng2 123456 |
CVS系統預設使用system user 登陸,需做如下修改:
[1]開啟 /home/cvsroot/CVSROOT/config
| 代碼如下 |
複製代碼 |
將第二行的
#SystemAuth = no
去掉注釋,即改為
SystemAuth = no |
[2]開啟/home/cvsroot/CVSROOT/passwd
在yuexiaosheng:xxxxx後面加上:cvsroot,即
| 代碼如下 |
複製代碼 |
| yuexiaosheng:xxxxx:cvsroot |
這樣就可以使用使用者名稱yuexiaosheng登入了(而不必使用系統使用者cvsroot).
第四步:使用xinetd方式啟動服務
發現我的ubutun下沒有xinetd
| 代碼如下 |
複製代碼 |
| apt-get install xinetd |
在目錄/etc/xinetd.d下建立並編輯檔案cvspserver,該檔案名稱必需與上面的/etc/services中的cvspserver名字一致
| 代碼如下 |
複製代碼 |
cd /etc/xinetd.d
vim cvspserver
|
檔案內容:(這裡必需注意,所有的等號兩邊都必須有一個空格!否則找不到服務)
| 代碼如下 |
複製代碼 |
service cvspserver
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/bin/cvs
server_args = -f –allow-root=/backup/cvsroot pserver
log_on_failure += USERID
} |
重新啟動xinetd
| 代碼如下 |
複製代碼 |
[root@localhost ~]# /etc/init.d/xinetd restart
|
停止 xinetd: [ 確定 ]
啟動 xinetd: [ 確定 ]
檢查cvspserver服務是否已經啟動
| 代碼如下 |
複製代碼 |
[root@localhost ~]# netstat -l|grep cvspserver
tcp 0 0 *:cvspserver *:* LISTEN |
用Eclipse測試一下
成功啦。