忍者ブログ

hirano.xxxxxxxx.jp

自分用のメモ置き場
MENU

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

subversion(2)

subversionの続きです。(・ω・)

ぇーと前回は、httpdを使ってサーバを起動しました。

が、さすがにsubversionの為だけにhttpd動かすのもなんだし、httpdは大抵他の用途にも使っていたりして色々と面倒なこともあるので、svnserveというsubversion専用のサーバを動かすことにします。

調べてみると

・svnserveをデーモン起動
・xinetd経由で1アクセスごとにsvnserveを起動

の2方式があるみたいです。
どちらでもいいと思うのですが、手順が簡単なので今回はデーモン起動にしたいと思います。

/etc/rc.d/init.d/svnserve
#!/bin/bash
#
# svnserve        Startup script for the Subversion svnserve daemon
#
# chkconfig: - 85 15
# description: Subversion svnserve daemon
# processname: svnserve
# pidfile: /var/run/svnserve.pid

# Source function library.
. /etc/rc.d/init.d/functions

export SVNSERVE=/usr/bin/svnserve
export SVNSERVE_PID=/var/run/svnserve.pid
export SVNSERVE_OPTS="--daemon --root /var/www/svn --pid-file ${SVNSERVE_PID}"

RETVAL=0

start() {
    ${SVNSERVE} ${SVNSERVE_OPTS}
    RETVAL=$?
    return ${RETVAL}
}

stop() {
    if [ -f ${SVNSERVE_PID} ]; then
        kill -9 `cat ${SVNSERVE_PID}`
        rm ${SVNSERVE_PID}
    fi
    RETVAL=$?
    return ${RETVAL}
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    ;;
  status)
    status -p ${SVNSERVE_PID} svnserve
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $prog {start|stop|restart|status}"
    exit 1
esac

exit $RETVAL

(このファイルをダウンロードする)

サンプルを見つけられなかったので、適当に書きました。(^ω^;)
とりあえず、動くのでこれでよしとします。

chkconfig --add /etc/rc.d/init.d/svnserve






















外部からアクセスする場合はSELinuxで3690/tcpを空けておきましょう。



さて、次は接続するユーザ名とかパスワードとかを設定してみます。

前回、/var/www/svn/hiranoというレポジトリを作ったので、
/var/www/svn/hirano/conf

に設定ファイルがあります。

/var/www/svn/hirano/conf/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]
### 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
### 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.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the conf
### directory.  If you don't specify an authz-db, no path-based access
### control is done.
### Uncomment the line below to use the default authorization file.
# authz-db = authz
### 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

赤字の行のコメントはずすだけです。

・匿名ユーザは読むだけ
・認証ユーザは書き込み可能
・パスワードのファイルはpasswd

と書いてあります。たぶん。(^ω^;)
なのでpasswdというファイルを編集します。

/var/www/svn/hirano/conf/passwd

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret
hirano = ******
(実際に******とか書かないでねっ)

username = password

ベタみたいです。別にいいけど。
一応、書き込みの確認とかしてみましょう。hiranoの下にtestのフォルダを作成してみます。

$ svn mkdir svn://localhost/hirano/test -m 'てすと' --username hirano --password ******
リビジョン 27 をコミットしました。

おお。できた。(・∀・)
PR

× CLOSE

カレンダー

04 2024/05 06
S M T W T F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

最新CM

[09/19 Gatu]
[06/08 石井弘明]
[03/04 yama]
[02/15 ひらの]
[02/14 魔]

最新記事

最新TB

ブログ内検索

最古記事

(12/30)
(01/03)
(01/04)
(01/04)
(01/04)

NINJATOOLS

× CLOSE

Copyright © hirano.xxxxxxxx.jp : All rights reserved

TemplateDesign by KARMA7

忍者ブログ [PR]