设为首页 收藏本站
查看: 1816|回复: 0

[经验分享] 在linux下搭建svn服务器,不带apache

[复制链接]

尚未签到

发表于 2015-8-2 10:30:18 | 显示全部楼层 |阅读模式
折腾了一天,哎惭愧,对linux不熟啊。废话少说linux版本 Redhat4  不用apache,直接用subversion
需要软件
subversion-1.4.5.tar.gz和subversion-deps-1.4.5.tar.gz安装包下载地址:
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=7495&expandFolder=7495&folderID=260
安装和配置 subversion
#tar –zvxf subversion-1.4.5.tar.gz
#tar –zvxf subversion-deps-1.4.5.tar.gz /*这两个自动解压成一个包 subversion-1.4.5
#cd subversion-1.4.5
#rm –rf apr
#rm -rf apr-util
注意:SVN 依赖的APR版本要正确。如果Apache为2.0.x,对应的APR版本应为0.9.x;Apache为2.2.x,对应的APR版本应为1.2.x。 由于subversion-deps包里的APR是0.9.x的,因此编译svn时要删除从deps里解压出来的apr, apr-util,改而使用apache 2.2里提供的。(这里指定为开始安装的apr目录),这一点知识非常重要,自己之前多次安装都没成功,现在才明白是在这一点被卡住了,但最终还是被我解 决了, 学习,和不断实践 会使你不断成长!
#./configure
--prefix=/usr/local/svn
--with-apxs=/usr/local/apache/bin/apxs
--with-apr=/usr/local/apr/bin/apr-1-config
--with-apr-util=/usr/local/apr/bin/apu-1-config
--with-ssl
--with-zlib
--enable-maintainer-mode
#make
#make install
确定一下svn有没有安装成功
#/usr/local/svn/bin/svnserve - -version
会看到相关版本信息!
开始建立版本库
#/usr/local/svn/bin/svnadmin create /svn/project/projectname /*创建仓库"www"  (需要事先建立好目录/svn/project)
#ls /svn/project/projectname /*查看有没有创建好,如果多了一些文件则说明版本库已经创建好
修改权限配置等
找到projectname/conf,下面应该有三个文件
authz  passwd  svnserve.conf
如果缺少文件手工加上去
缺省authz的内容:
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
#[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
Admin=use1,user2
Develop=use1,user2
[projectname:/]
@Admin=rw
@Develop=rw
---------------------结束
注意:要把#[groups]前的“#”去掉
缺省passwd的内容
[users]
user1:user1passwd
user2:user2passwd
---------------------结束
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
auth-access = write
### 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
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 conf directory.
### The format of the password database is similar to this file.
### It contains one section labelled [users]. The name and
### password for each user follow, one account per line. The
### format is
###    USERNAME = PASSWORD
### Please note that both the user name and password are case
### sensitive. There is no default for the 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
---------------------结束
去掉auth-access = write,password-db = passwd,authz-db = authz前的“#”,且前面不能有任何空格
启动svn服务
#/usr/local/svn/bin/svnserve -d -r /opt/svn/project

查看是否成功启动
ps –ef|grep svnserve
显示诸如下面则表示成功
  svn    6941   1 0 15:07 ?    00:00:00 svnserve -d --listen-port 9999 -r /opt/project
  
  将svn服务设置成开机自启动:
  vi /etc/rc.d/rc.local

  在最后面加上
  svnserve -d
  即可

  svn: Expected version '3' of repository; found version '5' / svn: Expected format '3' of repository; found format '5'
把你创建的项目的svn库目录下的  /format(我指定的目录是/opt/svn/project/projectname/)文件中的5改成3就可以了.
在修改之前,由于format是只读方式的,你可能需要先chmod   666   format 一下

  今天遇到一个比较怪的问题:将服务器shutdown(reboot没问题)之后,执行任何操作都报No such revision 10  ,用svnadmin verify 一查 发现版本库丢失了,服务器上版本号只有0,没辙将repository删除了用svnadmin create命令重新建立,一切正常,当用客户端连接时又报:can't read file '****/db/revs/0': Is a directory

  我就郁闷了,一直都是这么建的 ,这回就不行了呢,反复尝试,始终不行,最后将subversion重新执行一遍configure,make,make install  ,再重新建立,刚开始好使,shutdown之后又不行了,最后发现在./configure 时指定 -prefix=***(一个路径,如/usr/local/svn)这样之后,就好了,无论怎样shutdown都没问题。

  对linux不熟悉,猜想可能是没有指定prefix时,默认安装在/usr/local目录下,同时有些数据文件会存放在类似临时目录下,当shutdown后就没了.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-93237-1-1.html 上篇帖子: 一个异常org.apache.jasper.JasperException: java.lang.IllegalStateException: No outpu 下篇帖子: Apache Nutch 1.3 学习笔记四(SegmentReader分析)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表