Subversionの導入
インストール
ここからsubversionのソースをダウンロードしてインストールする。
subversionをインストールする前にApacheのインストールをしておく。
またINSTALLファイルを読んで依存ライブラリを確認しておく。
Apacheと連携して、ブラウザからHTTPプロトコルでリポジトリにアクセスするためにはneon(バージョン0.25以降)というライブラリが必要。またその際にSSL機能を使うのであればopensslも必要となる。
自分の環境にはopensslはインストール済みなのでneonのみインストールする。
# wget http://www.webdav.org/neon/neon-0.28.6.tar.gz
# tar xzvf neon-0.28.6.tar.gz
# cd neon-0.28.6
# ./configure --prefix=/usr/local/neon-0.28.6 --with-ssl
# make
# make install
subversionをインストールする。
configureを実行すると以下のエラーが出た。
# wget http://subversion.tigris.org/downloads/subversion-1.6.6.tar.gz
# tar xzvf subversion-1.6.6.tar.gz
# cd subversion-1.6.6
# ./configure
# --prefix=/usr/local/subversion-1.6.6
# --with-apxs=/usr/local/httpd/bin/apxs
# --with-apr=/usr/local/apr-httpd
# --with-apr-util=/usr/local/apr-util-httpd
# --with-neon=/usr/local/neon-0.28.6
# --with-ssl
エラーメッセージに従ってsqlite3.cを取得してコピーする。
An appropriate version of sqlite could not be found. We recommmend
3.6.13, but require at least 3.4.0.
Please either install a newer sqlite on this systemor
get the sqlite 3.6.13 amalgamation from:
http://www.sqlite.org/sqlite-amalgamation-3.6.13.tar.gz
unpack the archive using tar/gunzip and copy sqlite3.c from the
resulting directory to:
/usr/local/src/subversion-1.6.6/sqlite-amalgamation/sqlite3.c
This file also ships as part of the subversion-deps distribution.configure: error: Subversion requires SQLite
再びconfigureを実行すると無事終了したが以下のようにberkeley-dbが無いという警告が出た。
$ wget http://www.sqlite.org/sqlite-amalgamation-3.6.13.tar.gz
$ tar xzvf sqlite-amalgamation-3.6.13.tar.gz
# mkdir /usr/local/src/subversion-1.6.6/sqlite-amalgamation
# cp sqlite-3.6.13/sqlite3.c /usr/local/src/subversion-1.6.6/sqlite-amalgamation/
berkeley-dbは使わないので警告は無視して続行する。
configure: WARNING: we have configured without BDB filesystem support
You don't seem to have Berkeley DB version 4.0.14 or newer
installed and linked to APR-UTIL. We have created Makefiles which
will build without the Berkeley DB back-end; your repositories will
use FSFS as the default back-end. You can find the latest version of
Berkeley DB here:
http://www.oracle.com/technology/software/products/berkeley-db/index.html
ここで今度は以下のエラー。
# make
expatをインストールする。
/usr/bin/ld: cannot find -lexpat
再びconfigure&makeしても上のエラーが消えないので
# wget http://sourceforge.net/projects/expat/files/expat/2.0.1/expat-2.0.1.tar.gz/download
# tar expat-2.0.1.tar.gz
# cd expat-2.0.1
# ./configure --prefix=/usr/local/expat-2.0.1
# make
# make install
LD_LIBRARY_PATH環境変数にexpatライブラリのパスを指定するとmakeが通った。
最終的には以下のように実行。
# cd /usr/local/src/subversion-1.6.6
# make clean
# export LD_LIBRARY_PATH=/usr/local/export-2.0.1/lib/
# ./configure
# --prefix=/usr/local/subversion-1.6.6
# --with-apxs=/usr/local/httpd/bin/apxs
# --with-apr=/usr/local/apr-httpd
# --with-apr-util=/usr/local/apr-util-httpd
# --with-neon=/usr/local/neon-0.28.6
# --with-ssl
# make
# make install
設定
シンボリックリンクを張る。
環境変数の設定。~/.bash_profileに以下を追加。
# ln -s subversion-1.6.6 subversion
Apache連携用のモジュールを確認してみる。
export PATH=$PATH:/usr/local/subversion/bin
export SVN_EDITOR=/usr/bin/vim
mod_authz_svn.soとmod_dav_svn.soというモジュールが作成されている。
$ ls -lt /usr/local/httpd/modules
mod_authz_svn.so
mod_dav_svn.so
libphp5.so
mod_dav_fs.so
mod_rewrite.so
mod_dav.so
mod_proxy_ajp.so
mod_proxy_balancer.so
mod_ssl.so
mod_proxy.so
mod_proxy_connect.so
mod_proxy_ftp.so
mod_proxy_http.so
また、svn --versionとコマンド打つと組み込まれた機能を確認できる。
/usr/local/httpd/conf/extra/httpd-svn.confを作成して以下を記述。
以下のリポジトリアクセス (RA) モジュールが利用できます:* ra_neon : Neon を利用して WebDAV (DeltaV) プロトコルでリポジトリにアクセスするモジュール。
- 'http' スキームを操作します
- 'https' スキームを操作します
* ra_svn : svn ネットワークプロトコルを使ってリポジトリにアクセスするモジュール。
- 'svn' スキームを操作します
* ra_local : ローカルディスク上のリポジトリにアクセスするモジュール。
- 'file' スキームを操作します
httpd.confに以下を記述してhttpd-svn.confを読み込ませる。
DAV svn
SVNPath /var/svn/repo
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /usr/local/httpd-2.2.9/conf/.webdav_passwd
Require valid-user
BrowserMatch "MSIE" AuthDigestEnableQueryStringHack = On
# Subversion
Include conf/extra/httpd-svn.conf
インポートとチェックアウト
subversionリポジトリ用のディレクトリを作成する。
--fs-typeはリポジトリのフォーマットを指定する。
# mkdir /var/svn/
# svnadmin create --fs-type fsfs /var/svn/repo
# chown -R httpd:httpd /var/svn/repo
省略するとデフォルトが適用される。以前はBerkely DBがデフォルトだったが、バージョン1.2からFSFSがデフォルトになった。
初期インポートする。
実行すると以下のような注意が出た。
$ svn import myapp/ http://localhost/svn/myapp/trunk
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
ATTENTION! Your password for authentication realm:
http://localhost: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/totemn/.subversion/servers'.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
暗号化されていないパスワードを保存しますか (yes/no)? ./subversion/serversに以下の行を加える。
リポジトリの中身を確認してみる。
store-plaintext-passwords=no
チェックアウトする。
# svnlook tree /var/svn/repo/
> myapp/
> trunk/
data1
data2
…
# svn checkout http://localhost/svn/myapp