The tutorials for installing SVN, configuring SVN permission control and backing up SVN data under CentOS 7 are as follows:
SVN installation:
- Update system:
sudo yum update
- Install SVN:
sudo yum install subversion
- Verify installation:
svn --version
SVN permission control:
- Create an SVN repository:
sudo mkdir /svn
sudo svnadmin create /svn/myrepo
- Set SVN warehouse permissions:
sudo chown -R apache.apache /svn/myrepo
sudo chmod -R 755 /svn/myrepo
- Configure Apache permissions:
Edit the Apache configuration file/etc/httpd/conf.d/subversion.conf
and add the following content:
<Location /svn>
DAV svn
SVNPath /svn/myrepo
AuthType Basic
AuthName "Subversion Repo"
AuthUserFile /etc/svn-auth-users
Require valid-user
</Location>
- Create SVN user and password files:
sudo htpasswd -c /etc/svn-auth-users username
Note: If you need to set passwords for multiple users, you can omit -c
the parameter.
- Restart the Apache service:
sudo systemctl restart httpd
You can now access the SVN repository via http://your_server_ip/svn/myrepo and authenticate using the username and password created in the previous step.
SVN backup:
- Install SVN backup tool:
sudo yum install rsync
- Create a backup script:
Create asvn_backup.sh
script file named and add the following content:
#!/bin/bash
# 设置备份目录和日期
backup_dir="/path/to/backup"
backup_date=$(date +%Y%m%d%H%M%S)
# 备份SVN仓库
sudo svnadmin hotcopy /svn/myrepo $backup_dir/myrepo_backup_$backup_date
- Set up regular backup:
Usecrontab -e
the command to edit the scheduled task and add the following line to execute the backup script every day:
0 0 * * * /bin/bash /path/to/svn_backup.sh
After completing the above steps, you have successfully installed SVN on CentOS 7, configured SVN permission control, and set up regular backup of SVN data. In this way, you can safely use SVN for version control and ensure the security of your data.