Forums
Configuration Script for Apache Subverion - Server Installation - Printable Version

+- Forums (https://hackonology.com/forum)
+-- Forum: Technology & Configuration (https://hackonology.com/forum/forumdisplay.php?fid=3)
+--- Forum: Configuration Scripts (https://hackonology.com/forum/forumdisplay.php?fid=6)
+--- Thread: Configuration Script for Apache Subverion - Server Installation (/showthread.php?tid=100)



Configuration Script for Apache Subverion - Server Installation - SysAdmin - 09-28-2020

####################################### Installation ##############################################

## Package Installation
sudo yum update -y
sudo yum install subversion
sudo svn --version
sudo yum install mod_dav_svn subversion

## Configuration File
sudo vim /etc/httpd/conf.modules.d/10-subversion.conf
:'
## Example of the File
LoadModule dav_svn_module    modules/mod_dav_svn.so
LoadModule authz_svn_module  modules/mod_authz_svn.so
LoadModule dontdothat_module  modules/mod_dontdothat.so

<VirtualHost *:9000>
        ServerName localhost.xomic.co.in
        SSLEngine ON
        SSLCertificateFile /etc/httpd/ssl/localhost.xomic.co.in.pem
        SSLCertificateKeyFile /etc/httpd/ssl/localhost.xomic.co.in.key

        <Location /svn>
                DAV svn
                SVNParentPath /opt/svn
                AuthType Basic
                AuthName "Cartoon SVN Repository"
                AuthUserFile /etc/svn/svn-auth-users
                AuthzSVNAccessFile /etc/svn/svn-access-control
                Require valid-user
        </Location>
</VirtualHost>
'

## Creating Repo with Directory (project)
sudo mkdir /opt/svn
sudo cd /opt/svn/
sudo svnadmin create project
sudo ls -l project
sudo chmod -R apache:apache project/
sudo chown -R apache:apache project/

## Creating SVN Users
sudo mkdir /etc/svn
sudo htpasswd -cm /etc/svn/svn-users tom
sudo htpasswd -cm /etc/svn/svn-users jerry
sudo htpasswd -cm /etc/svn/svn-users senior
sudo chown root:apache /etc/svn/svn-auth
sudo chmod 640 /etc/svn/svn-auth

## Selinux
sudo sestatus
sudo chcon -R -t httpd_sys_content_t /opt/svn/project/
sudo chcon -R -t httpd_sys_rw_content_t /opt/svn/project/

## Service start
sudo systemctl restart httpd.service
sudo systemctl status httpd.service

#####################
:'
## Example and Scenario
vim /etc/svn/svn-access-control

Assume that
    User "senior" is the administrator.
    User "tom" is a qualified user who owns read and write permissions to the SVN repo "repo1".
    User "jerry" is a trainee who can only read the contents of SVN repo "repo1".

Then you can modify the settings within as below:

[groups]
admin=senior
project_user=tom
project_trainee=jerry

[/]
@admin=rw

[project:/]
@project_user=rw
@project_trainee=r
jerry=rw ## for a single user
'
#####################

## Start Services
sudo systemctl start httpd.service
sudo systemctl enable httpd.service

## Allow from Firewall
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

## Access your Project
http://<your-server-ip>/svn/project/