Centos6.5_64 下SVN独立服务器安装配置
[root@xtsvn~]#setup #关闭防火墙
[root@xtsvndb]# vim /etc/selinux/config #关闭selinux
SELINUX=disabled
[root@xtsvn ~]# yum clean all #清除yum缓存
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@xtsvn~]# yum install subversion subversion-devel #安装subversion
Dependency Installed:
apr-devel.x86_64 0:1.3.9-5.el6_2 apr-util-devel.x86_64 0:1.3.9-3.el6_0.1
cyrus-sasl-devel.x86_64 0:2.1.23-13.el6_3.1 db4-cxx.x86_64 0:4.7.25-18.el6_4
db4-devel.x86_64 0:4.7.25-18.el6_4 expat-devel.x86_640:2.0.1-11.el6_2
openldap-devel.x86_64 0:2.4.23-34.el6_5.1
Updated:
subversion.x86_64 0:1.6.11-10.el6_5
Dependency Updated:
openldap.x86_64 0:2.4.23-34.el6_5.1
Complete!
[root@xtsvn~]# svnserve –version #查看subversion的版本
svnserve,version 1.6.11 (r934486)
compiled Mar 6 2014, 10:49:10
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, seehttp://subversion.tigris.org/
This product includes software developed byCollabNet (http://www.Collab.Net/).
The following repository back-end (FS)modules are available:
* fs_base : Module for working with aBerkeley DB repository.
* fs_fs : Module for working with a plainfile (FSFS) repository.
Cyrus SASL authentication is available.
[root@xtsvn~]# mkdir -p /data/svn #创建SVN工作目录
[root@xtsvn~]# svnadmin create /data/svn/xtsvn_jh.org #创建版本库
[root@xtsvn~]# ll /data/svn/xtsvn_jh.org/db/ | grep fsfs.conf #查看版本库中相关信息
-rw-r--r--. 1 root root 1920 May 27 09:23fsfs.conf
[root@xtsvn~]# ll /data/svn/xtsvn_jh.org
total 24
drwxr-xr-x. 2 root root 4096 May 27 09:23conf
drwxr-sr-x. 6 root root 4096 May 27 09:23db
-r--r--r--. 1 root root 2 May 27 09:23 format
drwxr-xr-x. 2 root root 4096 May 27 09:23hooks
drwxr-xr-x. 2 root root 4096 May 27 09:23locks
-rw-r--r--. 1 root root 229 May 27 09:23 README.txt
[root@xtsvn~]# mkdir -p /etc/svn/conf #在/etc/下创建svn的用户密码验证文件和用户权限验证文件目录
[root@xtsvn~]# ls /data/svn/xtsvn_jh.org/conf #查看配置文件
authz passwd svnserve.conf
[root@xtsvn~]# cp -rva /data/svn/xtsvn_jh.org/conf/* /etc/svn/conf #将配置文件复制到些目录
`/data/svn/xtsvn_jh.org/conf/authz' ->`/etc/svn/conf/authz'
`/data/svn/xtsvn_jh.org/conf/passwd' ->`/etc/svn/conf/passwd'
`/data/svn/xtsvn_jh.org/conf/svnserve.conf'-> `/etc/svn/conf/svnserve.conf'
[root@xtsvn~]# cp /data/svn/xtsvn_jh.org/conf/svnserve.conf/data/svn/xtsvn_jh.org/conf/svnserve.conf.bak
#修改前备份
[root@xtsvn~]# vim /data/svn/xtsvn_jh.org/conf/svnserve.conf #修改配置
1### This file controls the configuration of the svnserve daemon, if you
2### use it to allow access to this repository. (If you only allow
3### access through http: and/or file: URLs, then this file is
4### irrelevant.)
5
6### Visit http://subversion.tigris.org/ for more information.
7
8[general]
9### These options control access to the repository for unauthenticated
10 ###and authenticated users. Valid valuesare "write", "read",
11### and "none". The samplesettings below are the defaults.
12 anon-access = read #去掉注释
13 auth-access = write #去掉注释
14### The password-db option controls the location of the password
15### database file. Unless you specify apath starting with a /,
16### the file's location is relative to the directory containing
17### this configuration file.
18### If SASL is enabled (see below), this file will NOT be used.
19### Uncomment the line below to use the default password file.
20 password-db = /etc/svn/conf/passwd #指定SVN用户密码验证文件
21### The authz-db option controls the location of the authorization
22### rules for path-based access control. Unless you specify a path
23### starting with a /, the file's location is relative to the the
24### directory containing this file. Ifyou don't specify an
25### authz-db, no path-based access control is done.
26### Uncomment the line below to use the default authorization file.
27 authz-db = /etc/svn/conf/authz #指定SVN用户权限验证文件
28### This option specifies the authentication realm of the repository.
29### If two repositories have the same authentication realm, they should
30### have the same password database, and vice versa. The default realm
31### is repository's uuid.
32realm = My First Repository
33
34[sasl]
35### This option specifies whether you want to use the Cyrus SASL
36### library for authentication. Default is false.
37### This section will be ignored if svnserve is not built with Cyrus
38### SASL support; to check, run 'svnserve --version' and look for a line
"/data/svn/xtsvn_jh.org/conf/svnserve.conf"47L, 2269C written
[root@xtsvn~]# vim /etc/svn/conf/passwd #新增SVN用户
### This file is an example password filefor svnserve.
### Its format is similar to that ofsvnserve.conf. As shown in the
### example below it contains one sectionlabelled [users].
### The name and password for each userfollow, one account per line.
[users]
# harry = harryssecret
# sally = sallyssecret
svnuser1 = 123456 #用户 = 密码
svnuser2 = 123456
~
"/etc/svn/conf/passwd" 10L, 347Cwritten
[root@xtsvn~]# vim /etc/svn/conf/authz #配置用户权限
### This file is an example authorizationfile for svnserve.
### Its format is identical to that ofmod_authz_svn authorization
### files.
### As shown below each section definesauthorizations for the path and
### (optional) repository specified by thesection name.
### The authorizations follow. Anauthorization 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 prefixingthe rule with '~'. Rules can
### grant read ('r') access, read-write('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=SnakeCity/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe =harry,sally,&joe
svnadmin = svnuser1,svnuser2 #svnadmin组名,格式为组名 = 用户1,用户2
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[xtsvn_jh.org:/] #SVN版本库名
@svnadmin = rw #svadmin组权限,读写
[/] #SVN根
@svnadmin = rw #svnadmin组对根的权限,读写
"/etc/svn/conf/authz" 50L, 1173Cwritten
[root@xtsvn~]# /usr/bin/svnserve -d -r /data/svn
#启动SVN服务,-d以daemonm方式运行
#–r /data/svn 指定根目录是/data/svn
[root@xtsvn~]# ps aux | grep svn #查看SVN服务是否开启
root 11753 0.0 0.0 152860 740 ? Ss 09:53 0:00 /usr/bin/svnserve -d -r /data/svn
root 11755 0.0 0.0 103244 856 pts/0 S+ 09:53 0:00 grep svn
[root@xtsvn~]# echo "/usr/bin/svnserve -d -r /data/svn" >> /etc/rc.local #将SVN服务添加到开机自启
[root@xtsvn~]# cat /etc/rc.local #查看
#!/bin/sh
#
# This script will be executed *after* allthe other init scripts.
# You can put your own initialization stuffin here if you don't
# want to do the full Sys V style initstuff.
touch /var/lock/subsys/local
/usr/bin/svnserve -d -r /data/svn
[root@xtsvndb]# pkill -9 svnserve #SVN服务停止
[root@xtsvndb]# ps -aux | grep svnserve #查看
Warning: bad syntax, perhaps a bogus '-'?See /usr/share/doc/procps-3.2.8/FAQ
root 1677 0.0 0.0 103244 856 pts/0 S+ 19:55 0:00 grep svnserve
注:资料来源:http://down.51cto.com/data/1265396