#topicpath
----
Subversion 1.6.11 をインストールしてみました。

バイナリからのインストールでは環境依存の問題が多く柔軟性に欠けるため、ソースから作ってみます。

#contents

* 環境 [#db6419d3]

- Sun Ultra80
- Solaris 10 (10/09)
- Sun Studio 12 update 1

[[技術文書/Solaris/Subversion1.4.3をインストール]] のページを参考にしてインストールしたバイナリパッケージがあれば、
あらかじめ削除しておきます。

#pre{{
bash-3.00# pkgrm SMCdb SMCexpat SMCgdbm ...
}}

#pre{{
bash-3.00# pkginfo | grep SMC
system      SUNWjmgts                        Japanese Trusted Extensions, SMC
system      SUNWmgts                         Trusted Extensions, SMC
application SUNWtsmc                         Trusted Extensions SMC Server
bash-3.00# 
}}

Sun Studio 12 については別途インストール記事を書きました。

- [[技術文書/Solaris/SunStudio12を使う]]

* ソースファイルのダウンロード [#d50a7ea7]

- Subversion 1.6.11
-- http://subversion.apache.org/source-code.html
-- subversion-1.6.11.tar.bz2
- m4
-- ftp://ftp.iij.ad.jp/pub/gnu/gnu/m4/
-- m4-1.4.14.tar.bz2
- autoconf
-- ftp://ftp.iij.ad.jp/pub/gnu/gnu/autoconf/
-- autoconf-2.65.tar.bz2'
- libtool
-- ftp://ftp.iij.ad.jp/pub/gnu/gnu/libtool/
-- libtool-2.2.10.tar.gz
- OpenSSL
-- http://www.openssl.org/source/
-- openssl-1.0.0a.tar.gz
- Apache APR
-- http://apr.apache.org/download.cgi
-- apr-1.4.2.tar.bz2
-- apr-util-1.3.9.tar.bz2
- Apache httpd
-- http://httpd.apache.org/download.cgi
-- httpd-2.2.15.tar.bz2
- neon
-- http://www.webdav.org/neon/
-- neon-0.29.3.tar.gz
- serf
-- http://code.google.com/p/serf/
-- serf-0.3.1.tar.bz2 ''(注) 0.6.1 は make が通らず。''
- sqlite
-- http://www.sqlite.org/download.html
-- sqlite-amalgamation-3.6.23.1.tar.gz

* 各ソフトウェアのビルドとインストール [#le2e3fe7]

環境変数を設定しておきます。

#pre{{
bash-3.00# export PATH=/usr/local/bin:/opt/sunstudio12.1/bin:/usr/ccs/bin:/usr/sbin:/usr/bin
}}

後で依存関係に悩まないよう、
OS インストール時に入った GNU モノ (/usr/sfw/bin/) を使わないようにしています。

ここで新しく作るものは /usr/local/ 以下に入れるものとします。

バイナリは 32bit のものを作ります。

** m4 [#vf78bbe5]

展開します。

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfj m4-1.4.14.tar.bz2 
}}

configure して make します。

#pre{{
bash-3.00# cd m4-1.4.14
bash-3.00# ./configure --prefix=/usr/local
...
bash-3.00# make
...
bash-3.00# make install
}}

確認します。

#pre{{
bash-3.00# which m4
/usr/local/bin/m4
bash-3.00# m4 --version
m4 (GNU M4) 1.4.14
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Rene' Seindal.
bash-3.00# 
}}

** autoconf [#n4f021d7]

m4 と同じような繰り返しになります。

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfj autoconf-2.65.tar.bz2 
bash-3.00# cd autoconf-2.65
bash-3.00# ./configure --prefix=/usr/local
...
bash-3.00# make
...
bash-3.00# make install
...
bash-3.00# which autoconf
/usr/local/bin/autoconf
bash-3.00# autoconf --version
autoconf (GNU Autoconf) 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.
bash-3.00# 
}}

** libtool [#jfe33789]

これも同様です。

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfz libtool-2.2.10.tar.gz 
bash-3.00# cd libtool-2.2.10
bash-3.00# ./configure --prefix=/usr/local
...
bash-3.00# make
...
bash-3.00# make install
...
bash-3.00# which libtool
/usr/local/bin/libtool
bash-3.00# libtool --version
libtool (GNU libtool) 2.2.10
Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996

Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
bash-3.00# 
}}

** OpenSSL [#s29a1e97]

少々作り方が異なります。大物なので時間も掛かります。

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfz openssl-1.0.0a.tar.gz 
...
bash-3.00# cd openssl-1.0.0a
bash-3.00# ./config --prefix=/usr/local shared
...
bash-3.00# make
...
bash-3.00# make test
...
bash-3.00# echo $?
0
}}

make test が成功していることを確認して、
make install します。
もし失敗していれば、$? が 0 以外の値を返すはずです。

#pre{{
bash-3.00# make install
...
bash-3.00# which openssl
/usr/local/bin/openssl
bash-3.00# openssl version
OpenSSL 1.0.0a 1 Jun 2010
}}

make のときに各 .c のコンパイルで

#pre{{
cc: 警告: -xarch=v8plus は非推奨です。代わりに -m32 -xarch=sparc を使用してくだ さい
}}

というメッセージが出ますが、
make test が通っていれば特に気にしなくても大丈夫です。

*** 注 [#y60dc0a8]

32bit で統一して作っているので、
Solaris x86 ではこのようにしたほうがいいようです。

#pre{{
bash-3.00# ./Configure solaris-x86-gcc --prefix=/usr/local shared
}}

** Apache APR [#cde07cba]

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfj apr-1.4.2.tar.bz2
bash-3.00# cd apr-1.4.2
bash-3.00# ./configure --prefix=/usr/local
...
bash-3.00# make
...
bash-3.00# make install
...
bash-3.00# which apr-1-config
/usr/local/bin/apr-1-config
bash-3.00# apr-1-config --version
1.4.2
}}

apr-util ではいま作った APR を指定して configure します。

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfj apr-util-1.3.9.tar.bz2 
bash-3.00# cd apr-util-1.3.9
bash-3.00# ./configure --prefix=/usr/local --with-apr=/usr/local
...
bash-3.00# make
...
bash-3.00# make install
...
bash-3.00# which /usr/local/bin/apu-1-config 
/usr/local/bin/apu-1-config
bash-3.00# /usr/local/bin/apu-1-config --version
1.3.9
}}

** Apache httpd [#qaa8b88c]

configure は昔からなのですがちょっと工夫を要します。
/usr/local/apache2 に入れました。

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfj httpd-2.2.15.tar.bz2 
...
bash-3.00# cd httpd-2.2.15
bash-3.00# ./configure --prefix=/usr/local/apache2 \
> --enable-modules=most --enable-mods-shared=most \
> --with-apr=/usr/local/bin/apr-1-config \
> --with-apr-util=/usr/local/bin/apu-1-config \
> --with-ssl=/usr/local --enable-ssl
...
bash-3.00# make
...
bash-3.00# make install
...
bash-3.00# /usr/local/apache2/bin/httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Jun 17 2010 16:35:13
}}

** neon [#hd9ff17c]

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfz neon-0.29.3.tar.gz 
bash-3.00# cd neon-0.29.3
bash-3.00# ./configure --prefix=/usr/local --with-libs=/usr/local \
> --with-ssl=openssl
...
configure: Configured to build neon 0.29.3:

  Install prefix:  /usr/local
  Compiler:        cc
  XML Parser:      libxml 2.6.23
  SSL library:     SSL support enabled, using OpenSSL (0.9.7 or later)
  zlib support:    zlib support enabled, using -lz
  Build libraries: Shared=no, Static=yes

bash-3.00# make
...
bash-3.00# make install
...
bash-3.00# /usr/local/bin/neon-config --version
neon 0.29.3
}}

** serf [#nc67ec2b]

最新版の 0.6.1 では make が通らなかったため、
0.3.1 を利用しました。
あとは OpenSSL を指定するのがポイントです。

neon があれば、serf はなくても大丈夫です。

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfj serf-0.3.1.tar.bz2 
...
bash-3.00# cd serf-0.3.1
bash-3.00# ./configure --prefix=/usr/local --with-openssl=/usr/local
...
bash-3.00# make
...
bash-3.00# make install
...
}}

** sqlite [#xe6dba39]

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfz sqlite-amalgamation-3.6.23.1.tar.gz 
...
bash-3.00# cd sqlite-3.6.23.1
bash-3.00# ./configure --prefix=/usr/local
...
bash-3.00# make
...
bash-3.00# make install
...
bash-3.00# which sqlite3
/usr/local/bin/sqlite3
bash-3.00# sqlite3 --version
3.6.23.1
}}

** Subversion [#b02f63a8]

#pre{{
bash-3.00# /usr/sfw/bin/gtar xvpfj subversion-1.6.11.tar.bz2 
...
}}

依存するライブラリやコマンドを指定して configure します。
subversion-deps-1.6.11.tar.bz2 のファイルを展開すれば必要なものは一緒に作ってくれるとのことですが、
うまくいかなかったので個別に作ったのを指定するようにしています。

#pre{{
bash-3.00# cd subversion-1.6.11
bash-3.00# ./configure --prefix=/usr/local \
> --with-apr=/usr/local/bin/apr-1-config \
> --with-apr-util=/usr/local/bin/apu-1-config \
> --with-neon=/usr/local \
> --with-serf=/usr/local \
> --with-sqlite=/usr/local \
> --without-berkeley-db
}}

BerkeleyDB が見つからないという警告が出ますが、
使わないので無視します。
いまの Subversion は標準では FSFS という形式でリポジトリのデータを保持します。

#pre{{
bash-3.00# make
...
bash-3.00# make install
...
bash-3.00# which svn
/usr/local/bin/svn
bash-3.00# svn --version
svn, version 1.6.11 (r934486)
   compiled Jun 17 2010, 17:22:02

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - handles 'http' scheme
  - handles 'https' scheme

bash-3.00# 
}}

* 動作確認 [#n23bbc40]

** Apache の設定 [#mcccf0ef]

/usr/local/apache2/conf/httpd.conf を編集して、
User と Group を webservd にします。

#pre{{
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
#User daemon
#Group daemon
User webservd
Group webservd
}}

最後に Include も書いておきます。

#pre{{
# Subversion
Include conf/httpd-subversion.conf
}}

この別出しした設定ファイルも書きます。
DAV 周りはすでに入っていたので、最初の2行はコメントアウトで問題ありません。

- http://localhost/svnrepo/ でアクセス
- リポジトリは /u01/svnrepo/ 以下
- パスワードファイルは /usr/local/apache2/conf/svn-htpasswd
- 読み書きにアクセス権限が必要

#pre{{
#LoadModule dav_svn_module modules/mod_dav_svn.so
#LoadModule authz_svn_module modules/mod_authz_svn.so

<Location /svnrepo>
   DAV svn
   SVNParentPath /u01/svnrepo/

   AuthType Basic
   AuthName "Authorization Realm"
   AuthUserFile /usr/local/apache2/conf/svn-htpasswd
   Require valid-user
</Location>
}}

なお、アクセス制限を書き込みのみに制限することもできます。LimitExcept で除外します。

#pre{{
#LoadModule dav_svn_module modules/mod_dav_svn.so
#LoadModule authz_svn_module modules/mod_authz_svn.so

<Location /svnrepo>
   DAV svn
   SVNParentPath /u01/svnrepo/

   # Limit write permission to list of valid users.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
     AuthType Basic
     AuthName "Authorization Realm"
     AuthUserFile /usr/local/apache2/conf/svn-htpasswd
     Require valid-user
   </LimitExcept>
</Location>
}}

この設定が正しいことを確認します。
今回は上の読み書き両方に制限を掛けるほうを使いました。

#pre{{
bash-3.00# /usr/local/apache2/bin/apachectl configtest
Syntax OK
}}

起動スクリプトを確認します。
/lib/svc/method/http-apache2 の下記の点を直しました。

#pre{{
#APACHE_HOME=/usr/apache2
#CONF_FILE=/etc/apache2/httpd.conf
APACHE_HOME=/usr/local/apache2
CONF_FILE=/usr/local/apache2/conf/httpd.conf
}}

起動してみます。

#pre{{
bash-3.00# svcadm disable http
bash-3.00# svcadm enable http
bash-3.00# svcs -p http
STATE          STIME    FMRI
online         17:50:46 svc:/network/http:apache2
               17:50:46    27758 httpd
               17:50:46    27759 httpd
               17:50:46    27760 httpd
               17:50:46    27761 httpd
               17:50:46    27762 httpd
               17:50:46    27763 httpd
               17:51:26    27768 httpd
bash-3.00# svcs -xv
bash-3.00# 
}}

問題なく上がってきています。

** Subversion のユーザ設定 [#gf3545e1]

ユーザを設定します。
/usr/local/apache2/conf/svn-htpasswd が上で設定したパスワードファイルです。

#pre{{
bash-3.00# /usr/local/apache2/bin/htpasswd -c /usr/local/apache2/conf/svn-htpasswd sugimura
New password: 
Re-type new password: 
Adding password for user sugimura
bash-3.00# 
}}

この後ユーザを追加していくときは -c は不要です。

** クライアントからのアクセス [#d887e7b0]

これは以前作ったリポジトリだったため、checkout からしてみます。

#pre{{
-bash-3.00$ /usr/local/bin/svn checkout http://localhost/svnrepo/myrepo
Authentication realm: <http://localhost:80> Authorization Realm
Password for 'sugimura': 

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

   <http://localhost:80> Authorization Realm

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/sugimura/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
A    myrepo/subversion_sample.txt
Checked out revision 1.
-bash-3.00$ 
}}

ファイルもちゃんと管理されていることがわかります。

#pre{{
-bash-3.00$ ls myrepo
subversion_sample.txt
-bash-3.00$ /usr/local/bin/svn log myrepo/subversion_sample.txt 
Authentication realm: <http://localhost:80> Authorization Realm
Password for 'sugimura': 
------------------------------------------------------------------------
r1 | sugimura | 2010-04-06 17:36:35 +0900 (火, 06  4月 2010) | 1 line

first commit
------------------------------------------------------------------------
-bash-3.00$ 
}}

* Python Bindings のインストール [#sb2fdefb]

Python と Subversion の連携モジュールも作りました。

上の Subversion 1.6.11 をコンパイルした環境で make します。
消してしまったときは configure からやり直してください。

#pre{{
bash-3.00# cd subversion-1.6.11
bash-3.00# make swig-py
...
bash-3.00# make install-swig-py
...
}}

/usr/local/lib/svn-python/ 以下に入るので、
python に教えてあげます。

#pre{{
bash-3.00# echo "/usr/local/lib/svn-python" > /usr/lib/python2.4/site-packages/svn-python.pth
}}

ちゃんとインストールされているかどうかは python から確認できます。

#pre{{
bash-3.00# python 
Python 2.4.4 (#1, Jan 10 2007, 01:25:01) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from svn import fs, repos, core, delta
>>> ^D
bash-3.00# 
}}

from ... の文でエラーが出なければ OK です。

[[技術文書/Solaris/Trac0.11.7.ja1をインストール]] では
リポジトリへのアクセスに失敗していましたが、
このモジュールが入れば大丈夫です。

----
#comment

トップ   差分 履歴 リロード   一覧 検索 最終更新   ヘルプ   最終更新のRSS