达缇美食
您的当前位置:首页LinuxSVN服务器搭建

LinuxSVN服务器搭建

来源:达缇美食


系统大全为您提供
1.UbuntuPC一台,最好是最新的Ubuntu稳定版本
2.执行以下命令安装subversion:
sudoapt-getupdate
sudoapt-getinstallsubversion
3.假设代码svn仓库的根路径定为/home/svnroot,执行以下命令新建目录:
sudomkdir/home/svnroot
4.新建一个代码仓库,假设仓库名为:example
cd/home/svnroot
sudosvnadmincreateexample
此命令执行完成后会在/home/svnroot下多出来一个名为example的目录,这就是example代码仓库了。
5.编辑example仓库的访问权限
即:修改/home/svnroot/example/conf下的三个文件:authzpasswdsvnserve.conf
其中:
passwd中保存了用户名和密码
authz中保存了用户组定义及各目录的访问权限定义
svnserve.conf中保存了本代码仓库使用的配置(是否允许匿名用户?指定用户名和密码数据库...)
这里给出一个典型的配置:
passwd实例:
 
[users]
xiaoming=1111
xiaowang=2222
xiaoli=3333
laowang=4444
shuangshuang=5555
dashi=6666
 
authz实例(admin可以读写所有目录,dev能读写branch,dev只读trunk/tag):
[aliases]
#joe=/C=XZ/ST=Dessert/L=SnakeCity/O=SnakeOil,Ltd./OU=ResearchInstitute/CN=JoeAverage
[groups]
admin=xiaoli
dev=laowang,shuangshuang,dashi,xiaowang,xiaoming
[/]
@admin=rw
@dev=r
[/trunk]
@admin=rw
@dev=r
[/tag]
@admin=rw
@dev=r
[/branch]
@admin=rw
@dev=rw
svnserve.conf实例(关闭匿名访问,指定用户数据库和鉴权数据库):
###Thisfilecontrolstheconfigurationofthesvnservedaemon,ifyou
###useittoallowaccesstothisrepository.(Ifyouonlyallow
###accessthroughmentthelinebelowtousethedefaultpasswordfile.
password-db=passwd
###Theauthz-dboptioncontrolsthelocationoftheauthorization
###rulesforpath-basedaccesscontrol.Unlessyouspecifyapath
###startingwitha/,thefile'slocationisrelativetothethe
###directorycontainingthisfile.Ifyoudon'tspecifyan
###authz-db,nopath-basedaccesscontrolisdone.
###Uncommentthelinebelowtousethedefaultauthorizationfile.
authz-db=authz
###Thisoptionspecifiestheauthenticationrealmoftherepository.
###Iftworepositorieshavethesameauthenticationrealm,theyshould
###havethesamepassworddatabase,andviceversa.Thedefaultrealm
###isrepository'suuid.
#realm=MyFirstRepository
[sasl]
###ThisoptionspecifieswhetheryouwanttousetheCyrusSASL
###libraryforauthentication.Defaultisfalse.
###ThissectionwillbeignoredifsvnserveisnotbuiltwithCyrus
###SASLsupport;tocheck,run'svnserve--version'andlookforaline
###reading'CyrusSASLauthenticationisavailable.'
#use-sasl=true
###Theseoptionsspecifythedesiredstrengthofthesecuritylayer
###thatyouwantSASLtoprovide.0meansnoencryption,1means
###integrity-checkingonly,valueslargerthan1arecorrelated
###totheeffectivekeylengthforencryption(e.g.128means128-bit
###encryption).Thevaluesbelowarethedefaults.
#min-encryption=0
#max-encryption=256
6.添加svn服务为系统自启动项目
-创建svnd.sh,内容如下
#!/bin/bash
svnserve-d-r/home/svnroot
将这个文件放在/etc/init.d/svnd.sh
这个脚本的功能:启动svn服务,只有在启动服务后,外部的机器才能通过各种svn工具来访问svn服务器。
-添加可执行权限
sudochmoda+x/etc/init.d/svnd.sh
-编辑rc.local
vim/etc/rc.local
在exit0之前,加上/etc/init.d/svnd.sh
-重启服务器,然后执行命令:
ps-e|grepsvnserve
从命令结果来检查svn服务是否已经自动的随系统启动。
 以上就是系统大全给大家介绍的如何使的方法都有一定的了解了吧,好了,如果大家还想了解更多的资讯,那就赶紧点击系统大全官网吧。
本文来自系统大全http:///如需转载请注明!推荐:win7纯净版
显示全文