[ Topページへ戻る ]
CollabNetは、RedHat Enterprise 5用に、最新バージョンのSubversion RPMパッケージを提供しています。これをCentOS 5にインストールし、Apache HTTPサーバ経由でアクセスするための設定を行います。
CollabNetの配布ページは、Subversionホームページから辿ることができます。
左側メニューの[Binary Packages]を辿り、[Red Hat Linux]を辿ると、Red Hat Linux 用に3つのそれぞれのバイナリ提供先がリストされています。この1つがCollabNetです。[CollabNet]を辿ると、CollabNet Subversionダウンロードページに飛びます。
2010/06/01現在、以下のRPMがダウンロードページにあります。
今回は、32bit版のCentOS 5.5にインストールするので、前者3つを入手します。
なお、入手には、無償ですがユーザー登録が必要です。
ダウンロードするファイルは以下3つとなります。
CollabNetSubversion-client-1.6.11-1.i386.rpm CollabNetSubversion-server-1.6.11-1.i386.rpm CollabNetSubversion-extras-1.6.11-1.i386.rpm
CentOS 5の標準搭載Subversion(バージョン1.4)は予め削除しておきます。
入手したRPMファイルをインストールします。
# rpm -ivh CollabNetSubversion-client-1.6.11-1.i386.rpm : # rpm -ivh CollabNetSubversion-server-1.6.11-1.i386.rpm : # rpm -ivh CollabNetSubversion-extras-1.6.11-1.i386.rpm
インストールされるディレクトリ構成は以下です。
/opt/CollabNet_Subversion +-- bin +-- build +-- docs +-- lib +-- licenses +-- modules +-- openssl +-- sbin +-- share /etc/init.d/collabnet_subversion /etc/opt/CollabNet_Subversion +-- cgi-bin +-- conf +-- default-site +-- icons /var/opt/CollabNet_Subversion +-- error +-- logs +-- run
CollabNetのSubversionは、標準パスには入らないので、コマンドを実行するためには、環境変数PATHに追記します。
必要な環境変数は以下です。
PATH=/opt/CollabNet_Subversion/bin:$PATH MANPATH=/opt/CollabNet_Subversion/share/man:$MANPATH LOCPATH=/opt/CollabNet_Subversion/share/locale:$LOCPATH
設定方法は、ユーザ毎に記述するのは面倒なので、システムで一括で定義します。
/etc/profile.d/collabnet-subversion.sh
# CollabNet Subversion environments PATH=/opt/CollabNet_Subversion/bin:$PATH MANPATH=/opt/CollabNet_Subversion/share/man:$MANPATH LOCPATH=/opt/CollabNet_Subversion/share/locale:$LOCPATH export PATH MANPATH LOCPATH
/etc/profile.d/collabnet-subversion.csh も定義した方がよさそうですが、エラーになる(MANPATHが未定義のとき、setenvがエラーになる)
CollabNet Subversion Serverに内蔵のApache Webサーバーを使用し、Subversionリポジトリを作成し、ユーザアカウントを生成します。
これらの設定をするスクリプトが用意されているので、これを実行し、対話的に質問に答えていくと、必要な設定が行われます。
# Configure-CollabNet-Subversion CollabNet Subversion Server is a free download of open-source Subversion, compiled and tested by CollabNet. For more information about CollabNet Subversion, visit the CollabNet community at http://open.collab.net. Would you like to configure the CollabNet Subversion Server now? [yes] Welcome to CollabNet Subversion Server setup. You will now be asked some questions to configure CollabNet Subversion. Defaults are given in square brackets. If a default is okay for you Just hit [Enter] to continue. This setup can configure either Apache or svnserve as Subversion server, for you. Would you like to configure Apache as your Subversion server now? [yes] Continuing with apache Subversion server configuration ... Specify the base directory for Subversion repositories: [/var/svn/repositories] Non-existing base path, Let me create and continue [yes] Base path created. Would you like to create a new Subversion repository? [yes] What should be your new Subversion repository name? primus New repository created. Would you like to initialize the repository with trunk/branches/tags folders? [no] yes Done. Would you like to create another Subversion repository? [yes] no Would you like to give the name and port that the server uses to identify itself? [yes] Registered DNS name or IP address: 192.168.0.1 Server port number: 8086 Allow anonymous read access? [no] 0 users currently have access to this repository: Would you like to create a new Subversion account? [yes] Account username (To re-create or delete a Subversion account, enter an existing username): torutk Account password: xxxxxx Retype account password: xxxxxx Adding password for user torutk Account created Would you like to create another user account? [yes] no Would you like to configure ViewVC? [yes] Stopping CollabNet Subversion: httpd (no pid file) not running [ OK ] Starting CollabNet Subversion: [ OK ] Congratulations! You have successfully configured the CollabNet Subversion server. You can access your repositories at the following URL: http://192.168.0.1:8086/svn/YOUR-REPOS-NAME http://192.168.0.1:8086/viewvc/YOUR-REPOS-NAME #
ポート番号は、CentOS標準のhttpdが80ポートを使用しているので、別なポート番号を指定します。この例では、8086を指定しました。
この一連の設定で、サーバーが自動起動し、Subversionリポジトリが生成され、ユーザー設定が行われます。
$ chkconfig --list|grep -i subversion collabnet_subversion 0:off 1:off 2:off 3:on 4:on 5:on 6:off $ service collabnet_subversion status CollabNet Subversion (apache [4213]) Running ... [ OK ] $
設定が記載されるファイルは以下です。
/etc/opt/CollabNet_Subversion/conf +-- collabnet_subversion_httpd.conf +-- server +-- svn_access_file +-- svn_auth_file +-- viewvc.conf +-- viewvc_httpd.conf
以下URLでリポジトリにアクセスできるようになります。
ユーザーの設定は、/etc/opt/CollabNet_Subversion/conf/svn_auth_file に記述します。追加には以下コマンドを使用します。
# htpasswd /etc/opt/CollabNet_Subversion/conf/svn_auth_file fuga New password: xxxxxx Re-type new password: xxxxxx #
どのユーザがどのリポジトリにアクセスできるかを設定するには、/etc/opt/CollabNet_Subversion/conf/svn_access_file に記述します。
[groups] primus-developers = marcus,gaius,lucius,frontinus secundus-developers = publius,agrippa,appius,dossennus,gnaeus admin = jullus, lars [priums:/] @priums-developers = rw @admin = rw aulus = r [secondus:/] @admin = rw @secundus-developers = r [secundus:/trunk] @secundus-developers = rw decimus = r
ユーザー個別に指定してもよいですし、グループを定義してグループ毎に指定してもよいです。
グループの定義は、[groups]に、グループ名 = ユーザ名,... の形で指定します。
各リポジトリのアクセス権は、[リポジトリルート名:ディレクトリ名]で指定します。リポジトリルートは、collabnet_subversion_httpd.confで記述した、SVNParentPathの直下に作成したリポジトリのディレクトリ名となります。ディレクトリは、リポジトリディレクトリ名を/としたそれ以下のディレクトリパスを指定します。