powerdee.com
Google
 
このサイト内 Web
 
カウンタ

CVSサーバの構築

CVSサーバの確認

CentOSには既にCVSがインストールされています。インストールされているパッケージを確認します。

# rpm -qa | grep cvs
cvs-1.11.2-25

CVSサーバ用ユーザ・グループの作成

CVS用ユーザを"cvs" 所属するグループを"cvs" CVSを利用するユーザが所属するグループを"cvsusers" とします。

# groupadd -r cvsusers 
# useradd -G cvsusers cvs
# passwd cvs

リポジトリの設定

プロジェクトを格納するルートディレクトリを作成します。

# mkdir /usr/local/cvsroot
# chown cvs:cvsusers /usr/local/cvsroot
# chmod 2775 /usr/local/cvsroot
# ls -al /usr/local | grep cvsroot
drwxrwsr-x    2 cvs      cvsusers     4096  3月 12 16:02 cvsroot

リポジトリを初期化します。

# su - cvs
$ cvs -d /usr/local/cvsroot init

作成された /usr/local/cvsroot/CVSROOTディレクトリへの書き込み権限はcvs管理ユーザの"cvs"のみにします。

$ chmod g-w /usr/local/cvsroot/CVSROOT
$ ls -al /usr/local/cvsroot | grep CVSROOT
drwxr-sr-x    3 cvs      cvsusers     4096  3月 12 16:11 CVSROOT

プロジェクトの登録

プロジェクト名は"documents" ベンダータグは"powerdee" リリースタグは"start"とします。

$ cd ~
$ mkdir documents
$ cd documents
$ echo 'cvs insert test' > test.txt       <-- プロジェクト格納用のファイル
$ cvs -d /usr/local/cvsroot import documents powerdee start

自動的にviが立ち上がってくるので、コメントを記述します。

CVS: ----------------------------------------------------------------------
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS:
CVS: ----------------------------------------------------------------------
It is the insertion test of project "documents". 

"/tmp/cvsQfJyqF" 7L, 261C written
N documents/test.txt

No conflicts created by this import

最後に"cvs"ユーザにはログインさせなくします。

# usermod -s /bin/false cvs

Pserverのセットアップ

他のOSからcvsリポジトリにアクセスするには、pserverの設定を行う必要があります。(但し、後述のsshでのアクセスではpserverは不要)

まず、xinetdの設定(/etc/xinetd.d/cvspserverを作成します)

# cd /etc/xinetd.d/
# vi cvspserver

service cvspserver
{
        disable = no
        socket_type = stream
        protocol = tcp
        wait = no
        user = root
        passenv =
        server = /usr/bin/cvs
        server_args = -f --allow-root=/usr/local/cvsroot pserver
}

xinetdを再起動します。

# service xinetd restart

以下のようにポート2401が起動していれば問題なし

$ netstat -an | grep 2401
tcp        0      0 0.0.0.0:2401                0.0.0.0:*                   LISTEN

cvsを利用するユーザの作成

cvspserver を使用するユーザを準備します。cvs サーバを利用するために作成するアカウントで、UNIX アカウントを持っている必要はありません。(UNIXアカウントでもpserverは利用可能)

/usr/bin/htpasswdを使って以下のようにパスワードファイルを設定します

$ cd /usr/local/cvsroot/CVSROOT
$ su
# htpasswd -c passwd ユーザ名
New password:
Re-type new password:
Adding password for user ユーザ名

2件目以降はパスワードファイルを生成しないので、-c オプションは不要です。

# htpasswd passwd ユーザ名2

最後にパスワードファイルを編集します。
後ろに : をつけて、OSのアカウントを指定します。以下の場合、cvsユーザの権限を使用してアクセスします。

ユーザ名:bjkjGV5PdJ8c6
↓
ユーザ名:bjkjGV5PdJ8c6:cvs

おすすめ書籍


Linux教科書 LPICレベル1 第2版 (Linux教科書)

著者:中島 能和、濱野 賢一朗
出版社:翔泳社(2006-08-11)
価格:¥3,990(税込)
Linuxカーネル2.6解読室

著者:高橋浩和、小田逸郎、山幡為佐久
出版社:ソフトバンククリエイティブ(2006-11-18)
価格:¥5,670(税込)


ページTopへ / ▲Homeへ