Setting up the Subversion repository

Subversion manages files in a central database called a repository.
In this section, we show how to use svnserve as an example of SVN environment setup method.

Note
In the following example, CentOS 7 Linux 3.10.0-693.2.2.el7.x86_64 is used.

Installation of SVN

Get the subversion package.

yum update
yum install subversion

Create a repository

Create a repository with svnadmin.

mkdir -p /svn/repos
svnadmin create/svn/repos/repo1

Change directory permissions.

chmod -R 777 /svn/repos

From /etc/sysconfig/svnserve, set the svnserve repository root.

OPTIONS="-r /svn/repos"

User and password registration

Rewrite /svn/repos/repo1/conf/svnserve.conf and set access rights.

[general]
anon-access = none
auth-access = write

Rewrite /svn/repos/repo1/conf/passwd and set the user name and password.

[users]
user.alpha = pass.alpha
user.beta = pass.beta

Firewall settings

Since svnserve connects 3690 TCP, it releases the port.

firewall-cmd -add-port=3690/tcp --zone=public -permanent
firewall-cmd --reload

Confirmation is done with the following command.

firewall-cmd --list-ports --zone=public

Disable SELinux

If SELinux is enabled, checkout can not be performed, so disable it. /etc/selinux/config

SELINUX=disabled

Reboot, run getenforce and make sure it shows Disabled.

Execute svnserve

Start svnserve.

service svnserve start
chkconfig svnserve on

Make sure svnserve is using port 3690.

netstat -tanp

Confirmation

Verify that svn://your.host.name/repo1 can be checked out from the SVN client.

Trouble shooting

If setup fails, investigate the items listed below and isolate the cause.

  • Whether ping to ip address passes (network setting)
  • 3690 Whether the port is opened (Firewall setting)
    • For Mac, nc -v -w 1 [IP address] -z 3690
    • For Win, use PowerShell Test-NetConnection -ComputerName [IP address] -Port 3690
  • Whether it can be checked out (repository, access right, setting of SELinux)
    • Whether the svn checkout svn://[IP address]/repo1 command can be executed
  • Whether additional files can be committed (repository user settings)