Lanyiyun: svn installation under centos7, svn auth permission control, svn backup tutorial

The tutorials for installing SVN, configuring SVN permission control and backing up SVN data under CentOS 7 are as follows:

SVN installation:

  1. Update system:
sudo yum update
  1. Install SVN:
sudo yum install subversion
  1. Verify installation:
svn --version

SVN permission control:

  1. Create an SVN repository:
sudo mkdir /svn
sudo svnadmin create /svn/myrepo
  1. Set SVN warehouse permissions:
sudo chown -R apache.apache /svn/myrepo
sudo chmod -R 755 /svn/myrepo
  1. Configure Apache permissions:
    Edit the Apache configuration file  /etc/httpd/conf.d/subversion.confand 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>
  1. 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  -cthe parameter.

  1. 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:

  1. Install SVN backup tool:
sudo yum install rsync
  1. Create a backup script:
    Create a  svn_backup.shscript 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
  1. Set up regular backup:
    Use  crontab -ethe 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.

Guess you like

Origin blog.csdn.net/tiansyun/article/details/133324006
svn