end0tknr's kipple - web写経開発


subversion と apache httpd on rhel9 の連携




install subversion client

$ sudo yum install svn

create svn repository

$ sudo mkdir -p /var/svn/repos
$ sudo svnadmin create /var/svn/repos/project
$ ls -l /var/svn/repos/project
total 8
drwxr-xr-x 2 root root  76 Nov  2 17:48 conf
drwxr-sr-x 6 root root 233 Nov  2 17:48 db
-r--r--r-- 1 root root   2 Nov  2 17:48 format
drwxr-xr-x 2 root root 231 Nov  2 17:48 hooks
drwxr-xr-x 2 root root  41 Nov  2 17:48 locks
-rw-r--r-- 1 root root 246 Nov  2 17:48 README.txt

subversion用 認証権限情報作成

$ sudo vi /var/svn/repos/project/conf/authzsvn.conf

developer = end0tknr,fedora
operator = redhat

* = r

@developer = rw

@operator = rw

@operator = rw
$ sudo chown -R apache. /var/svn/repos/project
$ ls -l /var/svn/repos
drwxr-xr-x 2 apache apache 6 Nov  1 19:56 project

apache httpd用 module install

$ sudo yum install mod_dav_svn
$ ls -l /usr/lib64/httpd/modules
-rwxr-xr-x 1 root root 215504 Apr 27  2022 mod_dav_svn.so

subversionapache httpd の連携環境には 以下のapache http モジュールが必要ですので、 不足があれば、インストールしてください。

LoadModule dav_module           modules/mod_dav.so    WebDAV用
LoadModule dav_fs_module        modules/mod_dav_fs.so    mod_dav.soのサポート用
LoadModule dav_svn_module       modules/mod_dav_svn.so   subversion
LoadModule authz_svn_module     modules/mod_authz_svn.so subversion認証?

apache httpd用 設定file追加

$ sudo vi /etc/httpd/conf.d/subversion.conf

<Location /project>
    DAV svn
    AuthType Basic
    AuthName "DAV SVN"
    AuthUserFile /var/svn/.svnpasswd
    Require valid-user
    SVNPath /var/svn/repos/project
    AuthzSVNAccessFile /var/svn/repos/project/conf/authzsvn.conf
$ sudo htpasswd -c /var/svn/.svnpasswd end0tknr
New password: 
Re-type new password: 
Adding password for user end0tknr
$ sudo systemctl restart httpd


Authentication realm: <http://localhost:80> DAV SVN
Password for 'end0tknr': ********

ATTENTION!  Your password for authentication realm:

   <http://localhost:80> DAV SVN

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
Store password unencrypted (yes/no)? yes