Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15448925
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2008-08-07 19:24:45

svn简易服务器的搭建ubuntu7.10

1.安装svn软件
gliethttp@Leith:~$ sudo apt-get install subversion subversion-tools
2.配置svn服务器
gliethttp@Leith:~$ mkdir -p ~/svn_repos
gliethttp@Leith:~$ svnadmin create ~/svn_repos/sandybox  创建一个sandybox版本库
gliethttp@Leith:~$ ls /home/Leith/svn_repos/sandybox/
conf  dav  db  format  hooks  locks  README.txt
其中
conf 一个存储版本库配置文件的目录
dav  提供给Apache和mod_dav_svn的目录,让它们存储自己的数据
db   你所有的受版本控制数据的所在之处,这个目录或者是个Berkeley DB环境(满是数据表和其他东西),
     或者是一个包含修订版本文件的FSFS环境
format 包含了用来表示版本库布局版本号的整数
hooks  一个存储钩子脚本模板的目录(还有钩子本身,如果你安装了的话)
locks  一个存储subversion版本库锁定数据的目录,被用来追踪对版本库的访问
一般来说我们不需要手动干预版本库,svnadmin工具应该足以用来处理对版本库的任何修改.
3.向版本库中填入我们需要管理的目录结构和文件
<1>gliethttp@Leith:~$ tree -L 1 svn_trees
svn_trees/
|-- branches
|-- pool
|-- tags
`-- trunk
<2>gliethttp@Leith:~$ tree -L 2 svn_trees/
svn_trees/
|-- branches
|   |-- COPYING
|   |-- CREDITS
|   |-- Documentation
|   |-- Kbuild
|   |-- MAINTAINERS
|   |-- Makefile
|   |-- README
|   |-- REPORTING-BUGS
|   |-- arch
|   |-- block
|   |-- crypto
|   |-- drivers
|   |-- fs
|   |-- include
|   |-- init
|   |-- ipc
|   |-- kernel
|   |-- lib
|   |-- mm
|   |-- net
|   |-- samples
|   |-- scripts
|   |-- security
|   |-- setup.sh
|   |-- sound
|   `-- usr
|-- pool
|-- tags
`-- trunk
<3>接下来将svn_trees中的内容导入到版本库sandybox中
gliethttp@Leith:~$ svn import svn_trees/ file:///home/Leith/svn_repos/sandybox
<4>查看一下版本库
gliethttp@Leith:~$ svn list file:///home/Leith/svn_repos/sandybox
branches/
pool/
tags/
trunk/
<5>可以使用file:///来进行本机co文件
gliethttp@Leith:~$ svn co file:///home/Leith/svn_repos/sandybox/branches linux
A    linux/crypto
A    linux/crypto/Kconfig
...
A    linux/drivers/i2c/i2c-core.h
A    linux/drivers/i2c/Makefile
Checked out revision 1.
<6>怎么通过svn://方式从局域网中其他机子访问本机
gliethttp@Leith:~$ killall svnserve
gliethttp@Leith:~$ svnserve -d -r ~/svn_repos/
gliethttp@Leith:~$ svn list svn://127.0.0.1/sandybox
branches/
pool/
tags/
trunk/
<7>添加用户和密码,这样才能够ci操作,否则只能进行co操作
gliethttp@Leith:~/svn_repos/sandybox$ tree conf/
conf/
|-- authz
|-- passwd
`-- svnserve.conf
在svnserve.conf有两个或者多个参数需要设置:它们确定未认证(匿名)和认证用户可以做的事情,参数anon-access和auth-access可以设置为noe、read或者write,设置为none会限制所有方式的访问,read允许只读访问,而write允许对版本库完全的读/写权限:
svnserve.conf添加下面2行语句,表示,匿名用户不能read版本库

anon-access = none
password-db = passwd

gliethttp@Leith:~$ svn list svn://127.0.0.1/sandybox
svn: No access allowed to this repository
在passwd中加入用户名和登录密码
[users]
Leith = 123
最后使用Leith登录即可,密码123
gliethttp@Leith:~$ svn list svn://127.0.0.1/sandybox
Authentication realm: d461514d-98c3-4ccb-afc3-083b4b58353c
Password for 'Leith':
Authentication realm: d461514d-98c3-4ccb-afc3-083b4b58353c
Username: Leith
Password for 'Leith':
branches/
pool/
tags/
trunk/
gliethttp@Leith:~$ svn list svn://127.0.0.1/sandybox
branches/
pool/
tags/
trunk/
以上就是最简单的svn服务器配置步骤【gliethttp.Leith】.
ps.为了起机自动运行svn服务,可以在/etc/rc.local中加入如下行:
gliethttp@Leith:~$ sudo vim /etc/rc.local
svnserve -d -r /home/Leith/svn_repos
如果访问的svn_repos普通用户不具备访问权限,比如/media/d/svn_repos,那么
可以使用
sudo svnserve -d -r /home/Leith/svn_repos
这样作为daemon的svnserve就具备了sudo权限:)
当然需要首先去掉sudo密码
luther@gliethttp:~$ sudo vim /etc/sudoers
在该文件的末尾追加期望不输入密码的root用户.
luther  ALL=NOPASSWD: ALL
阅读(2287) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~