1. Install subversion
yum install subversion mod_dav_svn


2. Create the directory for the subversion repository
mkdir /var/svn-repo


3. Create the subversion repository
cd /var/svn-repo
svnadmin create .
chown -R apache.apache .


4. Create DNS entry in your domain zone file (e.g. svn.atbnet.local)
svn IN A 10.50.1.50


5. Create virtual host in apache for subversion (best using port 443 and SSL)
<virtualhost *:443>
    DocumentRoot /var/svn-repo
    ServerName svn.atbnet.local
    ErrorLog /var/log/httpd/svn-error_log
    CustomLog /var/log/httpd/svn-access_log combined
    <location />
        DAV svn
        SVNPath /var/svn-repo
        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile /etc/svn-auth
        Require valid-user
    </location>
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
</virtualhost>


6. Create svn userfile
htpasswd -c /etc/svn-auth-file andy
/usr/sbin/apachectl -t
/etc/init.d/httpd restart

 

7. Set SVN_EDITOR environment variable for commit messages
export SVN_EDITOR=vim
echo "SVN_EDITOR=vim" >> /etc/profile


8. Create basic subversion structure
svn mkdir https://svn.atbnet.local/trunk
svn mkdir https://svn.atbnet.local/branches


9. Start using subversion

Examples:

svn import project1/ https://svn.atbnet.local/trunk/project1

svn copy https://svn.atbnet.local/trunk/project1 https://svn.atbnet.local/branches/project1_andy

svn co https://svn.atbnet.local/branches/project1_andy

svn add index.php

svn commit index.php

 

Share this blog post on social media:

Social Links

Disclaimer

All advice, installation/configuration how to guides, troubleshooting and other information on this website are provided as-is with no warranty or guarantee. Whilst the information provided is correct to the best of my knowledge, I am not reponsible for any issues that may arise using this information, and you do so at your own risk. As always before performing anything; check, double check, test and always ensure you have a backup.

Copyright ©2008-2021 Andy Barnes - Please do not copy any content including images without prior consent!

Designed and Hosted by Andy Barnes