SubversionのLinux(RedHat)上での起動
リポジトリ作成
とりあえず、リポジトリの構成を次のようにすることにしてみた。
[ibm]-[ut]
-[ita]
-[itb]
実際のディレクトリ構成は、
/root/svn/reps/ibm/ut ----[UT用リポジトリ]
/ita ----[ITa用リポジトリ]
/itb ----[ITb用リポジトリ]
[root@javabean ibm]# pwd /root/svn/reps/ibm
この状態からリポジトリを作成していきます。
[root@javabean ibm]# svnadmin create /root/svn/reps/ibm/ut [root@javabean ibm]# svnadmin create /root/svn/reps/ibm/ita [root@javabean ibm]# svnadmin create /root/svn/reps/ibm/itb [root@javabean ibm]# ls -l * ita: 合計 28 -rw-r--r-- 1 root root 379 6月 13 15:00 README.txt drwxr-xr-x 2 root root 4096 6月 13 15:00 conf drwxr-xr-x 2 root root 4096 6月 13 15:00 dav drwxr-sr-x 2 root root 4096 6月 13 15:00 db -r--r--r-- 1 root root 2 6月 13 15:00 format drwxr-xr-x 2 root root 4096 6月 13 15:00 hooks drwxr-xr-x 2 root root 4096 6月 13 15:00 locks itb: 合計 28 -rw-r--r-- 1 root root 379 6月 13 15:00 README.txt drwxr-xr-x 2 root root 4096 6月 13 15:00 conf drwxr-xr-x 2 root root 4096 6月 13 15:00 dav drwxr-sr-x 2 root root 4096 6月 13 15:00 db -r--r--r-- 1 root root 2 6月 13 15:00 format drwxr-xr-x 2 root root 4096 6月 13 15:00 hooks drwxr-xr-x 2 root root 4096 6月 13 15:00 locks ut: 合計 28 -rw-r--r-- 1 root root 379 6月 13 15:00 README.txt drwxr-xr-x 2 root root 4096 6月 13 15:00 conf drwxr-xr-x 2 root root 4096 6月 13 15:00 dav drwxr-sr-x 2 root root 4096 6月 13 15:00 db -r--r--r-- 1 root root 2 6月 13 15:00 format drwxr-xr-x 2 root root 4096 6月 13 15:00 hooks drwxr-xr-x 2 root root 4096 6月 13 15:00 locks
というように、リポジトリが3つ作成されました。
svnserve設定
今回はlocalhostではなくリモートのRedHatサーバ上にSubversionをたてているので、
svnserveを起動させて接続させる必要があります。
Apacheを利用して、http://あるいはhttps://でのアクセス方式もありますが、
svn://の方が高速(?)という事を聞いたのでsvnserveによる接続をとります。
次のsvnserve.confを使用して設定を行います。
[root@javabean conf]# pwd /root/svn/reps/ibm/ut/conf [root@javabean conf]# ls svnserve.conf
内容は、
### This file controls the configuration of the svnserve daemon, if you ### use it to allow access to this repository. (If you only allow ### access through http: and/or file: URLs, then this file is ### irrelevant.) ### Visit http://subversion.tigris.org/ for more information. # [general] [general] ### These options control access to the repository for unauthenticated ### and authenticated users. Valid values are "write", "read", ### and "none". The sample settings below are the defaults. # anon-access = read # auth-access = write anon-access = none auth-access = write ### The password-db option controls the location of the password ### database file. Unless you specify a path starting with a /, ### the file's location is relative to the conf directory. ### The format of the password database is similar to this file. ### It contains one section labelled [users]. The name and ### password for each user follow, one account per line. The ### format is ### USERNAME = PASSWORD ### Please note that both the user name and password are case ### sensitive. There is no default for the password file. password-db = passwd ### This option specifies the authentication realm of the repository. ### If two repositories have the same authentication realm, they should ### have the same password database, and vice versa. The default realm ### is repository's uuid. # realm = My First Repository
今はsvnserve.confと同じ階層に入れています。
[root@javabean conf]# pwd /root/svn/reps/ibm/ut/conf [root@javabean conf]# ls -l 合計 12 -rw-r--r-- 1 root root 53 6月 13 15:10 passwd -rw-r--r-- 1 root root 1408 6月 13 15:06 svnserve.conf [root@javabean conf]# cat passwd [users] #[USER] = [PASSWORD] root = ibm ibm001 = ibm001
svnserve起動
svnserveにオプション[-d]をつけることによって、デーモンモードで起動することになります。
また、デフォルトのリスナーポートは3690になります。
[root@javabean ut]# svnserve -d [root@javabean ut]# ps -ef|grep svn root 4961 1 0 15:15 ? 00:00:00 svnserve -d [root@javabean ut]# netstat -an|grep 3690 tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
TortoiseSVNから接続してみます。
接続先URLは、
svn://192.168.1.230:3690/root/svn/reps/ibm/ut
と絶対パスで記述することになります。
接続が確認出来た時点で、一度svnserveを停止します。デーモンモードで起動した場合は、プロセスをkillします。
次に、-rオプションをつけて、
[root@javabean ibm]# svnserve -d -r /root/svn/reps
と起動します。
先ほどと同じURL
svn://192.168.1.230/root/svn/reps/ibm/ut
でアクセスすると、リポジトリが見つからないとエラーが発生します。
- rオプションは、ホームディレクトリを指定するオプションになります。
このオプションを指定することで、実際のディレクトリ構成を隠蔽することができるためセキュリティの面からも、
URLの簡易性からも非常に便利なオプションです。
次のURLでの接続が確認できました。
svn://192.168.1.230/ibm/ut