FreeKB - How to install Subversion on Linux
How to install Subversion on Linux

Home > Search > How-to


Use apt-get or yum to install Subversion.

apt-get install subversion
yum install subversion

 

Subversion may not be able to start if the /var/svn directory does not exist. Create the /var/svn directory.

mkdir /var/svn

 

Start and enable Subversion.

systemctl enable svnserve
systemctl start svnserve

 

The svnserve command can then be used to view the version of Subversion that was installed.

svnserve --version

 


HTTP

It is very common to interact with Subversion over HTTP. To do this, use apt-get or yum to install HTTPD web server and the Subversion module.

apt-get install httpd mod_dav_svn
yum install httpd mod_dav_svn

 

Edit the /etc/httpd/conf.modules.d/10-subversion.conf file, and add the following markup.

Alias /svn /var/www/svn
<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn/
   AuthType Basic
   AuthName "Subversion repositories"
   AuthUserFile /etc/svn-auth-users
   Require valid-user
</Location>

 

Since /var/www/svn was set as the Subversion parent directory, create the /var/www/svn directory.

mkdir /var/www/svn

 

Create a repository. In this example, the repository is named "repo" and apache is the owner of "repo".

cd /var/www/svn/
svnadmin create repo
chown -R apache.apache repo/

 

Create a user that will be allowed access.

htpasswd -cm /etc/svn-auth-users john.doe

 

If SELinux is enabled, issue the following commands so that SELinux permits access to the repository.

chcon -R -t httpd_sys_content_t /var/www/svn/repo
chcon -R -t httpd_sys_rw_content_t /var/www/svn/repo

 

If firewalld is enabled, issue the following commands to allow HTTP and HTTPS in the firewall.

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

 

Start and enable the HTTPD web server.

systemctl enable httpd
systemctl restart httpd

 

You should now be able to view your empty repostiory at http://<hostname of your server>/svn/repo.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter fa5f8 in the box below so that we can be sure you are a human.




Comments