Real-time release of svn + rsync programs in CentOS

Source: Internet
Author: User

======================================= WEB Server (RSYNC) ======================================Step 1: Installrsyncyum -y installrsyncStep 2: Configure# This file is not available by default.#vim /etc/rsyncd.confuid=rootgid=rootuse chroot=nomax connections=200timeout=600pid file=/var/run/rsyncd.pidlock file=/var/run/rsync.locklog file=/var/log/rsyncd.log[a.test.cn]path=/data/web/a.test.cn/#exclude=conf/*.phpcomment = this ia a.test.cnignore errorsreadonly=falselist=falsehosts allow=172.31.0.12hosts deny=*auth users=testsecrets file=/shell/rsync-passwd/rsync.passwdNote: When use chroot = no, if the file master or group of DES after synchronization has one, the display name, even if the ID is different;use chroot=yesIf the two machines have different IDs with the same name, the server only displays the src id, causing permission problems.EditrsyncUser Authentication configuration file# cat /shell/rsync-passwd/rsync.passwdtest:test123#chmod 600 /shell/rsync-passwd/rsync.passwdStep 3: StartrsyncService/usr/bin/rsync--daemonecho"/usr/bin/rsync --daemon">>/etc/rc.localStep 4: test the client (on 172.31.0.12)# cat /shell/rsync-passwd/rsync.passwdtest:test123#chmod 600 /shell/rsync-passwd/rsync.passwdrsync-vzrtopgl --progress --delete --exclude=.svn /data/web/a.test.cn/test@172.31.0.15::a.test.cn --password-file=/shell/rsync-passwd/rsync.passwdOrRSYNC_PASSWORD=test123 rsync-vzrtopgl --progress --delete --exclude=.svn/data/web/a.test.cn/ test@172.31.0.15::a.test.cn(Complete)Note: you do not need to restart the service to modify the configuration file and user password.========================== SVN server ============ ==============================Step 1: Install subversiontarzxvf subversion-1.7.4.tar.gzcdsubversion-1.7.4# Download apr and run buildconf to generate the required filesvn co http://svn.apache.org/repos/asf/apr/apr/branches/1.3.x apr./apr/buildconf# Download apr-util and run buildconf to generate the required filesvn co http://svn.apache.org/repos/asf/apr/apr-util/branches/1.3.x apr-util./apr-util/buildconf# Download sqlite3.c, decompress it, and put it in the source code directory of the subversion unzip. only ensure that sqlite3.c is available.# ll sqlite-amalgamation/total 5004-rw-r--r-- 1 root root 5121966 Dec 17 11:34 sqlite3.c./configure--prefix=/usr/local/svnmake&& makeinstallStep 2: Create the svn database and Configure permissions1. Create a databasemkdir/data/svndata/usr/local/svn/bin/svnadmincreate /data/svndata/a.test.cn/usr/local/svn/bin/svnadmincreate /data/svndata/b.test.cn/usr/local/svn/bin/svnadmincreate /data/svndata/c.test.cn2. Configure the password and permission Filemkdir/data/svnpasswd#cat /data/svnpasswd/passwd[users]aaa=aaapwdbbb=bbbpwdccc=cccpwdxxx=xxxpwdyyy=yyypwdzzz=zzzpwd#cat /data/svnpasswd/authz[groups]a.test.cn = aaab.test.cn = bbbc.test.cn = cccother = xxx,yyy,zzz[a.test.cn:/]@a.test.cn=r wxxx=r*=[b.test.cn:/]@b.test.cn=rwyyy=r*=[c.test.cn:/]@c.test.cn=rw@other=r*=3. configure all svn databases to use the above users and permissions to centrally manage permissions.Modify conf in all databases/svnserve. Conf:[general]anon-access = noneauth-access = writepassword-db = /data/svnpasswd/passwdauthz-db = /data/svnpasswd/authz# realm = My First Repository# force-username-case = none[sasl]# use-sasl = true# min-encryption = 0# max-encryption = 2564. Start the service/usr/local/svn/bin/svnserve-d --listen-port 4399 -r /data/svndataecho"/usr/local/svn/bin/svnserve -d --listen-port 4399 -r /data/svndata">>/etc/rc.local5. Configure the hook file (the first database is configured separately as needed). The post-commit script is triggered each time a commit is triggered. Make sure you have the execution permission.Copy the template file as post-commit.chmod700 post-commit[root@centos-6 ~]# cat /data/svndata/ a.test.cn/hooks/post-commit#!/bin/sh# The following variable is actually the absolute path of the svn library and is not used.#REPOS="$1"# The following variable is actually the version after each commit and is not used.#REV="$2"exportLANG=en_US.UTF-8/usr/local/svn/bin/svnupdate --username aaa --password "aaapwd"/data/web/a.test.cnif[ $? -eq0 ]thenchown-R root.dev /data/web/atest.cn/bin/bash/shell/rsync-script/a.test.cn.sh > /dev/null2>&1fi6. Configure the script triggered by the hook File[root@centos-6 ~]# cat /shell/rsync-script/a.test.cn.sh#/bin/bashIP="172.31.0.15"Auth_module="a.test.cn"Localdir="/data/web/a.test.cn/"Auth_user="test"Passwd_file="/shell/rsync-passwd/rsync.passwd"Exc=" --exclude=.svn"rsync-vzrtopgl --progress --delete ${Exc} ${Localdir} $Auth_user@${IP}::${Auth_module} --password-file=${Passwd_file}AccessrsyncPassword File. The permission must be 600, root. root[root@centos-6 ~]# cat /shell/rsync-passwd/rsync.passwdtest1237. TestThe client is in.testSubmit a file in the. cn database to check whether the file is synchronizedrsyncThe web directory defined by the server.(Complete)Note: you do not need to restart the service to add a database, modify permissions, and password.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.