Subversionのインストール - バージョン管理システム

CVSの諸問題を解決すべく開発されている。
ディレクトリの移動や削除のサポート、リビジョン番号のソースツリー全体に対して採番、などCVSにはない機能がある。

SVNクライアントとしては、TortoiseSVN が有名&使いやすい。(関わったプロジェクトのほとんどで利用されていた。)
ただ、EclipseプラグインのSVNクライアントと .svn下のファイル形式が違うのか、Eclipseでチェックアウトしたソースを、
TortoiseSVNでコミットしようとして、なんかおかしな事になった記憶がある。(逆だったかも。。あんまり覚えてない。)

ここでは svnserve形式(port:3690)でも、http形式でも動作するようにインストールを行う。

 ◆Apacheのリコンパイル(davを有効にする)

cd httpd-2.0.52
make distclean
./configure --enable-module="so ssl dav" --enable-dav --enable-rewrite=shared --enable-ssl --with-ssl=/usr/local/ssl
make
make install

 ◆Subversionのインストール

tar xzf subversion-1.4.4.tar.gz
cd subversion-1.4.4
./configure --prefix=/usr/local \
--disable-mod-activation \
--enable-swig-bindings=python \
--with-apr=/usr/local/apache2/bin/apr-config \
--with-apr-util=/usr/local/apache2/bin/apu-config \
--with-apxs=/usr/local/apache2/bin/apxs \
--without-berkeley-db \
--with-zlib \
--with-swig=/usr/local

configure: error: invalid apr version found

と怒られる。aprのバージョンが低いらしい。

わざわざ Apacheのバージョン上げるのもメンドイので、別途、必要な依存モジュールを取得してインストールを続行する。
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=7495&expandFolder=7495&folderID=260 から
依存モジュール( subversion-deps-1.4.4.tar.gz ) をダウンロード、展開して再度 configure

./configure --prefix=/usr/local \
--disable-mod-activation \
--enable-swig-bindings=python \
--with-apr=./apr/apr-config \
--with-apr-util=./apr-util/apu-config \
--with-apxs=/usr/local/apache2/bin/apxs \
--without-berkeley-db \
--with-zlib \
--with-swig=/usr/local
make
make install

# mod_dav_svn と mod_authz_svn がないと怒られるので、

# ソースディレクトリからコピーして再度 make install
cp ./subversion/mod_dav_svn/.libs/mod_dav_svn.so /usr/local/apache2/modules
cp ./subversion/mod_authz_svn/.libs/mod_authz_svn.so /usr/local/apache2/modules/
make install

make swig-py
make install-swig-py
/sbin/ldconfig

 ◆SVNリポジトリの作成

svnadmin create --fs-type=fsfs /path/to/svn_rep

 ◆ /etc/services に下記を追加 ( svnserveで利用する場合 )

svnserve 3690/tcp
svnserve 3690/udp

 ◆ /etc/xinetd.d/svnserve を作成 ( svnserveで利用する場合 )

# default: off

# description: An internal xinetd service, listing active servers.

service svnserve
{
  disable = no
  socket_type = stream
  protocol = tcp
  wait = no
  user = root
  server = /usr/bin/svnserve
  server_args = -i
}

 ◆httpd.confに設定を追加 ( httpで利用する場合 )

LoadModule dav_svn_module modules/mod_dav_svn.so



# SVNリポジトリ用の設定 ( httpで利用する場合 )
<Location /svn/myproject>
  DAV svn
  SVNPath /path/to/svn_repos

  #Basic認証の設定
  AuthType Basic
  AuthName "Subversion repository"
  AuthUserFile /path/to/.htpasswd
  Require valid-user
</Location>

 ◆SVNユーザの作成 ( httpで利用する場合 )

htpasswd -c /path/to/.htpasswd ユーザ名

 ◆Apacheの再起動 ( httpで利用する場合 )

/etc/init.d/httpd restart

 ◆SVNアクセス用のURL

svn://ホスト名/path/to/svn_repos  ※svnserveの場合
http://ホスト名/svn/myproject     ※httpの場合

 ◆SVNの使い方

# リポジトリ作成
svnadmin create path_to_rep
svn mkdir -m "make" file:///path_to_rep/trunk
svn mkdir -m "make" file:///path_to_rep/tags
svn mkdir -m "make" file:///path_to_rep/branches
# 空の作業コピーを作成
cd /path_to_parent/
svn co file:///path_to_rep/trunk example1
# 作業
cd /path_to_parent/example1
.
.
# SVN管理下に追加
svn add * --force
# addを取り消すファイルの指定
svn revert --depth infinity public_html/tmp
# 除外するファイル/ディレクトリの設定
svn propset svn:ignore 'tmp' ./public_html
# 最新をtrunkへ
svn commit -m "1st commit"
# タグ/ブランチの作成
svn copy -m "copy" file:///path_to_rep/trunk file:///path_to_rep/tags/1.0.1
# trunkから別ディレクトリにチェックアウト
cd ../
svn co file:///path_to_rep/trunk example2
# 作業コピーがどのタグやブランチのものか調べる
svn info | grep URL
# 作業コピーのブランチを切り替える(自動でupdateされる)
svn switch file:///path_to_rep/tags/1.0.1
# タグが作成されたリビジョンを見つける
cd example2
svn log --verbose --stop-on-copy file:///path_to_rep/tags/1.0.1

トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2009-06-11 (木) 00:48:45 (5427d)