subversion源代码安装


下载:http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260&expandFolder=74
     http://subversion.tigris.org/downloads/subversion-1.5.2.tar.bz2
     如果需要处理http://方案,请下载deps包,解压后,会自动解压到subversion目录
   
最新版本为:1.5.2       
  1. tar -jxvf subversion-1.5.2.tar.bz2
  2. cd subversion-1.5.2
  3. sudo ./configure --with-apxs=/usr/local/apache2/bin/apxs --prefix=/usr/local/subversion --with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2 --with-ssl --with-zlib=/usr/local/zlib --enable-maintainer-mode
  4. sudo make && sudo make install
ASDFSADF
注:第二次我编译1.5.3的版本时,出现下列错误configure: error: could not find library containing RSA_new

重新加了参数如下,原因是当初编译ssl的时候都是指定目录安装的,所以以后要编译什么东西都要指定目录了,不然会在默认的安装地方找不到。固以后大家安装一些基本点的库时,最好按照默认目录来安装,免得找不到。不过指定了目录,也会让自己更清楚安装的目录路径,孰好孰坏呢?
  1. sudo ./configure --with-apxs=/usr/local/apache2/bin/apxs --prefix=/usr/local/subversion --with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2 --with-ssl --with-zlib=/usr/local/zlib --with-openssl=/usr/local/ssl  --with-libs=/usr/local/ssl --enable-maintainer-mode/
  2. sudo make && sudo make install
安装好后就可以用http://来import了,查看版本如下,加粗的为升级后的功能
  1. svn --version

  2. 可使用以下的版本库访问模块: 
  3. * ra_neon : 通过 WebDAV 协议使用 neon 访问版本库的模块。
  4.   - 处理“http”方案
  5.   - 处理“https”方案
  6. * ra_svn : 使用 svn 网络协议访问版本库的模块。
  7.   - 处理“svn”方案
  8. * ra_local : 访问本地磁盘的版本库模块。
  9.   - 处理“file”方案
  10. * ra_serf : 通过 WebDAV 协议使用 serf 访问版本库的模块。
  11.   - 处理“http”方案
  12.   - 处理“https”方案



  1. sudo groupadd svn
  2. sudo useradd svnroot -g svn
  3. sudo passwd svnroot



注意上面如果想要在home下出现svnroot的目录,请在useradd svnroot 后加上-m参数.如果启用svnroot账户时不能自动补全等,把sh的标准改为bash,代码如下

  1. sudo vi /etc/passwd
  2. svnroot:x:1002:1002::/home/svnroot:/bin/sh===>/bin/bash

关于用 户,组等请查看相关文档。

configure后显示
  1. You don't seem to have Berkeley DB version 4.0.14 or newer
  2. installed and linked to APR-UTIL.  We have created Makefiles which
  3. will build without the Berkeley DB back-end; your repositories will
  4. use FSFS as the default back-end.  You can find the latest version of
  5. Berkeley DB here:
  6.   http://www.oracle.com/technology/software/products/berkeley-db/index.html

make出错如下,原来缺libexpat库,装上libexpat1-dev及libexpat1继续make,通过。
  1. /us r/bin/ld: cannot find -lexpat
  2. collect2: ld returned 1 exit status
  3. make: *** [subversion/svn/svn] Error 1


编译完后一般会自动在apache配置文件httpd.conf中添加
  1. LoadModule dav_svn_module     modules/mod_dav_svn.so
  2. LoadModule authz_svn_module   modules/mod_authz_svn.so
  3. #下面添加
  4. <Location /svn>
  5. DAV svn
  6. SVNParentPath /home/svnroot/repository/ //svn父目录
  7. AuthzSVNAccessFile /home/svnroot/repository/authz.conf //权限配置文件 
  8. AuthType Basic //连接类型设置 
  9. AuthName "Subversion.zoneyump" //连接框提示 
  10. AuthUserFile /home/svnroot/repository/authfile //用户配置文件
  11. Require valid-user //采用何种认证
  12. </Location>
没有则自行添加
到这里,我们就明白了得重新编译apache,在原有的基础上加上如下参数
  1. --enable-dav --enable-dav-fs --enable-dav-lock
  2. make && sudo make install
否则可能出现如下错误
  1. httpd: Syntax error on line 54 of /home/apache/conf/httpd.conf: Cannot load /home/apache/modules/mod_dav_svn.so into server: /home/apache/modules/mod_dav_svn.so: undefined symbol: dav_register_provider



创建库文件所在的目录 (svnroot用户进行下面的操作)
  1. mkdir /home/svnroot/repository
创建仓库"test"
  1. /usr/local/subversion/bin/svnadmin create /home/svnroot/repository/test
查看svn是 否安装成功
  1. /usr/local/subversion/bin/svnadmin --version
不让其他人有该目录的权限
  1. chmod 700 /home/svnroot/repository

6. 权限管理
1)增加用户
# htpasswd -c /home/svnroot/repository/authfile 用户名
//第一次设置用户时使用-c表示新建一个用户文件。回车后输入用户密码,完成对用户的增加
# htpasswd /home/svnroot/repository/authfile 用户名(加入新的用户,就不用-c了) 2)权限分配

注意这里执行htpasswd时可能会出错如下:
  1. The program 'htpasswd' can be found in the following packages:
  2.  * mini-httpd
  3.  * apache2-utils
  4. Ask your administrator to install one of them
  5. bash: htpasswd: command not found


原因是编译apache时未加载htpasswd模块,不好意思,又得重新编译apache了,这里由于是一步一步实验,有点乱,本文结束时会重新修改.查看configure如下:
  1. --enable-static-htpasswd
  2.                           Build a statically linked version of htpasswd


# vi /home/svnroot/repository/authz.conf
[groups]
admin=useradmin
devteamcs = useradmin,user1,user2//这里定义了一个用户组
[/]//对所有的项目,所有的用户都有读权限,admin用户有读写权限
@admin = rw
* = r
[test:/]//对test项目,
@devteamcs = rw
// 在 /usr/local/apache2/conf/httpd.conf 文件中配置,找到文件中的这两行:
User daemon
Group daemon
// 将daemon改为svnroot,组也做相应更改,让apache进程以svnroot的身份运行
//改完后是这个样子
User svnroot
Group svn
ddddd


导入库:
  1. sudo ./svn import -m 'new import' /home/htdocs/test/ http://localhost/svn/test/ --username 用户名 --password 密码
  2. 认证领域: <http://localhost:80> Subversion.zoneyump
    用户名: svnroot
    “svnroot”的密码:

以上完成后会就会导入了。

mark here


参考:http://svnbook.red-bean.com/en/1.0/re12.html
     http://svnbook.red-bean.com/en/1.0/index.html
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值