Trac + SVN on CentOS4^2
そんなわけで昨日の続き。
Apache2
まずはApache2の微調整。
- LanguagePriorityの先頭にja
- AddDefaultCharsetをコメント
- DocumentRootのIndexesを削除
Subversion
次にsubversionのinstall。
#yum install subversion
へ?これだけ。Windowsより楽だ。ちなみ
#yum info subversion
したら1.1.4-2.entが入った模様。では最初にリポジトリを作成。場所はあまり深く考えず/home/svnrepos。そこへサンプルとしてProj1というのプロジェクトを作る。
#mkdir -p /home/svnrepos/Proj1 #svnadmin create /home/svnrepos/Proj1
作成したProj1下へbranches,tagsを作成。trunkはEclipseから登録したとき作成する(Subclipseは同名dirがあるとエラーになるため←あまり自信なし)
#svn mkdir file://hogehoge/home/svnrepos/Proj1/branches -m "create" #svn mkdir file://hogehoge/home/svnrepos/Proj1/tags -m "create"
EclipseからはHTTPベース、つまりWeb DAV経由でアクセスするのでmod_dav_svnを追加。
#yum install mod_dav_svn
そしてhttpd.confにURLと実ディレクトリの対応を定義。
<Location /svnrepos/Proj1> DAV svn SVNPath /home/svnrepos/Proj1 </Location>
最後にapacheでリポジトリを読み書きできるよう権限を追加。
#chown -R apache:apache /home/svnrepos/Proj1
これでapacheをrestartすればOK。のはずだったが、EclipseからProj1というプロジェクトに対して「リポジトリの共用」で上記URL(http://hogehoge//svnrepos/Proj1)を指定するとInternal Error。うみゅー。これだけじゃ何が原因かわからん。試しにtelnetでつないでコマンドを投げてみると...。
#telnet hogehoge 80 Trying ... Connected to hogehoge Escape character is '^]'. OPTIONS /svnrepos/Proj1/ HTTP/1.0 HTTP/1.1 500 Internal Server Error Date: Tue, 11 Aug 2009 02:41:58 GMT Server: Apache/2.0.52 (CentOS) Content-Length: 235 Connection: close Content-Type: text/xml; charset="utf-8" <?xml version="1.0" encoding="utf-8"?> <D:error xmlns:D="DAV:" xmlns:m="http://apache.org/dav/xmlns" xmlns:C="svn:"> <C:error/> <m:human-readable errcode="13"> Could not open the requested SVN filesystem </m:human-readable> </D:error> Connection closed by foreign host.
/svnrepos/Proj1は存在しているのに「Could not open the requested SVN filesystem」というのは権限ぽい。実際ApacheのLogにも
Error string not specified yet: Can't open file '/home/svnrepos/Proj1/format': Permission denied
chmod 777してもダメ、nobodyにしてもダメ、上位ディレクトの権限をapache/nobodyにしてもダメ。なんだこりゃ。試行錯誤の末、リポジトリを/var/www以下に作ったらすんなり成功。うーん、なんでだろ。良くわからない。ともかくオペレーションとしては、リポジトリ作成が
#mkdir -p /var/www/svnrepos/Proj1 #svnadmin create /var/www/svnrepos/Proj1 #svn mkdir file://hogehoge/var/www/svnrepos/Proj1/branches -m "create" #svn mkdir file://hogehoge/var/www/svnrepos/Proj1/tags -m "create" #chown -R apache:apache /var/www/svnrepos/Proj1
httpd.confが
<Location /svnrepos/Proj1> DAV svn SVNPath /var/www/svnrepos/Proj1 </Location>
になる。
SSL
次はSSLの設定。もちろん自己証明書で。まずはmod_sslをinstall。
# yum install mod_ssl
そしてサーバ用秘密鍵と証明書を生成。
# cd /usr/share/ssl/certs/ # make server.crt umask 77 ; \ /usr/bin/openssl genrsa -des3 1024 > server.key Generating RSA private key, 1024 bit long modulus ................................++++++ ...........................++++++ e is 65537 (0x10001) Enter pass phrase:←パスワード Verifying - Enter pass phrase:←パスワード(確認) umask 77 ; \ /usr/bin/openssl req -new -key server.key -x509 -days 365 -out server.crt Enter pass phrase for server.key:←パスワード You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank.