SYONテクニカル

cvsup-mirror(cvsupd)サーバを使おう

2006/01/31
サイオンコミュニケーションズ株式会社
照屋 響

今回利用した環境
OS FreeBSD 6.x
CPU PenIII
MEM 2GB
HDD 120GB

1.はじめに

FreeBSD管理者の皆さんこんにちは。皆さんはFreeBSDのOSのバージョンアップをどのようにしていますか?当然cvsupをお使いですよね?でも複数台サーバを抱えている人はどうしています?まさか全部のサーバでcvsup.jp.freebsd.orgにデータをとりにいってないですか?

今回はcvsup-mirror(cvsupd)サーバを上げてみました。
cvsup-mirror(cvsupd)サーバはcvsupサーバと同期を取りデータを保持し、またクライアント(cvsup)からアクセスがあればそれを受け渡すことができます。複数あるサーバを自分で上げたcvsup-mirrorサーバからデータを取得すれば帯域の節約にもなりますし、データもすばやく得ることができます。ということで Let’s try.

2.cvsup-mirror-1.3_5のインストール

例によってportsからインストールします。
ただし、cvsup-mirrorはインストール時に色々と質問がでてくるのでそれに答えなければなりません。

 
# cd /usr/ports/net/cvsup-mirror/
# make

I am going to ask you a few questions so that I can set up your
FreeBSD mirror configuration.  Every question has a [default]
answer.  To accept the default, just press ENTER.

At this point, I am just gathering information.  I will not touch
your system until you type "make install".

Master site for your updates [cvsup-master.freebsd.org]? cvsup2.jp.freebsd.org
同期をとるcvsupサーバは?

How many hours between updates of your files [1]? 1
何時間毎にサーバと同期をとるか?

Now you must decide which sets of files you wish to make available
from your mirror site.  You can choose any combination, and you
can put each set anywhere you want to on your disks.  Although each
set is optional, we strongly encourage every mirror site to carry
at least the main source repository.

Do you wish to mirror the main source repository [y]?
メインソースリポジトリをミラーするか?

Where would you like to put it [/home/ncvs]?
データをどこに置くか?

Do you wish to mirror the installed World Wide Web data [y]? n

WWWのデータをミラーするか?いらないのでnと答えます。

Do you wish to mirror the GNATS bug tracking database [y]? n
GNATSバグトラックをミラーするか?いらないのでnと答えます

Do you wish to mirror the mailing list archive [y]? n

メーリングリストをミラーするか?いらないのでnと答えます。

Now, a few questions so that I can set up your CVSup server properly.

For security reasons, both the CVSup client and server should run
under their own unique user and group IDs.  These IDs should have no
special access privileges.  Normally, the user:group “cvsupin:cvsupin”
is used for the client and “cvsup:cvsup” is used for the server, but
you can choose other names if you wish.  At “make install” time, I
will create the users and groups, if they don’t already exist.

Use unique user and group IDs for these.  Do not use “nobody”,

“nonroot”, or “nogroup”.

Unique unprivileged user ID for running the client [cvsupin]?
Unique unprivileged group ID for running the client [cvsupin]?
Unique unprivileged user ID for running the server [cvsup]?
Unique unprivileged group ID for running the server [cvsup]?
これらはcvsupd等が動くアカウントやグループを設定します。デフォルトで
問題ないでしょう。

The CVSup server does its logging via syslog.  At “make install”
time, I will set up the logging for you, if necessary.  I will use
the “!program” feature of syslog to keep your CVSup log messages
separate from the messages of your other daemons.

Syslog facility for the server log [daemon]?
syslogのファシリティーをどうするか?これもデフォルトで問題ないと
思います

You can control the load on your machine by limiting the number of
clients that the CVSup server will serve at once.  CVSup won’t load
your network especially heavily, but it is more CPU and disk
intensive than most other file server software.

Maximum simultaneous client connections [8]?
クライアントの最大接続数は?

Building the “config.sh” file … Done.
Building the “cvsupd.access” file … Done.

make install

#make install
You need a group “cvsup”.
Would you like me to create it [y]?
Done.
You need a user “cvsup”.
Would you like me to create it [y]?
Done.
You need a group “cvsupin”.
Would you like me to create it [y]?
Done.
You need a user “cvsupin”.
Would you like me to create it [y]?
Done.
先ほど答えたアカウントやグループを作成していいか質問してきますので
リターンを押してそのまま進めていきます

Would you like me to create cvsupin’s home directory (/home/cvsupin) [y]?
ディレクトリを作成していいか質問してきますのでリターンでそのまま進めます

Fixing ownerships and modes in “/usr/local/etc/cvsup”.
Setting up links and directories for distributions.
  Linking distrib.self -> ..
  Linking FreeBSD.cvs -> /home/ncvs
  Fixing ownerships and modes in /home/ncvs … done.
  Linking FreeBSD-www.current -> SKIP
  Linking FreeBSD-gnats.current -> SKIP
  Linking FreeBSD-mail.current -> SKIP

Would you like me to set up the syslog logging [y]?
syslogの設定をしてもいいか訪ねているのでリターンでそのまま進めます。

Setting up server logging in “/etc/syslog.conf”.
Creating “/var/log/cvsupd.log”.
Giving syslogd a kick in the pants.
Adding cvsup and cvsupd log entry to “/etc/newsyslog.conf”.
Done.

Would you like me to set up your crontab for hourly updates [y]?
crontabの設定をしてもいいか訪ねているのでリターンでそのまま進めます。

Scheduling hourly updates in “/etc/crontab”.
Done.  The first update will be 5 minutes from now, at 15:35.
The cvsupd server will be started automatically after the first update,
and whenever you reboot.

You are now a FreeBSD mirror site.
===> Installing rcNG startup script(s)
===>   Registering installation for cvsup-mirror-1.3_5

3.設定

上記質問に答えながらインストールを行うと設定も完了しています。
あとは以下のコマンドで起動するか再起動をすればサービスが起動します。

# /usr/local/etc/rc.d/cvsupd.sh start

接続の制限をかけたければ「/usr/local/etc/cvsup/cvsupd.access」を編集すれば行うことができます。ただ、最初はデータを持っていないため、同期するサーバからデータ全部拾い終わるまで待つ必要があります。時間がかかりますので1日おいて置くとよいでしょう。データを置くディレクトリは2006/1/30現在では3GBほど消費するのでHDDの空き容量に注意してください。

4.使ってみよう

使い方は簡単cvsupの-hオプションでcvsup-mirror(cvsupd)をインストールしたサーバを指定するかsupfile(設定ファイル)にて「*default host=cvsup-mirror(cvsupd)をインストールしたサーバ」を設定しとけばOKです。以下にcvsup-mirror(cvsupd)をインストールしたサーバが192.168.10.100だった場合の設定例を示します。

例1
#cvsup -g -L 2 -h 192.168.0.100 stable-supfile

例2
stable-supfileの中身
*default host=192.168.0.100 stable-supfile
コマンド
#cvsup -g -L 2 -h stable-supfile

5.最後に

いかがだったでしょうか?
簡単ですよね。複数台サーバを管理している人は是非利用してみて下さい。しかしHDDの容量をそれなりに消費するので、HDDにゆとりの無いサーバーやサーバが1台しか無い場合は普通にcvsupサーバにアクセスしたほうが無難になります。

Copyright 1999-2008 SYON Communications, Co. All rights reserved