下载源码包
1.1 subversion 源码包 http://subversion.apache.org/download/
1.2下载sqlite-amalgamation
此处用的版本 subversion-1.8.9.tar.gz
sqlite-amalgamation-201408010140.zip
2.请参照 http://my.oschina.net/u/234018/blog/297849 安装apr apr-util apache
3. 解压 安装
tar -zxvf subversion-1.8.9.tar.gz
wget http://www.sqlite.org/sqlite-amalgamation-3071501.zip
unzip sqlite-amalgamation-3071501.zip
mkdir /home/devtac/soft/subversion-1.8.9/sqlite-amalgamation
cp ./sqlite-amalgamation-3071501/* /home/devtac/soft/subversion-1.8.9/sqlite-amalgamation
./configure --prefix=/usr/local/subversion --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-apxs=/usr/local/apache/bin/apxs --with-openssl --enable-maintainer-mode
make
make install
4.检测是否安装成功
[root@localhost data]# cd /usr/local/subversion/bin/
[root@localhost bin]# pwd
/usr/local/subversion/bin
[root@localhost bin]# ll
总用量 6780
-rwxr-xr-x 1 root root 4580966 8月 5 13:55 svn
-rwxr-xr-x 1 root root 211775 8月 5 13:55 svnadmin
-rwxr-xr-x 1 root root 163522 8月 5 13:55 svndumpfilter
-rwxr-xr-x 1 root root 222480 8月 5 13:55 svnlook
-rwxr-xr-x 1 root root 162722 8月 5 13:55 svnmucc
-rwxr-xr-x 1 root root 495959 8月 5 13:55 svnrdump
-rwxr-xr-x 1 root root 683761 8月 5 13:55 svnserve
-rwxr-xr-x 1 root root 289204 8月 5 13:55 svnsync
-rwxr-xr-x 1 root root 115601 8月 5 13:55 svnversion
[root@localhost bin]# svnserve --version
svnserve,版本 1.6.11 (r934486)
编译于 Apr 12 2012,11:09:11
版权所有 (C) 2000-2009 CollabNet。
Subversion 是开放源代码软件,请参阅 http://subversion.tigris.org/ 站点。
此产品包含由 CollabNet(http://www.Collab.Net/) 开发的软件。
下列版本库后端(FS) 模块可用:
* fs_base : 模块只能操作BDB版本库。
* fs_fs : 模块与文本文件(FSFS)版本库一起工作。
Cyrus SASL 认证可用。
5 subversion 配置环境变量(可以不用到subversion 的bin目录下执行subversion 命令了 )
cp /etc/profile /etc/profile.bak.20140805
vi /etc/profile
文件最后加入
SVNPATH=$PATH:/usr/local/subversion/bin
export SVNPATH
6.创建仓库
svnadmin 只能创建一级目录,如果直接执行
mkdir -p /home/devtac/svn/case
在后面用客户端checkout 的时候有时会报错
报错 : 期望文件系统格式在"1"到"4"之间;发现格式"6"
正解:
cd /home/devtac
mkdir svn
svnadmin create /home/devtac/svn/case
创建好后,有如下目录
[root@localhost bin]# cd /home/devtac/svn/case/
[root@localhost case]# ll
总用量 24
drwxr-xr-x 2 root root 4096 8月 5 16:41 conf
drwxr-sr-x 6 root root 4096 8月 5 16:45 db
-r--r--r-- 1 root root 2 8月 5 16:36 format
drwxr-xr-x 2 root root 4096 8月 5 16:36 hooks
drwxr-xr-x 2 root root 4096 8月 5 16:36 locks
-rw-r--r-- 1 root root 229 8月 5 16:36 README.txt
7 修改配置文件
主要修改 /home/devtac/svn/case/conf
root@localhost conf]# pwd
/home/devtac/svn/case/conf
[root@localhost conf]# ls
authz passwd svnserve.conf svnserve.conf.bak
[root@localhost conf]# ls -al
总用量 24
drwxr-xr-x 2 root root 4096 8月 5 16:41 .
drwxr-xr-x 6 root root 4096 8月 5 16:36 ..
-rw-r--r-- 1 root root 1144 8月 5 16:37 authz
-rw-r--r-- 1 root root 350 8月 5 16:38 passwd
-rw-r--r-- 1 root root 3995 8月 5 16:41 svnserve.conf
-rw-r--r-- 1 root root 2279 8月 5 16:37 svnserve.conf.bak
主要修改
svnserve.conf
anon-access = none (匿名用户不能访问)
auth-access = write (认证用户 可读可写)
password-db = passwd(用户密码文件)
authz-db = authz
详细解释请读配置文件svnserve.conf里注释
注意:
### users have read and write access to the repository.
anon-access = none
auth-access = write
auon-access 前面不能有空格,auth-access 也不能有,svnserve.conf 每行修改的行首都不要有空格
否则 后面客户端checkout 又会报错。
passwd 配置账号密码
[root@localhost conf]# more passwd
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
# harry = harryssecret
# sally = sallyssecret
admin = admin
tac = lovelife
test = test
authz 配置权限 如下
[root@localhost conf]# more 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
user = admin,tac,test
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
user = rw
admin = rw
tac = rw
test = r
配置文件暂时修改完毕
8. 导入代码库 到仓库
1423 mkdir -p /tmp/data/
1424 echo '1111' >/tmp/data/index.html
1425 echo '2222' >/tmp/data/2.html
1426 ./svn import /tmp/data/ file:///home/devtac/svn/case -m "testttttttest"
9.安装客户端
TortoiseSVN-1.8.7.25475-x64-svn-1.8.9.msi
10. checkout
10.1 先 在server 端把svn 默认端口加到iptables 里
重启iptable
10.2 启动 svn
svnserve -d -r /home/devtac/svn/case
10.2 客户端 checkout
我这边url 里写的是:
svn://192.168.2.241
完工
谢谢网络诸君