Centos7 install subversion


1. Install subversion

yum -y install subversion


2. View installation location

rpm -ql subversion


3. Build version Library


(1) Create the version library root directory

mkdir /var/svnrepos


(2) Build version Library

svnadmin create /var/svnrepos/lishuyang.com


svnadmin create /var/svnrepos/lishuyang.net


(3) Configure version Library

Select a conf folder in the version library, copy the authz and passwd files to / var / svnrepos /, and modify the authz file, as shown in the figure below

, modify the passwd file, as shown in the following figure , and then configure the svnserve.conf File, configuration as follows:

Anon access = none ා indicates that anonymous users are not allowed to access. The optional values are none, read and write

Auth access = write ා indicates that the authorized user has read and write permissions

Password DB = / var / svnrepos / passwd ා specifies the user name password file, i.e. passwd file, which can be configured with an absolute path

Authz DB = / var / svnrepos / authz ා specifies the permission configuration file, that is, the authz file, which can be configured with an absolute path

realm = /var/svnrepos/ lishuyang.com# The authentication domain of the SVN project will be displayed in the authentication prompt. This value is different for each version library lishuyang.net In the version Library svnserve.conf The configuration is similar.

PS: there must be no space in the head of each line of the configuration item, and no space is allowed in the path

(4) Configure firewall

Add the following rule to the VI / etc / sysconfig / iptables file

-A INPUT -p tcp -m state –state NEW -m tcp –dport 3690 -j ACCEPT

service iptables restart

systemctl restart iptables

(5) Restart subversion

svnserve -d -r /var/svnrepos

(6) Test for successful installation

Executing SVN CO in centos7 svn://ip Address: 3690 / version library name (similar to here lishuyang.com )Enter, and enter the account and password configured in / var / svnrepos / passwd

4. Configure the hook to synchronize the code to the development directory

Select any version library and copy / var / svnrepos/ lishuyang.com/hooks/post – commit.tmpl For post commit, add it at the end of post commit


export LANG=en_US.utf8

SVN_ Path = / usr / bin / SVN / / don’t change it here

WEB_ PATH=/home/www/ lishuyang.com //Web directory, if you are different, you can change it

$SVN_ PATH update $WEB_ Path — username ‘lsy’ — password ‘lsyrepo’ — no auth cache / / any user here is fine


Then change the owner and group of post commit to the owner and group of web directory

chown root:root post-commit

Add execution permission to post commit

chmod 755 post-commit


Create project directory in Web Directory

mkdir /home/www/lishuyang.com


Next, restart svnserve

svnserve -d -r /var/svnrepos/

Test whether the code is synchronized. After submitting the code, it needs to be checked out manually. This is the first time that it needs to be checked out manually, and it can be synchronized automatically in the future

Svn co SVN: / / local IP/ lishuyang.com /home/www/ lishuyang.com


PS: Reference https://www.cnblogs.com/-mrl/p/8980244.html