1、下载svnserver
新建svn文件夹,并把权限给svnuser组
2、安装 tar zxvf
依次输入./configure , make , make install 进行编译安装完成。
3、开启SVN服务:svnserve -d
检测服务是否开启:netstat -ntlp如果看到3690的端口正常开放了,证明SVN启动了
4、建立svn库svnadmin create /svn/repos
5、关闭svn服务 killall svnserve
6、启动 svnserve -d -r/usr/local/svn/svnresp
-d表示以daemon方式(后台运行)运行
-r /svndata指定根目录是/svndata
使用svn+ssh连接svn配置,并强制使用ssh登陆,公司现有方式
1、还原conf/svnserve.conf,即注释掉其中的所有内容
2、从subversion-1.7.17/tools/hook-scripts下复制commit-access-control.cfg.example commit-access-control.tmpl到hook下,并重命名为commit-access-control.cfg、commit-access-control.pl,并赋予commit-access-control.pl执行权限
3、修改pre-commit,commit-access-control.pl前面必须为绝对路径,为:
REPOS="$1"
TXN="$2"
quit() {
echo " 1. You MUST leave acomment here! (by [email protected])">&2
echo " 2. Leaving areference to bug id is appreciated! (by [email protected])">&2
exit 1
}
# Make sure that the log message containssome text.
SVNLOOK=/usr/local/bin/svnlook
$SVNLOOK log -t "$TXN""$REPOS" | \
grep "[a-zA-Z0-9]" > /dev/null || quit
# Check that the author of this commit hasthe rights to perform
# the commit on the files and directoriesbeing modified.
/usr/local/svn/svnresp/hooks/commit-access-control.pl"$REPOS" "$TXN"/usr/local/svn/svnresp/hooks/commit-access-control.cfg || exit 1
# All checks passed, so allow the commit.
exit 0
4、修改commit-access-control.cfg如下,注意match最后的空格
[Make project1 read-write for users Janeand Joe]
match = ^test/*
users = lisijia abs root sky
access = read-write
现在使用上面的用户用svn+ssh方式即可连接svn
强制增加注释
重命名hook下面post-commit.tmpl为post-commit,增加执行权限,并把post-commit改为如下内容
REPOS="$1"
TXN="$2"
quit() {
echo " 1. You MUST leave acomment here! (by [email protected])">&2
echo " 2. Leaving areference to bug id is appreciated! (by [email protected])">&2
exit 1
}
# Make sure that the log message containssome text.
SVNLOOK=/usr/local/bin/svnlook
$SVNLOOK log -t "$TXN""$REPOS" | \
grep "[a-zA-Z0-9]" > /dev/null || quit
exit 0
提示APRnot found的解决办法
#./configure --prefix……检查编辑环境时出现:
checking forAPR... no
configure: error: APR not found . Please read the documentation.
可以用./configure –help | grep apr 查看帮助。
--with-included-apr Use bundledcopies of APR/APR-Util
--with-apr=PATH prefix forinstalled APR or the full path to apr-config
--with-apr-util=PATH prefix forinstalled APU or the full path to
安装APR(Apache PortableRuntime )
[root@localhost ~]# cd /tmp/52lamp/ //源码存放位置
[root@localhost 52lamp]# tar -zxvf apr-1.4.2.tar.gz //unzip -o apr-1.4.2.zip
[root@localhost 52lamp]# cd apr-1.4.2
[root@localhost apr-1.4.2]# ./configure
[root@localhost apr-1.4.2]# make
[root@localhost apr-1.4.2]# make install
再次检查编译环境出现
checking for APR-util... no
configure: error: APR-util notfound . Please read the documentation.
[root@localhost httpd-2.2.16]# ./configure–help | grep apr-util
--with-apr-util=PATH prefix for installedAPU or the full path to
[root@localhost52lamp]# tar -zxvf apr-util-1.3.9.tar.gz
[root@localhost 52lamp]# cd apr-util-1.3.9
[root@localhost apr-util-1.3.9]# ./configure --prefix=/usr/local/apr-util--with-apr=/usr/local/apr
[root@localhost apr-util-1.3.9]# make
[root@localhost apr-util-1.3.9]# make install
./configure仍提示APR-util not found,增加--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util后出现
configure: error: pcre-config for libpcre not found. PCRE is required andavailable from http://pcre.org/
[root@localhost httpd-2.2.16]# ./configure–help | grep pcre
--with-pcre=PATH Use externalPCRE library
[root@localhost52lamp]# unzip -o pcre-8.10.zip
[root@localhost 52lamp]# cd pcre-8.10
[root@localhost cd pcre-8.10]# ./configure --prefix=/usr/local/pcre
[root@localhost cd pcre-8.10]# make
[root@localhost cd pcre-8.10]# make install
缺少gcc-c++和libtool,也就是c++编译包
libtool: compile: unrecognized option `-DHAVE_CONFIG_H'
libtool: compile: Try `libtool --help' for more information.
make[1]: *** [pcrecpp.lo] Error 1
make[1]: Leaving directory `/home/guangbo/work/pcre-8.12'
make: *** [all] Error 2
解决方法:需要先安装libtool和gcc-c++
继续安装Apache/httpd,./configure 时加上参数 --with-apr=/usr/local/apr/--with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre,这个问题就解决了。
Apache安装过程,Apr、apr-util、pcre下载详见本站其他页面。
运行commit-access-control.pl时报错
手工运行commit-access-control.pl时,
可能会报错:Can't locateConfig/IniFiles.pm in @INC ....../commit-access-control.pl line 40云云
这是因为你的perl缺少了一个模块Config::IniFiles,运行如下命令进行安装:
perl -MCPAN -e 'install Config::IniFiles'
如果这个报错、安装不上的话,可能是你没有配置好span,按照下面操作:
运行:
perl -MCPAN -eshell
一路回车。选择span镜像时需要输入有效的url,一个是默认的那个,另一个可以输入[/size][size=3][color=#0000ff]http://cpan.linuxforum.net[/color][/size][size=3]。
然后运行:
install Bundle::CPAN
再运行:
install Config::IniFiles
这时就安装好Config::IniFiles组件了。[/size]