ubuntu下搭建svn服务器以及设置SVN
2013-12-09 13:52
417 查看
=======================================================================================
OS :Ubuntu 12.04.3 LTS
kernel :3.2.0-29-generic
server IP: 172.16.147.13
svnserve :version 1.6.17 (r1128011)
svn client :TortoiseSVN version 1.7
=======================================================================================
可以用以下命令来查看svn的版本仓库路径以及服务是否开启。
注意:修改时行最前端不允许有空格
取消一下四行前面的# 取消注释
anon-access = read
auth-access = write
password-db = password
authz-db = authz
并将anon-access = read的read改为none,禁止匿名用户访问。
出现这个问题就是,没有执行创建仓库的操作
出现这种情况就是没有添加账号密码,或者没有启动server
二.添加固定提交模板
三.添加SVN邮件服务
邮件服务有多种,总结起来如下
基于mailer.py
基于svnnotify
基于sendmail
Sendmail 安装配置
安装
sendmail.cf的配置语法比较难懂,一般资料上都是采用m4宏处理程序来生成所需的sendmail.cf文件(使用m4编译工具一般不容易出错,还可避免某些带有安全漏洞的宏对服务器造成的破坏)。其配置文件位于/etc/mail/sendmail.cf,在创建的过程中还需要一个模板文件,Linux自带有一个模板文件,位于/etc/mail/sendmail.mc.故可以直接通过修改sendmail.mc模板来达到定制sendmail.cf文件的目的,而不必去死啃哪些难理解的配置命令。配置步骤为:
http://www.360doc.com/content/13/1118/16/7492958_330261151.shtml
安装的过程有提示要在
/etc/mail/sendmail.mc
/etc/mail/submit.mc
中添加
postfix: fatal: the postfix command is reserved for the superuser
start-stop-daemon: unable to stat /usr/sbin/sendmail-mta (No such file or directory)
/etc/init.d/sendmail: line 296: /usr/sbin/sendmail-msp: No such file or directory
./commit-email.pl /home/svnroot/DailyBuildScripts/ 1 joe.chan@tpv-tech.com --from joe.chan@tpv-tech.com
./commit-email.pl: SMTP Error: 5.7.4 Unrecognized authentication type
下载svnmail
解压安装
安装前确定将setup.py 中 #/usr/bin/env python2.3修改为#!/usr/bin/python2.7
提示
以下是commit-email.pl 的提示
需要安装 apt-get install libauthen-sasl-cyrus-perl libauthen-sasl-perl
./commit-email.pl /home/svnroot/DailyBuildScripts/ 1 joe.chan@tpv-tech.com --from joe.chan@tpv-tech.com
OS :Ubuntu 12.04.3 LTS
kernel :3.2.0-29-generic
server IP: 172.16.147.13
svnserve :version 1.6.17 (r1128011)
svn client :TortoiseSVN version 1.7
=======================================================================================
一. 安装subversion配置
1.安装
#apt-get install subversion
2.添加svn管理用户及subversion组
# adduser svnuser
# addgroup subversion
# addgroup svnuser subversion
# addgroup joe subversion #把自己的账号也加入
3.创建项目testpj目录
#mkdir /home/svnroot && cd /home/svnroot
#mkdir testpj
#chown -R root:subversion testpj
# chmod -R g+rws testpj
4.创建SVN文件仓库
# svnadmin create /home/svnroot/testpj操作这一步注意要确定testpj为空目录,执行完后生成以下文件
ps -aux |grep svn
5.修改仓库访问权限
#chmod 700 /home/svnroot/testpj
6.配置仓库的访问权限
建好仓库可以通过修改 /home/svnroot/testpj/conf目录下:svnserve.conf 、passwd 、authz三个文件,来配置代码仓库的访问权限。注意:修改时行最前端不允许有空格
6.1编辑svnserve.conf文件
# vim svnserve.conf
### This file controls the configuration of the svnserve daemon, if you ### use it to allow access to this repository. (If you only allow ### access through http: and/or file: URLs, then this file is ### irrelevant.) ### Visit http://subversion.tigris.org/ for more information. [general] ### These options control access to the repository for unauthenticated ### and authenticated users. Valid values are "write", "read", ### and "none". The sample settings below are the defaults. # anon-access = read read改为none # auth-access = write ### The password-db option controls the location of the password ### database file. Unless you specify a path starting with a /, ### the file's location is relative to the directory containing ### this configuration file. ### If SASL is enabled (see below), this file will NOT be used. ### Uncomment the line below to use the default password file. # password-db = passwd ### The authz-db option controls the location of the authorization ### rules for path-based access control. Unless you specify a path ### starting with a /, the file's location is relative to the the ### directory containing this file. If you don't specify an ### authz-db, no path-based access control is done. ### Uncomment the line below to use the default authorization file. # authz-db = authz ### This option specifies the authentication realm of the repository. ### If two repositories have the same authentication realm, they should ### have the same password database, and vice versa. The default realm ### is repository's uuid. # realm = My First Repository [sasl] ### This option specifies whether you want to use the Cyrus SASL ### library for authentication. Default is false. ### This section will be ignored if svnserve is not built with Cyrus ### SASL support; to check, run 'svnserve --version' and look for a line ### reading 'Cyrus SASL authentication is available.' # use-sasl = true ### These options specify the desired strength of the security layer ### that you want SASL to provide. 0 means no encryption, 1 means ### integrity-checking only, values larger than 1 are correlated ### to the effective key length for encryption (e.g. 128 means 128-bit ### encryption). The values below are the defaults. # min-encryption = 0 # max-encryption = 256
取消一下四行前面的# 取消注释
anon-access = read
auth-access = write
password-db = password
authz-db = authz
并将anon-access = read的read改为none,禁止匿名用户访问。
password-db = password
authz-db = authz
6.2添加账号编辑/home/svnroot/testpj/conf/authz如下
[groups]
admin = joe.chan
[/]
@admin=rw
*=r
6.3 设置账号密码/home/svnroot/testpj/conf/passwd 如下:
[users] joe.chan = joe.chan
在windows下可以试着访问看看。如图
出现这个问题就是,没有执行创建仓库的操作
# svnadmin create /home/svnroot/testpj
出现这种情况就是没有添加账号密码,或者没有启动server
二.添加固定提交模板
三.添加SVN邮件服务
邮件服务有多种,总结起来如下
基于mailer.py
基于svnnotify
基于sendmail
Sendmail 安装配置
安装
apt-get install sendmail apt-get install sendmail-cf配置sendmailc参考
sendmail.cf的配置语法比较难懂,一般资料上都是采用m4宏处理程序来生成所需的sendmail.cf文件(使用m4编译工具一般不容易出错,还可避免某些带有安全漏洞的宏对服务器造成的破坏)。其配置文件位于/etc/mail/sendmail.cf,在创建的过程中还需要一个模板文件,Linux自带有一个模板文件,位于/etc/mail/sendmail.mc.故可以直接通过修改sendmail.mc模板来达到定制sendmail.cf文件的目的,而不必去死啃哪些难理解的配置命令。配置步骤为:
http://www.360doc.com/content/13/1118/16/7492958_330261151.shtml
安装的过程有提示要在
/etc/mail/sendmail.mc
/etc/mail/submit.mc
中添加
postfix: fatal: the postfix command is reserved for the superuser
start-stop-daemon: unable to stat /usr/sbin/sendmail-mta (No such file or directory)
/etc/init.d/sendmail: line 296: /usr/sbin/sendmail-msp: No such file or directory
./commit-email.pl /home/svnroot/DailyBuildScripts/ 1 joe.chan@tpv-tech.com --from joe.chan@tpv-tech.com
./commit-email.pl: SMTP Error: 5.7.4 Unrecognized authentication type
下载svnmail
解压安装
tar -xvf svnmailer-1.0.9.tar.gz cd svnmailer-1.0.9 python setup.py install
安装前确定将setup.py 中 #/usr/bin/env python2.3修改为#!/usr/bin/python2.7
提示
SyntaxError: Non-ASCII character '\xc3' in file setup.py on line 36, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details保存为utf-8的格式,运行
running install running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/cli.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/differ.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/typedstruct.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/settings.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/browser.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/stream.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/subversion.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/main.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/util.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/config.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/struct_accessors.py -> build/lib.linux-x86_64-2.7/svnmailer copying src/lib/svnmailer/__init__.py -> build/lib.linux-x86_64-2.7/svnmailer creating build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/_textmail.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/stdout.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/news.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/_mail.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/_multimail.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/_base.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/_textnews.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/_text.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/cia_xmlrpc.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/mail.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/selector.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier copying src/lib/svnmailer/notifier/__init__.py -> build/lib.linux-x86_64-2.7/svnmailer/notifier running build_scripts creating build/scripts-2.7 copying and adjusting src/svn-mailer -> build/scripts-2.7 changing mode of build/scripts-2.7/svn-mailer from 644 to 755 running install_lib creating /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/cli.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/differ.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/typedstruct.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/settings.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/browser.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/stream.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/subversion.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/main.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/util.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/config.py -> /usr/local/lib/python2.7/dist-packages/svnmailer copying build/lib.linux-x86_64-2.7/svnmailer/struct_accessors.py -> /usr/local/lib/python2.7/dist-packages/svnmailer creating /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/_textmail.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/stdout.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/news.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/_mail.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/_multimail.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/_base.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/_textnews.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/_text.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/cia_xmlrpc.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/mail.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/selector.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/notifier/__init__.py -> /usr/local/lib/python2.7/dist-packages/svnmailer/notifier copying build/lib.linux-x86_64-2.7/svnmailer/__init__.py -> /usr/local/lib/python2.7/dist-packages/svnmailer byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/cli.py to cli.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/differ.py to differ.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/typedstruct.py to typedstruct.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/settings.py to settings.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/browser.py to browser.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/stream.py to stream.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/subversion.py to subversion.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/main.py to main.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/util.py to util.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/config.py to config.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/struct_accessors.py to struct_accessors.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/_textmail.py to _textmail.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/stdout.py to stdout.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/news.py to news.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/_mail.py to _mail.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/_multimail.py to _multimail.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/_base.py to _base.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/_textnews.py to _textnews.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/_text.py to _text.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/cia_xmlrpc.py to cia_xmlrpc.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/mail.py to mail.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/selector.py to selector.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/notifier/__init__.py to __init__.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/svnmailer/__init__.py to __init__.pyc running install_scripts copying build/scripts-2.7/svn-mailer -> /usr/local/bin changing mode of /usr/local/bin/svn-mailer to 755 running install_data creating /usr/local/man/man1 copying docs/svn-mailer.1 -> /usr/local/man/man1 running install_egg_info Writing /usr/local/lib/python2.7/dist-packages/svnmailer-1.0.9.egg-info安装完成运行svn-mailer --version
#svn-mailer --version svnmailer-1.0.9 with svn 1.6.17 (r1128011)
以下是commit-email.pl 的提示
# ==================================================================== # This script is deprecated. The Subversion developers recommend # using mailer.py for post-commit and post-revprop change # notifications. If you wish to improve or add features to a # post-commit notification script, please do that work on mailer.py. # See http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/mailer . # ====================================================================
root@xmdt4002954:/home/share/temp# ./commit-email.pl /home/svnroot/testpj/ 1 joechen@gmail.com --from joechan@gmail.com No SASL mechanism found at /usr/share/perl5/Authen/SASL.pm line 77 at /usr/share/perl/5.14/Net/SMTP.pm line 143
需要安装 apt-get install libauthen-sasl-cyrus-perl libauthen-sasl-perl
./commit-email.pl /home/svnroot/DailyBuildScripts/ 1 joe.chan@tpv-tech.com --from joe.chan@tpv-tech.com
相关文章推荐
- Ubuntu下静态IP设置、Samba服务器的搭建以及SSH服务搭建
- Ubuntu 搭建svn服务器 ,以及常见错误解决方案
- Ubuntu 14.04 下搭建SVN服务器以及基本使用
- ubuntu 下搭建svn服务器,以及自动更新到web服务器。
- 阿里云Ubuntu系统搭建SVN服务器
- Ubuntu 14.04快速搭建SVN服务器及日常使用
- ubuntu下svn服务器搭建
- ubuntu 12.04搭建tftp服务器的安装、设置、调试
- Ubuntu上搭建SVN服务器全攻略
- linux下svn服务器搭建以及相关问题解决方案
- Linux 学习 - Apache + SVN 搭建服务器(Ubuntu 14.04)
- Ubuntu 14.04下搭建SVN服务器(SVN Server)
- Ubuntu14.04 Redmine搭建、SVN配置、以及对接
- Ubuntu 12.04 64位上搭建svn服务器
- ubuntu下手把手教你搭建SVN服务器
- Ubuntu搭建svn服务器(Subversion+Apache配置)
- Window下SVN服务器搭建以及客户端使用
- VMware Workstation 12 Pro Ubuntu操作系统vmware怎么安装windows7,Ubuntu下 SVN 服务器搭建及使用快速构建SVN局域网服务器
- CentOS下的SVN服务器搭建过程以及分析
- Ubuntu 上搭建SVN 服务器