The following column Centos Getting Started Tutorial will introduce to you how to build SVN on centos and synchronize the project to the system root directory of the PHP project. I hope it will be helpful to friends in need. !
1. SVN installation
The yum installation method is used here:
1. rpm -qa subversion / /Check whether a lower version of SVN is installed
2. yum remove subversion //If the old version is stored, uninstall the old version of SVN
3. Start the installation yum -y install subversion
After installation, check the version svnserve --version
4. Create a version warehouse:
mkdir -p /data/svn/project svnadmin create /data/svn/project/
Check the /data/svn/project folder and you will find conf, db, format, hooks, locks, README.txt and other files, indicating that an SVN library has been established.
5. Configure permissions
cd /data/svn/project/conf/ //进入配置目录 vim svnserve.conf //编辑配置文件,加入下面五行内容 ``` [general] ### The anon-access and auth-access options control access to the`` ### repository for unauthenticated (a.k.a. anonymous) users and ### authenticated users, respectively. ### Valid values are "write", "read", and "none". ### Setting the value to "none" prohibits both reading and writing; ### "read" allows read-only access, and "write" allows complete ### read/write access to the repository. ### The sample settings below are the defaults and specify that anonymous ### users have read-only access to the repository, while authenticated ### users have read and write access to the repository. # anon-access = read # auth-access = write anon-access = none auth-access = write password-db = passwd authz-db = authz realm = /data/svn/project ```
6. Edit the password file and add user test password 123456:
vim passwd ### This file is an example password file for svnserve. ### Its format is similar to that of svnserve.conf. As shown in the ### example below it contains one section labelled [users]. ### The name and password for each user follow, one account per line. [users] # harry = harryssecret # sally = sallyssecret test = 123456
7. Edit the permissions file and add user test permissions
vim authz [groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe [/] test = rw
8. Configure the firewall
vi /etc/sysconfig/iptables
Join:
``` -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp -dport 3690 -j ACCEPT ```
Restart the firewall: service iptables restart
9. Start SVN: svnserve -d -r /data/svn/
Check the port status: netstat -ln | grep 3690
2. Add a hook to svn to synchronize the file to the PHP test environment (the PHP project directory here is / var/www/html/project/)
1. Enter the hooks directory under the repository
cd /data/svn/project/hooks/
2. Copy post-commit.tmpl to post-commit
cp post-commit.tmpl post-commit
3. Give post-commit executable permission
chmod 0777 post-commit
4. Edit post-commit, comment out the line #mailer.py..., and add the following four lines for coding issues, If there is an error, the synchronization may not be successful. The options are en_US.UTF-8, zh_CN.UTF-8, and zh_CN.GB2312. You can try them one by one.
vi post-commit #mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf export.GB2312 SVN=/usr/bin/svn STATIC_DIR=/var/www/html/project/ ${SVN} update ${STATIC_DIR} --username "test" --password "123456"
5. Before submitting, perform a checkout code to the specified directory
svn checkout svn://localhost/project /var/www/html/project/
Note: If errors continue: "Because the connecting party did not reply correctly after a period of time or the connected host did not respond. , the connection attempt failed"; it may be a problem with the network port opening settings. Because of the port problem, the checkout project cannot be successful. You can enter Alibaba Cloud to see if there is a port 3690 allowed. If there is no port 3690, add a security group rule.
For more centos technical articles, please visit the centos tutorial column!
The above is the detailed content of Detailed explanation of how to build SVN on centos and synchronize the project to the system root directory of the PHP project. For more information, please follow other related articles on the PHP Chinese website!