※今回の手順はApacheと連携しない場合のやりかた。
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260&expandFolder=74
より、subversion-1.4.3.tar.gzとsubversion-deps-1.4.3.tar.gzをダウンロード。
サーバ上の/usr/local/src にアップロード。
# cd /usr/local/src # tar zxvf subversion-1.4.3.tar.gz # tar zxvf subversion-deps-1.4.3.tar.gz # cd subversion-1.4.3 # ./configure # make # make install
■リポジトリの初期化
# mkdir /usr/local/svn ←名前と場所はどこでもいい # mkdir /usr/local/svn/repos # svnadmin create /usr/local/svn/repos
■リポジトリへのアクセス設定
アノニマスユーザのアクセスを禁止する。
# cd /usr/local/svn/repos/conf # vi svnserv.conf 以下のように修正。 anon-access = none auth-access = write password-db = passwd
次にパスワードを設定。
# vi passwd 内容を以下のようにする ### This file is an example password file for svnserve. ### Its format is similar to that of svnserve.conf. As shown in the ### example below it contains one section labelled [users]. ### The name and password for each user follow, one account per line. [users] # harry = harryssecret # sally = sallyssecret tappe = tappepass
■svnserveの設定
/etc/xinetd.d配下にsvnserveというファイルを作成し、
下記のような内容を書き込む。
# default: off # description: A SVN pserver. service svnserve { disable = no socket_type = stream protocol = tcp wait = no user = root server = /usr/local/bin/svnserve server_args = -i -r /usr/local/svn/repos }
設定項目の意味は次の通り。
user
svnserveを実行するユーザ。
server
svnserveへのフルパス。
server_args
svnserveに渡す引数。 「-r /usr/local/svn/repos」でリポジトリのルートディレクトリを/usr/local/svn/repos に設定している。
/etc/services に下記の内容を追加
: : (中略) svnserve 3690/tcp # Subversion svnserve 3690/udp # Subversion : :
ここで、ipchainsなどで3690番ポートに制限がかかっている場合は、
忘れずにポートの開放を行うこと。
続いてchkconfigの設定を行う。
# chkconfig --add svnserve
設定が反映されているか確認。
# chkconfig --list svnserve
オンになっていればOK。
xinetdを再起動して変更を反映する。
# service xinetd restart
■接続テスト
Windows端末からtelnetを実行し、
# telnet サーバIP 3690 Trying サーバIP... Connected to サーバIP. Escape character is '^]'. ( success ( 1 2 ( ANONYMOUS ) ( edit-pipeline ) ) )
となれば成功。
■TortoiseSVNからの接続テスト
リポジトリURLとして
svn://サーバIP:3690/usr/local/svn/repos/
を指定し、先ほどのpasswdファイルで設定したユーザ名とパスワードを
入力すればOK。
例:tappeの場合 ユーザ名:tappe パスワード:tappepass
「認証を保存」をチェックしておけば、次回からは聞かれないので楽。
■参考記事
Subversionによるバージョン管理
xinetd経由でsvnserveを起動する場合の設定
LinuxHomeServerMemo