Svn (subversion) is a version management tool that has emerged in recent years and is the successor of cvs. Currently, most open-source software uses svn as the code version management software, and the continuous code building platform needs to pull code from svn. Therefore, this chapter mainly configures svn.I. svn environment installation:# Yum install subversion mysql-server httpd mod_dav_svn mod_perl sendmail wget gcc-c ++ make unzip perl * ntsysv vim-enhanced mod_ssl-yIi. Configure the svn Repository:1. create a directory to store all SVN files # mkdir/data/svn 2. create a version repository # svnadmin create/data/svn/project 3. it is easy to add SVN users. You only need to add an entry in the/data/svn/project/conf/passwd file, such as "username = password. For testing, I added the following content:
- [users]
- luowei = luowei
- zhangyp = zyp
4. Modify the User Access Policy # vim/data/svn/project/conf/authz records the user's access policy. The following is a reference:
- [groups]
- admin = luowei,zhangyp
- [/]
- @admin = rw
- * =
Note: The preceding information indicates that only the admin user group has the permission to read and write the root directory. R indicates that the directory has read permission, w indicates that the directory has write permission, and rw indicates that the directory has read and write permissions. * = In the last row indicates that no one except the user group with the preceding permissions is allowed to access this directory. This is very important and must be added! 5. Modify the svnserve. conf file to improve the efficiency of user and policy configuration. # The content of vim/data/svn/project/conf/svnserve. conf is as follows:
- [general]
- anon-access = none
- auth-access = write
- password-db = /data/svn/project/conf/passwd
- authz-db = /data/svn/project/conf/authz
6. start the server # svnserve-d-r/data/svn Note: If the svn configuration is modified, restart the svn Service as follows: # ps-aux | grep svnserve # kill-9 ID # svnserve-d-r/data/svn
3. Configure http support for the svn Server1. The svn conversion password is in plain text and is not supported by the HTTP server. Therefore, the format supported by HTTP must be converted. The following is a step-by-step conversion using perl:
- #!/usr/bin/perl
- #
- use warnings;
- use strict;
- #open the svn passwd file
- open (FILE, "passwd") or die ("Cannot open the passwd file!!!n");
- #clear the apache passwd file
- open (OUT_FILE, ">webpasswd") or die ("Cannot open the webpasswd file!!!n");
- close (OUT_FILE);
- #begin
- foreach (<FILE>) {
- if($_ =~ m/^[^#].*=/)
- { $_ =~ s/=//;
- `htpasswd -b webpasswd $_`;
- }
- }
Run the command. 2. Modify the apache configuration file and add svn-supported content: # vim/etc/httpd/conf/httpd. conf Add the following content:
- <Location/project>
- DAV svn
- SVNPath/data/svn/project/
- AuthType Basic
- AuthName "svn for project"
- AuthUserFile/data/svn/project/conf/webpasswd
- AuthzSVNAccessFile/data/svn/project/conf/authz
- Satisfy all
- Require valid-user
- </Location>
# Chown-R apache. apache/data/svn/project/restart apache service: # service httpd restart
3. Add ssl authentication: Survival key file
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/030224L41-0.png "border =" 0 "alt =" "/>
Modify the apache configuration file: # vim/etc/httpd/conf. d/ssl. conf // modify the following two items:
- SSLCertificateFile /etc/httpd/conf/httpd.pem
- SSLCertificateKeyFile /etc/httpd/conf/httpd.key
As shown in:
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0302244X7-1.png "border =" 0 "alt =" "/>
Modify the apache main configuration file:
- <Directory/>
- Options FollowSymLinks
- AllowOverride None
- SSLRequireSSL // Add this line
- </Directory>
Restart apache to complete the configuration, and then implement advanced svn configuration.
4. Configure email reminder support1. Install the Perl Module: Build
- # tar xvf Module-Build-0.36_11.tar.gz
- # cd Module-Build-0.36_11
- # perl Build.PL
- # ./Build
- # ./Build test
- # ./Build install
- # cd ..
2. Install the Perl module Authen: SASL
- # tar xvf Authen-SASL-2.15.tar.gz
- # cd Authen-SASL-2.15
- # perl Makefile.PL
- # make test
- # make install
- # cd ..
3. Install the Perl module. Net: SMTP_auth
- # tar xvf Net-SMTP_auth-0.08.tar.gz
- # cd Net-SMTP_auth-0.08
- # perl Makefile.PL
- # make test
- # make install
- # cd ..
4. Install the Perl module SVN: Running y
- # tar xvf SVN-Notify-2.80.tar.gz
- # cd SVN-Notify-2.80
- # perl Build.PL
- # ./Build
- # ./Build test
- # ./Build install
- # cd ..
5. start the mail server # service sendmail restartShutting down sendmail: [FAILED] Starting sendmail: [OK] Starting sm-client: [OK] 6. configure the automatic mail script to modify the post-commit script to support the mail Notification function. # cd/data/svn/project/hooks/# vim post-commit content is as follows:
- #! /Bin/sh
- REPOS = "$1"
- REV = "$2"
-
- Cat>/tmp/userlist <EOF
- Luoweiro@126.com
- Wei.luo@baisonmail.com
- EOF // Add email notification list
-
- IFS = $ '\ N'
- For LINE in 'cat/tmp/userlist'; do
- /Usr/bin/svnnotify -- repos-path "$1" -- revision "$2" -- to $ LINE -- from 282127408@qq.com -- handler "HTML :: colorDiff "-- with-diff -- smtp localhost -- smtp-user root -- smtp-pass 5201314318-c" UTF-8 "-g zh_CN-O raw -- svnlook/usr/bin/svnlook -- subject -prefix '[svn update]'
- Done
Test submitted update received email:
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0302241Y4-2.png "border =" 0 "alt =" "/>
5. Use svnstat to analyze SVN data:1. svnstat is a JAVA application. You must first install the JAVA environment. Download jre, URL: http://javadl.sun.com/webapps/download/AutoDL? BundleId = 39484 installation:
- # rpm -ivh jre-6u20-linux-i586.rpm
2. Download and decompress svnstat
- # wget http://downloads.sourceforge.net/project/svnstat/svnstat/Release-1.0/SvnStat-1.0.zip?use_mirror=jaist
- # unzip SvnStat-1.0.zip
3. Update the Code # pwd/root # svn co svn: // 192.168.158.216/projectAuthentication realm: <svn: // 192.168.158.216: 3690> a445a473-9def-448a-9560-b008c929378fPassword for 'baison ': ----------------------------------------------------------------------- ATTENTION! Your password for authentication realm: <svn: // 192.168.158.216: 3690> a445a473-9def-448a-9560-b008c929378f can only be stored to disk unencrypted! You are advised to configureyour system so that Subversion can store passwords encrypted, ifpossible. see the documentation for details. you can avoid future appearances of this warning by setting the valueof the 'store-plaintext-password' option to either 'yes' or 'no' in '/root /. subversion/servers '. ----------------------------------------------------------------------- Store password unencrypted (Yes/no )? Yes 4. Generate svnstat data
- # svn log project -v --xml --non-interactive > project.log
- # cd SvnStat-1.0
- # java -classpath SvnStat-all.jar de.agentlab.svnstat.SvnStat -jar SvnStat-all.jar -r /root/project.log -d /var/www/html/
5. log on to the browser and you will see many statistical charts. See figure: https: // 192.168.158.216
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/030224E23-3.png "border =" 0 "alt =" "/>
6. Use statsvn to analyze SVN data1. Download and decompress statsvn
- # unzip statsvn-0.7.0.zip
- # cd statsvn-0.7.0
2. Generate statsvn data
- # mkdir /var/www/html/statsvn
- # java -jar statsvn.jar -verbose -output-dir /var/www/html/statsvn/ /root/project.log /root/project
3. Use a browser to test the effect, for example, https: // 192.168.158.216/statsvn.
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0302241492-4.png "border =" 0 "alt =" "/>
This configuration is complete!
This article is from the "Ro blog" blog, please be sure to keep this source http://luoweiro.blog.51cto.com/2186161/1095193