end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

(再) subversion と apache httpd on rhel9 の連携

先日、同様のentryを記載しましたが、内容に不足していましたので、再掲。

目次

参考url

install subversion client

$ sudo yum install svn

create svn repository

$ pwd
/home/end0tknr/

$ mkdir svn_repos
$ /usr/bin/svnadmin create svn_repos/proj_1

$ tree -aughpD svn_repos/proj_1
svn_repos/proj_1
├── [drwxr-xr-x end0tknr end0tknr    76 Nov 18 11:26]  conf
│   ├── [-rw-r--r-- end0tknr end0tknr  1.1K Nov 18 11:26]  authz
│   ├── [-rw-r--r-- end0tknr end0tknr   885 Nov 18 11:26]  hooks-env.tmpl
│   ├── [-rw-r--r-- end0tknr end0tknr   309 Nov 18 11:26]  passwd
│   └── [-rw-r--r-- end0tknr end0tknr  4.3K Nov 18 11:26]  svnserve.conf
├── [drwxr-sr-x end0tknr end0tknr   233 Nov 18 11:26]  db
│   ├── [-rw-r--r-- end0tknr end0tknr     2 Nov 18 11:26]  current
│   ├── [-r--r--r-- end0tknr end0tknr    41 Nov 18 11:26]  format
│   ├── [-rw-r--r-- end0tknr end0tknr   11K Nov 18 11:26]  fsfs.conf
│   ├── [-rw-r--r-- end0tknr end0tknr     5 Nov 18 11:26]  fs-type
│   ├── [-rw-r--r-- end0tknr end0tknr     2 Nov 18 11:26]  min-unpacked-rev
│   ├── [drwxr-sr-x end0tknr end0tknr    15 Nov 18 11:26]  revprops
│   │   └── [drwxr-sr-x end0tknr end0tknr    15 Nov 18 11:26]  0
│   │       └── [-r--r--r-- end0tknr end0tknr    50 Nov 18 11:26]  0
│   ├── [drwxr-sr-x end0tknr end0tknr    15 Nov 18 11:26]  revs
│   │   └── [drwxr-sr-x end0tknr end0tknr    15 Nov 18 11:26]  0
│   │       └── [-r--r--r-- end0tknr end0tknr   253 Nov 18 11:26]  0
│   ├── [drwxr-sr-x end0tknr end0tknr     6 Nov 18 11:26]  transactions
│   ├── [-rw-r--r-- end0tknr end0tknr     2 Nov 18 11:26]  txn-current
│   ├── [-rw-r--r-- end0tknr end0tknr     0 Nov 18 11:26]  txn-current-lock
│   ├── [drwxr-sr-x end0tknr end0tknr     6 Nov 18 11:26]  txn-protorevs
│   ├── [-rw-r--r-- end0tknr end0tknr    74 Nov 18 11:26]  uuid
│   └── [-rw-r--r-- end0tknr end0tknr     0 Nov 18 11:26]  write-lock
├── [-r--r--r-- end0tknr end0tknr     2 Nov 18 11:26]  format
├── [drwxr-xr-x end0tknr end0tknr   231 Nov 18 11:26]  hooks
│   ├── [-rwxr-xr-x end0tknr end0tknr  2.5K Nov 18 11:26]  post-commit.tmpl
│   ├── [-rwxr-xr-x end0tknr end0tknr  2.7K Nov 18 11:26]  post-lock.tmpl
│   ├── [-rwxr-xr-x end0tknr end0tknr  2.9K Nov 18 11:26]  post-revprop-change.tmpl
│   ├── [-rwxr-xr-x end0tknr end0tknr  2.5K Nov 18 11:26]  post-unlock.tmpl
│   ├── [-rwxr-xr-x end0tknr end0tknr  3.9K Nov 18 11:26]  pre-commit.tmpl
│   ├── [-rwxr-xr-x end0tknr end0tknr  3.5K Nov 18 11:26]  pre-lock.tmpl
│   ├── [-rwxr-xr-x end0tknr end0tknr  3.4K Nov 18 11:26]  pre-revprop-change.tmpl
│   ├── [-rwxr-xr-x end0tknr end0tknr  3.2K Nov 18 11:26]  pre-unlock.tmpl
│   └── [-rwxr-xr-x end0tknr end0tknr  3.6K Nov 18 11:26]  start-commit.tmpl
├── [drwxr-xr-x end0tknr end0tknr    41 Nov 18 11:26]  locks
│   ├── [-rw-r--r-- end0tknr end0tknr   139 Nov 18 11:26]  db.lock
│   └── [-rw-r--r-- end0tknr end0tknr   139 Nov 18 11:26]  db-logs.lock
└── [-rw-r--r-- end0tknr end0tknr   246 Nov 18 11:26]  README.txt

config apache httpd

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

<Location /proj_1>
  DAV svn
  AuthType Basic
  AuthName "DAV SVN PROJ-1"
  AuthUserFile /home/end0tknr/svn_repos/.svnpasswd
  Require valid-user
  SVNPath /home/end0tknr/svn_repos/proj_1
  AuthzSVNAccessFile /home/end0tknr/svn_repos/proj_1/conf/authz
</Location> 
$ /usr/bin/htpasswd -c /home/end0tknr/svn_repos/.svnpasswd end0tknr

$ cat /home/end0tknr/svn_repos/.svnpasswd
end0tknr:$apr1$5o/ilPYg$gSHVLhtv1J4QyJZg5t7YN.

config subversion authz

$ cd /home/end0tknr/svn_repos/proj_1/conf/
$ mv authz authz.org

$ vi authz

[/]
* = rw

chown repository dirs

$ sudo chown -R apache:apache svn_repos

以下は、必要ないかもしれません

$ sudo usermod -aG apache end0tknr
$ id end0tknr
uid=1000(end0tknr) gid=1000(end0tknr) groups=1000(end0tknr),10(wheel),48(apache)

restart apache httpd

$ sudo systemctl restart httpd

コマンドラインから接続テスト

$ svn --username end0tknr checkout http://localhost/proj_1/

[end0tknr@rhel9 tmp]$ svn --username end0tknr checkout http://localhost/proj_1/
Authentication realm: <http://localhost:80> DAV SVN PROJ-1
Password for 'end0tknr': ********

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

   <http://localhost:80> DAV SVN PROJ-1

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/end0tknr/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
A    subversion_test_commit_file.url
Checked out revision 1.
[end0tknr@rhel9 tmp]$ ls
foo2.py  foo4.py  nginx-1.24.0  nginx-1.24.0.tar.gz  proj_1
[end0tknr@rhel9 tmp]$ cd proj_1/
[end0tknr@rhel9 proj_1]$ cd ../
[end0tknr@rhel9 tmp]$ tree -aughpD proj_1
proj_1
├── [-rw-r--r-- end0tknr end0tknr    83 Nov 18 11:42]  subversion_test_commit_file.url
└── [drwxr-xr-x end0tknr end0tknr    96 Nov 18 11:42]  .svn
    ├── [-rw-r--r-- end0tknr end0tknr     3 Nov 18 11:42]  entries
    ├── [-rw-r--r-- end0tknr end0tknr     3 Nov 18 11:42]  format
    ├── [drwxr-xr-x end0tknr end0tknr    16 Nov 18 11:42]  pristine
    │   └── [drwxr-xr-x end0tknr end0tknr    63 Nov 18 11:42]  99
    │       └── [-r--r--r-- end0tknr end0tknr    83 Nov 18 11:42]  998cc647881e503203f3446f47c88486ea634e03.svn-base
    ├── [drwxr-xr-x end0tknr end0tknr     6 Nov 18 11:42]  tmp
    ├── [-rw-r--r-- end0tknr end0tknr  120K Nov 18 11:42]  wc.db
    └── [-rw-r--r-- end0tknr end0tknr     0 Nov 18 11:42]  wc.db-journal

4 directories, 6 files