CentOS SVN服务器安装配置

来源:互联网 发布:2t硬盘恢复数据多少钱 编辑:程序博客网 时间:2024/06/01 10:42

CentOS SVN服务器安装配置

SVN的安装

安装很简单,尤其对于CentOS这种,直接:

# yum install subversion# yum install mod_dav_svn

不同发行版的Package安装方法参见http://subversion.apache.org/packages.html,当然,某些发行版下或者不闲麻烦可以直接源码编译安装,但是,灭霍霍霍霍~

安装完检查一下是否成功了

# svnserve --version

能正常显示版本信息就大功告成啦~

建立版本库

# svnadmin create /svn/project

/svn/project是所建立版本仓库的路径,理论上可以为任何目录

SVN配置

进入所建立仓库的配置目录/svn/project/conf修改文件svnserve.conf

[general]anon-access = none     //匿名访问权限auth-access = write    //认证用户权限password-db = passwd   //密码配置文件路径,默认为同目录的passwd文件realm = SVNofMyProject //认证标记而已

去掉对应行前的#使语句生效,切记前面不能留空格

配置用户名密码

修改与配置文件同目录的passwd文件

[users]usr1 = psw1usr2 = psw2

启动SVN服务器

# svnserve -d -r /svn --listen-host 192.168.0.3

-d表示在后台运行,-r指定了服务器的根目录,这样在SVN客户端就可以用svn://192.168.0.3/project来访问SVN服务器

顺便说一下,使用以下命令可以查看正在运行的SVN进程

# ps -ef | grep svn

使用命令

# killall svnserve

# kill -9 xxxx

来停止SVN服务器。

到此的话,在服务器上执行co应该就没什么问题了。可是其他终端通过svn可能还访问不了咱的服务器ΦωΦ

防火墙配置

SVN的默认端口是3609,要在防火墙上开放这个端口才行

# /sbin/iptables -A INPUT -i eth0 -p tcp --dport 3690 -j ACCEPT# /sbin/service iptables save

唉,我就是栽在这了。。。最好看下eth0这个参数,如果你的服务器刚好像我的一样有很多网卡,而且那个再用的不是eth0的话。。就要修改一下了恩。ΦωΦ

查看网络参数可以使用

# ifconfig

到此为止咱就应该能够成功地连上远程的SVN服务器了恩,checkout可以使用

# svn co svn://192.168.0.3/project

然后按提示输入之前配置过的用户名和密码就好了。

更多的SVN命令就不在这粘贴了~

下面贴出我的配置文件
【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[groups][/]marry = rwjetty = rwtom = rw

【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 = sallyssecretmarry= marry001jetty = jetty002tom = tom003

【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### 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 directory containing### this configuration file.### If SASL is enabled (see below), this file will NOT be used.### Uncomment the line below to use the default 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[sasl]### This option specifies whether you want to use the Cyrus SASL### library for authentication. Default is false.### This section will be ignored if svnserve is not built with Cyrus### SASL support; to check, run 'svnserve --version' and look for a line### reading 'Cyrus SASL authentication is available.'# use-sasl = true### These options specify the desired strength of the security layer### that you want SASL to provide. 0 means no encryption, 1 means### integrity-checking only, values larger than 1 are correlated### to the effective key length for encryption (e.g. 128 means 128-bit### encryption). The values below are the defaults.# min-encryption = 0# max-encryption = 256[general]anon-access = readauth-access = writepassword-db = passwdauthz-db = authz

转自:http://www.cnblogs.com/wangyan-tutu/p/3358297.html

原创粉丝点击