隨筆-200  評論-148  文章-15  trackbacks-0

          cvs 服務在 linux 下的安裝與配置

          ?

          1、?? 驗證是否已安裝 CVS
          #rpm -q cvs
          如果能顯示出類似這樣的版本信息,證明已安裝 CVS
          #cvs-1.11.19

          若沒有安裝信息,則需要從 htttp://www.cvshome.org 下載相應的安裝包

          我的安裝環境是 linux as4 u2

          若不想使用自帶版本,可以用

          #rpm –e cvs

          刪除自系統自帶的 cvs 安裝包

          htttp://www.cvshome.org 獲取最新的安裝包 cvs-1.11.21.tar.gz

          解壓該包并安裝:

          # tar zxvf cvs-1.11.21.tar.gz

          進入解壓包 cvs-1.11.21

          # ./configure –prefix =
          你的安裝目錄 &&make &&make install

          2
          創建 CVS 用戶組與用戶
          root
          用戶下執行以下命令:
          #groupadd cvs
          #adduser cvsroot
          #passwd cvsroot

          #
          輸入 cvsroot 用戶密碼

          3
          、創建 CVSROOT (CVS 倉庫的根目錄 )
          root
          用戶下執行:
          #mkdir /cvsroot
          此處可改為你想要的 cvsroot 路徑
          #chown cvsroot.cvs /cvsroot
          更改 cvsroot 權限

          4
          、初始化 CVS 倉庫
          需要在 cvsroot 用戶下執行
          #su - cvsroot
          #cvs -d /cvsroot init
          此處對應上面創建的 cvsroot 路徑

          #
          注:對應后面 /etc/xinetd.d/cvspserver 文件的配置

          5
          、修改環境變量
          編輯 /etc/profile 或者 /home 下相應用戶的 .profile 文件
          此處已修改 /etc/profile 為例:
          #exit
          退回到 root 用戶,只有 root 用戶才有權限修改 /etc/profile

          #vi /etc/profile
          編輯 /etc/profile 文件
          在末尾加上以下兩句:

          CVSROOT=/cvsroot
          export CVSROOT

          更新環境變量:
          #source /etc/profile
          此時系統已經認識 $CVSROOT 這樣的環境變量

          6
          、啟動 cvs 服務器:
          /etc/xinetd.d/ 目錄下創建文件 cvspserver ,內容如下:
          # default: on
          # description: The cvs server sessions;

          service cvspserver
          {
          socket_type = stream
          wait = no
          user = root
          server = /usr/bin/cvs

          #
          注, /usr/bin/cvs cvs 命令文件的位置

          #
          注, 刪除了系統自帶的 cvs 安裝包,
          #
          注,則 server= 你的 cvs 安裝目錄 /bin/cvs

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

          #
          注,對應第 4 cvs -d /cvsroot init 命令
          only_from = 192.168.10.0/24

          #
          注, 24 是子網掩碼的長度,對應 255.255.255.0
          }

          其中 only_from 是用來限制訪問的,可以根據實際情況不要或者修改。
          修改該文件權限:
          # chmod 644 cvspserver
          然后重新啟動 xinetd
          # /etc/rc.d/init.d/xinetd restart
          然后察看 cvs 服務器是否已經運行:
          # netstat -lnp|grep 2401
          tcp 0 0 0.0.0.0:2401 0.0.0.0:* LISTEN xxxxxx/xinetd
          則說明 cvs 服務器已經運行。

          7
          、建立 cvs 用戶
          為了 CVS 系統的安全,我們要修改 /cvsroot/CVSROOT/config 文件,將 "#SystemAuth =no" 的前而的注釋號 # 去掉,即改為 “SystemAuth =no” ,然后給開發者們逐一建立賬號,新建的不要分配用戶目錄,因為它將作為一個虛擬用戶帳號來使用,具體命令如:
             [root@terry root]# chmod -R ug+rwx /cvsroot
             [root@terry root]# chmod 644 /cvsroot/CVSROOT/config
             [root@terry root]# useradd -g cvs -M gaoshang
             [root@terry root]# passwd gaoshang

          上面的命令就創建了一個并沒有 Home 目錄的用戶 gaoshang ,接著將系統的 shadow 文件復制到 CVSROOT, 并重命名為 passwd:

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

            然后修改 passwd 文件,將除剛才設定的可使用 CVS 的用戶 cvsroot gaoshang 之外的所有行刪除,然后去掉每行第二個冒號以后的所有內容,并添上字符串 cvsroot, 改為如下格式:

             [root@test11 CVSROOT]# more passwd
          cvsroot:$h3ntACe9$cM2SADto6B9P5h5Wrbgyi.:cvsroot
          gaoshang:ttSJv9AK.zzZhhHLEQZnZPgEe8f1:cvsroot

            然后,刪除掉剛剛在系統中添加的那個用戶 gaoshang:

          [root@terry root]# userdel -f gaoshang

          (這里主要是使用系統在創建用戶時,為用戶密碼生成的的密文)

          好了,至此, CVS 服務器端已配置完成。這時你的 CVS 用戶就只能用 passwd 中規定的用戶來登陸你的 CVS 服務器了

          8 .
          為用戶分配權限
          /cvsroot/CVSROOT/ ,加入兩個文件 readers , writers

          將只能讀權限的用戶加入 readers 文件,

          將具有寫權限的用戶加入 writers 文件。

          如: # vi writers

          gaoshang

          9
          linux 客戶端登錄測試 (或見 window cvs 客戶端 wincvs 1.3 的使用說明)

          假定 cvs 服務器在 192.168.10.11 上,系統上有用戶 cvsroot gaoshang 。登陸另一臺 linxu 機器,執行下列命令可以完成測試:

          [root@test2 test]# export CVSROOT=:pserver:cvsroot@192.168.10.11:2401/cvsroot
          [root@test2 test]# cvs login
          Logging in to :pserver:cvsroot@192.168.10.11:2401/cvsroot
          CVS password:

          #
          注:輸入密碼,沒有出錯提示表示登陸成功。
          [root@test2 test]#
          [root@test2test]# export CVSROOT=:pserver:gaoshang@192.168.10.11:2401/cvsroot
          [root@test2 test]# cvs login
          Logging in to :pserver:gaoshang@192.168.10.11:2401/cvsroot
          CVS password:

          #
          注:輸入密碼,沒有出錯提示表示登陸成功。
          [root@test2 test]#

          配置中碰到的問題
          1
          cvsroot 用戶不能登錄
          [root@test2 test]# export CVSROOT=:pserver:cvsroot@192.168.10.11:2401/cvsroot
          [root@test2 test]# cvs login
          Logging in to :pserver:cvsroot@192.168.10.11:2401/cvsroot
          CVS password:
          no such user cvsroot in CVSROOT/passwd

          解決辦法,查看發現原因是 /cvsroot/CVSROOT/passwd 文件中沒有包含 cvsroot 用戶

          2
          、只有 cvsroot 用戶可以登陸,別的用戶都不能登錄
          查看原因發現是 /etc/xinetd.d/cvspserver 文件的 server_args = -f --allow-root=/cvsroot pserver 目錄參數不對,因為我們此次配置的 cvs 工作目錄是 /cvsroot ,而不是 /home/cvsroot, 所以將該參數為 server_args = -f --allow-root=/cvsroot pserver ,所有用戶均可正常登錄。

          ?

          ?

          原文出處:http://www.linuxdiyf.com/viewarticle.php?id=19876

          posted on 2006-11-23 10:15 無聲 閱讀(905) 評論(0)  編輯  收藏 所屬分類: 職場生活
          主站蜘蛛池模板: 屯留县| 广昌县| 盖州市| 和硕县| 教育| 惠东县| 法库县| 泰来县| 三河市| 马鞍山市| 安西县| 孟村| 宝山区| 东莞市| 谢通门县| 通辽市| 讷河市| 万载县| 徐闻县| 吴川市| 瑞昌市| 丰城市| 柳林县| 信丰县| 白城市| 界首市| 乌兰察布市| 南召县| 德兴市| 兴隆县| 达日县| 腾冲县| 咸宁市| 拜泉县| 洛阳市| 武清区| 江油市| 抚宁县| 诏安县| 皮山县| 榆树市|