如何在linux環境下搭建CVS伺服器

來源:互聯網
上載者:User

1

、下載源碼

  

CVS
的官方網站
cvshome.org
上尋找,由於
CVS
曆史上也出現過一些安全性漏洞,所以建議要定期去其官方網站上看看有沒有最新版本推出。

  
2

、編譯安裝

  
# tar -xjpvf cvs-1.12.5.tar.bz2

  
# cd cvs-1.12.5

  
# ./configure --prefix=/usr/local/terry_yu/cvs
 
--disable-server-flow-control

  
# make

  
# make install

  以上指令將
CVS
安裝到
/usr/local/terry_yu/cvs
這個目錄上。

  註:除了使用源碼包進行安裝之外,還可以使用
RPM
包來安裝。

  
3

、設定啟動

CVS

服務

  在
Linux

CVS
服務可以通過
inetd

xinetd

tcpwrapper
等來啟動,其中
inetd
由於安全理由在許多場合已經被
xinetd
所取代了,這裡我們使用
xinetd
來啟動
CVS
服務。

/etc/xinetd.d
目錄下為
CVS
服務建立一個設定檔,比如:
/etc/xinetd.d/cvspserver
,編輯
/etc/xinetd.d/cvspserver
,輸入以下內容:

  
service cvspserver

  
{

  
disable = no

  
socket_type = stream

  
wait = no

  
user = root

  
env = HOME=

  
server = /usr/bin/cvs

  
server_args = -f --allow-root=/home/cvsroot pserver

  
}

註:
1)pserver
表示是口令認證的訪問方式,這是最常用的方式,其他還有
gserver,kserver,ext
,如果想要更高的安全性可以使用
ssh
來加密口令和資料流,為了使用者使用的方便,仍然選的是
pserver

        2)--allow-root
是指定
Repository
的目錄,可以建立多個
Repository

    然後重啟
xinetd:

  
[root@terry bin]# /etc/rc.d/init.d/xinetd restart


  重啟
xinetd
服務後,
CVS
服務也開始工作了。


  
4

、在

CVS

伺服器端建立

Repository


  首先要建立一個名為
cvs
的組和一個名為
cvsroot
的使用者,以後要訪問
CVS
服務的使用者加入
cvs
這個組:


  
[root@terry root]# groupadd cvs

  
[root@terry root]# useradd -g cvs -s /sbin/nologin cvsroot

  
[root@terry root]# chown -R cvsroot /cvs

  接下來進行初始化:


  
[root@terry root]# cvs -d /home/cvsroot init

  這樣在
/home/cvsroot
目錄中就產生了
CVSROOT
目錄,其中存放了一些設定檔,如
config
等,然後設定許可權:


  
[root@terry root]# chown -R cvsroot.cvs /home/cvsroot

  
[root@terry root]# chmod -R ug+rwx /home/cvsroot

  
[root@terry root]# chmod 644 /home/cvsroot/CVSROOT/config


  為了
CVS
系統的安全,我們要修改
/home/cvsroot/CVSROOT/config
檔案,將
“#SystemAuth =no”
前面的注釋號
#
去掉,即改為
“SystemAuth =no”
,然後給開發人員們逐一建立帳號,建立的不要分配使用者目錄,因為它將作為一個虛擬使用者帳號來使用,具體命令如:


  
[root@terry root]# useradd -g cvs -M bogus

  
[root@terry root]# passwd bogus



  上面的命令就建立了一個並沒有
Home
目錄的使用者
bogus
,接著將系統的
shadow
檔案複製到
CVSROOT,
並重新命名為
passwd:


  
[root@terry root]# cp /etc/shadow /home/cvsroot/CVSROOT/passwd

  
[root@terry root]# chmod 0644 /home/cvsroot/CVSROOT/passwd


  然後修改
passwd
檔案,將除
bogus
之外的所有行刪除,然後去掉每行第二個冒號以後的所有內容,並添上字串
cvsroot,
改為如下格式:


  
bogus:ND5$J8N9BW5DKV.nPdxfdsh:cvsroot



  然後,刪除掉剛剛在系統中添加的那個使用者
bogus:


  
[root@terry root]# userdel -f bogus
     
  

      好了,到這裡,
CVS
伺服器端就已經設定好了,這樣你的
CVS
使用者就只能用
passwd
中規定的使用者來登陸你的
CVS
伺服器了


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.