1. Updating the system
First make sure the system package is up to date:
sudo yum update -y
2. Installing Apache and Subversion
2.1 Installing Apache HTTP Server and Subversion
sudo yum install -y httpd subversion mod_dav_svn
2.2 Starting and Setting Up Apache Self-Startup
sudo systemctl start httpd
sudo systemctl enable httpd
3. Create SVN repository
3.1 Creating the parent directory of a repository
sudo mkdir -p /var/svn
3.2 Creation of warehouses
sudo svnadmin create /var/svn/myrepo
3.3 Setting file permissions
sudo chown -R apache:apache /var/svn/myrepo
sudo chmod -R 755 /var/svn/myrepo
4. Configure Apache to support SVN.
4.1 Editing the Apache Configuration File
exist/etc/httpd//
directory to create or edit Documentation:
sudo vi /etc/httpd//
Add the following:
# Load the Subversion module
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/svn-auth-users
Require valid-user
</Location>
4.2 Creating user authentication files
sudo htpasswd -cm /etc/svn-auth-users user1
4.3 Configuring the Firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
4.4 Restarting the Apache Service
sudo systemctl restart httpd
5. Testing the SVN server
5.1 Testing via Web Browser
interviewshttp://<your-server-ip>/svn/myrepo
。
5.2 Testing with the SVN Client
svn checkout http://<your-server-ip>/svn/myrepo
6. Configure SVN access control
Edit the repository'sauthz
Documentation:
sudo vi /var/svn/myrepo/conf/authz
Sample Content:
[groups]
developers = user1, user2
[/]
* = r
@developers = rw
7. Logging and troubleshooting
7.1 Checking Apache Logs
sudo tail -f /var/log/httpd/error_log
7.2 Checking SVN repository logs
sudo tail -f /var/svn/myrepo/logs/
8. Advanced configuration (optional)
8.1 Configuring SSL (Enabling HTTPS)
exist Change the following in the
<Location /svn>
DAV svn
SVNParentPath /var/svn
SSLRequireSSL
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/svn-auth-users
Require valid-user
</Location>
8.2 Using Hooks
SVN supports hook scripts that can be added to the repository'shooks
Find the relevant template in the folder.
8.3 Backup and Restore SVN Repositories
Backup:
svnadmin dump /var/svn/myrepo > /backup/
Recovery:
svnadmin load /var/svn/myrepo < /backup/