Subversion をソースからインストール

root になれない状況でインストールしてみましたメモ.
以下の異常時の対処は configure の中身をのぞいてほげほげしてみました.

  • ... は省略していることをあらわしています.
  • すべて $DIR 配下にインストールするようにしました.
  • ドキュメントはちゃんと読みましょう :-)

まずは http://subversion.tigris.org/ からソースを入手.

% tar xzf subversion-1.5.2.tar.gz
% cd subversion-1.5.2
% ./configure --prefix=$DIR
...
checking for Apache module support via DSO through APXS... no
==================================================================
WARNING: skipping the build of mod_dav_svn
         --with-apxs or --with-apache must be used
==================================================================
configure: Apache Portable Runtime (APR) library configuration
checking for APR... no
configure: WARNING: APR not found
The Apache Portable Runtime (APR) library cannot be found.
Please install APR on this system and supply the appropriate
 --with-apr option to 'configure'
...


% view INSTALL
...
  B. Dependency Overview
...
      * libapr and libapr-util (REQUIRED for client and server)
...
      * libneon or libserf  (OPTIONAL for client)
...
      * OpenSSL (OPTIONAL for client and server)
...
      * Berkeley DB (OPTIONAL for client and server)
...

http://apr.apache.org/ から apr/apr-util のソースを入手

% tar xvzf apr-1.3.3.tar.gz
% cd apr-1.3.3.tar.gz
% ./configure --prefix=$DIR
% make && make install

% tar xvzf apr-util-1.3.4.tar.gz
% cd apr-util-1.3.4/
% ./configure --prefix=$DIR --with-apr=$DIR
% make && make install 
...
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'
...

環境変数 LD_LIBRARY_PATH に $DIR/lib を追加

% cd subversion-1.5.2
% ./configure --prefix=$DIR --with-apr=$DIR  --with-apr-util=$DIR
...
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
...
% ls Makefile
Makefile

Makefile はできているようだけど, berkeley-db をいれることにする. berkeley-db を使わない場合はここで make すればいいと思われる. 上記 URL からソースを入手して

% tar xvzf db-4.7.25.tar.gz
% cd db-4.7.25
...
  @see docs/index.html
...
% cd build_unix
% ../dist/configure --prefix=$DIR
% make && make install


% cd subversion-1.5.2
% ./configure --prefix=$DIR  --with-apr=$DIR  --with-apr-util=$DIR --with-berkeley-db=$DIR
...
checking for socket in -lsocket... no
configure: error: APR-UTIL was installed independently, it won't be
                        possible to use the specified Berkeley DB: /XXXX

(apr-util のバージョンを調べにいって, berkeley-db を使わないモードなので?エラーになっている)
% $DIR/bin/apu-1-config --db-version
0   # berkeley-db 使わないモード
% cd apr-util-1.3.4/
% ./configure --prefix=$DIR --with-apr=$DIR --with-berkeley-db=$DIR
% make clean
% make && make install
% $DIR/bin/apu-1-config --db-version
4   # berkeley-db 使うモード

% cd subversion-1.5.2
% ./configure --prefix=$DIR  --with-apr=$DIR  --with-apr-util=$DIR --with-berkeley-db=$DIR
% make && make install

これでインストール完了. svnserve を立ち上げてクライアントから接続できるようになりました.

% mkdir $SVNDIR
% svnadmin create $SVNDIR
% vi $SVNDIR/conf/svnserve.conf
@@ -12,3 +12,3 @@
  # anon-access = read
 -# auth-access = write
 +auth-access = write
  ### The password-db option controls the location of the password
@@ -19,3 +19,3 @@
  ### Uncomment the line below to use the default password file.
 -# password-db = passwd
 +password-db = passwd
  ### The authz-db option controls the location of the authorization
% vi $SVNDIR/conf/passwd
[users]
mariyie = tako
% svnserver --listen-port 9876 -d

client % cd xxx
client % svn import --username mariyie svn://server:9876/$SVNDIR/ -m "initial import"
....