How to create subversion repository

1. Introduction

I will show how to create subversion repository.

2. Preliminalies

We assume the followings.

  • Our repository is on External hard drive
  • OS is CentOS8
  • Subversion version is 1.10.2
  • I use my repositoris in private
  • operation user is root

3. Mounting external hard drive

(1) Get device no of my external hard drive. I got sdb1.

dmesg | grep -5 sdb

(2) List partitions. I found sdb1 on /dev/sdb

parted -l

(3) fdisk /dev/sdb. d(delete) => n(new) => w(sync). When creating a partition, press enter to any quessions.

(4) create ext4 filesystem.

mkfs.ext4 /dev/sdb1

(5) create a direcotry for a mounting point.

mkdir /mnt/buffalo

(6) open file 「vi /etc/fstab」 and add the following line.

/dev/sdb1 /mnt/buffalo ext4    defaults        0 0

4. Creating subversion repositories

(1) Install subversion and mod_dav_svn which is Subversion Apache HTTP Server Module.

yum install mod_dav_svn subversion

(2) Create repositories.

cd /mnt/buffalo
mkdir ./svn_repo/rep1
mkdir ./svn_repo/rep2
svnadmin create ./svn_repo/rep1
svnadmin create ./svn_repo/rep2

(3) open repository configuration files by “vi /mnt/buffalo/svn_repo/rep1/conf/svnserve.conf” “vi /mnt/buffalo/svn_repo/rep2/conf/svnserve.conf” and add the following to [general] section.

anon-access = none
auth-access = write
authz-db = authz

(4) open authentication configuration files by “vi /mnt/buffalo/svn_repo/rep1/conf/authz” “vi /mnt/buffalo/svn_repo/rep2/conf/ authz” and add the followings.

[/]
* = rw

(5) create a httpd configuration file by “vi /etc/httpd/conf.d/subversion.conf” and add the followings.

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
  DAV svn
  SVNListParentPath on
  SVNParentPath /mnt/buffalo/svn_repo

  Satisfy Any
  AuthType Basic
  AuthName "Authorization Realm"
  AuthUserFile /mnt/buffalo/svn_repo/users
  Require valid-user
</Location>

(6) open a service configuration file “/etc/systemd/system/svnserve.service” and add the followings.

[Unit]
Description=Subversion protocol daemon
After=syslog.target network.target

[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/svnserve
ExecStart=/usr/bin/svnserve --daemon --pid-file=/run/svnserve.pid $OPTIONS

[Install]
WantedBy=multi-user.target

(7) Edit a environment file by “/etc/sysconfig/svnserve” and change options such followings.

OPTIONS="-r /mnt/buffalo/svn_repo/rep1"

(8) create a subversion account.

htpasswd -c /mnt/buffalo/svn_repo/users user1

(9) allow http access to subversion.

firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload

(10) change owner of directory for subversion repository.

chown -R apache /mnt/buffalo/svn_repo

(11) open selinux configuration file by “vi /etc/selinux/config” and change parameter of “SELINUX” to the following value.

SELINUX=disabled

(12) Set auto-start subversion services on boot.

systemctl enable svnserve

(13) reboot

shutdown -r now

(13) confirm whether you can access a repository by accesing to url “http://<server_name>/svn/”

3. References

[1] Subversion on CentOS, CentOS wiki

https://wiki.centos.org/HowTos/Subversion

[2] Apache Subversion Binary Packages

https://subversion.apache.org/packages.html

[3] mod_dav_svn Configuration Directives

https://svnbook.red-bean.com/en/1.7/svn.ref.mod_dav_svn.conf.html

Published by ktke109

I love open souce database management systems.