SubminでSVNリポジトリを管理する

  • 5
    いいね
  • 0
    コメント
この記事は最終更新日から1年以上が経過しています。

はじめに

Subminを利用して、SVNリポジトリをブラウザから管理する方法を記述します。

環境

  • CentOS 6.7
  • subversion 1.6.11
  • Submin 2.2.1-1
  • httpd 2.2.15
  • python 2.6.6

依存ライブラリ等のインストール

$ sudo yum install subversion httpd mod_dav_svn apr-util-sqlite

Subminのインストール

$ wget http://supermind.nl/submin/current/submin-2.2.1-1.tar.gz
$ tar zxvf submin-2.2.1-1.tar.gz
$ cd submin-2.2.1-1
$ sudo python setup.py install --record install-files.txt

Subminのセットアップ

$ sudo submin2-admin /var/lib/submin initenv your@email.address
Submin can enable features for you automatically. Please answer which features
you want to enable. You can choose to enable: 'svn', 'git', 'trac', 'apache'
and 'nginx'.

Which features do you want to enable? [svn, git, apache, nginx]> svn,apache

Please provide a location for the Subversion repositories. For new Subversion
repositories, the default setting is ok. If the path is not absolute, it will
be relative to the submin environment. If you want to use an existing
repository, please provide the full pathname to the Subversion parent
directory (ie. /var/lib/svn).

Path to the repository? [svn]> /var/lib/svn

Please provide a hostname that can be used to reach the web interface. This
hostname will be used in communication to the user (a link in email, links
in the web interface). The hostname should be a FQDN, so instead of 'foo' it
should be 'foo.example.com'. Please correct if the default is incorrect.

Hostname? [localhost.localdomain]> ${サーバのIPアドレス}

The HTTP path tells Submin where the website is located relative to the root.
This is needed for proper working of the website. Submin will be accesible
from <http base>/submin, Subversion will be accessible from <http base>/svn.
If you use Trac, it will be accessible from <http base>/trac.

HTTP base? [/]>

Submin will send emails for password resets and for commit message (if
enabled). You can set the sender email address that Submin will use. The
default might work in some places, but not all.

Email from envelope? [Submin <root@localhost.localdomain>]>
Apache files created:
/var/lib/submin/conf/apache-webui-cgi.conf
/var/lib/submin/conf/apache-webui-wsgi.conf
/var/lib/submin/conf/apache-svn.conf
/var/lib/submin/conf/apache-trac-modpython.conf
/var/lib/submin/conf/apache-trac-cgi.conf
/var/lib/submin/conf/apache-trac-modwsgi.conf
/var/lib/submin/conf/apache-trac-fcgid.conf
/var/lib/submin/conf/apache-trac-no-anonymous.conf
/var/lib/submin/conf/apache-2.4-webui-cgi.conf
/var/lib/submin/conf/apache-2.4-webui-wsgi.conf
/var/lib/submin/conf/apache-2.4-svn.conf
/var/lib/submin/conf/apache-2.4-trac-modpython.conf
/var/lib/submin/conf/apache-2.4-trac-cgi.conf
/var/lib/submin/conf/apache-2.4-trac-modwsgi.conf
/var/lib/submin/conf/apache-2.4-trac-fcgid.conf
/var/lib/submin/conf/apache-2.4-trac-no-anonymous.conf

   Please include ONE of the -webui- files and optionally -trac- and -svn-
   files (if you need/want that functionality). The -trac-no-anonymous.conf
   file can be used together with ONE other trac config file. The -2.4- files
   are for apache >= 2.4.

   Hint: cgi is simpler, but performs worse.

   Please read the instructions in the file for caveats and on how to include!

Apacheの設定

  • /etc/httpd/conf.d/z000-httpd-submin.confの作成
/etc/httpd/conf.d/z000-httpd-submin.conf
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule dbd_module modules/mod_dbd.so

* Submin用設定の追加

$ sudo ln -s /var/lib/submin/conf/apache-webui-cgi.conf /etc/httpd/conf.d/z001-httpd-submin.conf
$ sudo ln -s /var/lib/submin/conf/apache-svn.conf /etc/httpd/conf.d/z002-httpd-submin.conf
$ ls -l /etc/httpd/conf.d/
合計 16
-rw-r--r-- 1 root root  392  8月 25 02:53 2015 README
-rw-r--r-- 1 root root 1042  8月 17 17:41 2015 subversion.conf
-rw-r--r-- 1 root root  299  8月 18 14:57 2015 welcome.conf
-rw-r--r-- 1 root root   94  9月 26 15:13 2015 z000-httpd-submin.conf
lrwxrwxrwx 1 root root   42  9月 26 15:14 2015 z001-httpd-submin.conf -> /var/lib/submin/conf/apache-webui-cgi.conf
lrwxrwxrwx 1 root root   36  9月 26 15:14 2015 z002-httpd-submin.conf -> /var/lib/submin/conf/apache-svn.conf
  • 起動
$ sudo service httpd start

adminユーザの初期パスワード設定

  • パスワードリセット用のキーの確認
$ sudo sqlite3 /var/lib/submin/conf/submin.db
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

sqlite> .tables
group_members   managers        password_reset  ssh_keys
groups          notifications   permissions     users
hook_jobs       options         sessions

sqlite> .schema password_reset
CREATE TABLE password_reset (
            userid  integer not null references user(id) primary key, -- valid for this user
            expires integer not null, -- this entry expires at Unix Time
            key     text not null -- random secret
        );


sqlite> select * from password_reset;
1|1443333976|iJhl80FE80AYnOmNJE2qXxtqAPqx0B8B7XGqKbLj2PvSG3T3bV
  • ブラウザでアクセス
http://${サーバIPアドレス}/submin/admin/password/iJhl80FE80AYnOmNJE2qXxtqAPqx0B8B7XGqKbLj2PvSG3T3bV

Submin-reset-password.png

Submin-top-page.png

Submin-diagnostics.png

  • Git supportを無効
$ sudo submin2-admin /var/lib/submin config set vcs_plugins svn

Submin-diagnostics02.png

  • パスワード設定

Submin-admin.png

リポジトリ作成

  • パーミッションの設定
$ ls -ld /var/lib/svn
drwx------ 2 root root 4096  9月 26 15:06 2015 /var/lib/svn

$ sudo chown apache:apache /var/lib/svn
$ sudo chmod 775 /var/lib/svn

$ ls -ld /var/lib/svn
drwxrwxr-x 2 apache apache 4096  9月 26 15:06 2015 /var/lib/svn

Submin-add-repository.png

Submin-add-repository-02.png

リポジトリの操作

  • リポジトリのチェックアウト
$ svn checkout http://${サーバIPアドレス}/svn/sample --username=admin
認証領域: <http://${サーバIPアドレス}:80> Subversion repository
'admin' のパスワード:

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <http://${サーバIPアドレス}:80> Subversion repository

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/vagrant/.subversion/servers'.
-----------------------------------------------------------------------
暗号化されていないパスワードを保存しますか (yes/no)? yes

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <http://${サーバIPアドレス}:80> Subversion repository

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/vagrant/.subversion/servers'.
-----------------------------------------------------------------------
暗号化されていないパスワードを保存しますか (yes/no)? yes
リビジョン 0 をチェックアウトしました。
  • リポジトリへ追加
$ cd sample
$ mkdir trunk branches tags
$ svn status
?       trunk
?       branches
?       tags

$ svn add *
A         branches
A         tags
A         trunk

$ svn commit -m 'initial commit.'
追加しています              branches
追加しています              tags
追加しています              trunk

リビジョン 1 をコミットしました。

$ svn list http://${サーバIPアドレス}/svn/sample
branches/
tags/
trunk/
  • ブラウザでリポジトリを参照
http://${サーバIPアドレス}/svn/sample/

Submin-repository-sample.png

参考