Install SVN service on CentOS7

Official reference

Official website Product Documentation

Perform installation

            yum -y install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql

Create a document library

After the installation is complete, we need to create a document library, please refer to the following command to create it.

            mkdir -p /opt/svn/repositories
svnadmin create /opt/svn/repositories

Add account

After creating the document library, we also need to create an account for logging in to the document library. Use vi or vim to edit /opt/svn/repositories/conf/passwd, add accounts in the file, and one line represents one account. Refer to the following for details.


Authorize the account's directory operation

Although we have created accounts, they do not have any read and write permissions. We also need to authorize each account. Use vi or vim to edit /opt/svn/repositories/conf/authz and add the authorization information of the account in the file. The specific configuration can refer to the following example.


Modify the configuration file

Finally, we also need to modify the configuration file to specify the document directory and authorization method. Use vi or vim to edit /opt/svn/repositories/conf/svnserve.conf, find the content in the example below, and modify it according to the example.

            anon-access = none 
auth-access = write 
password-db = passwd
authz-db = authz
realm = /opt/svn/repositories

Start and verify service

After all configurations are completed, we can start the service. After starting the service, we use the SVN client to connect. If we can successfully connect and log in with the account we configured, it means that our SVN service has been set up.

            svnserve -d -r /opt/svn/repositories