1.安装

[root@izwz91h49n3mj8r232gqwez subversion]# yum install subversion

2.安装是否成功验证

[root@izwz91h49n3mj8r232gqwez subversion]# svnserve --version
svnserve, version 1.7.14 (r1542130)
   compiled Apr 11 2018, 02:40:28

Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.

Cyrus SASL authentication is available.

[root@izwz91h49n3mj8r232gqwez subversion]# 

3.创建SVN资源库

[root@izwz91h49n3mj8r232gqwez subversion]# pwd
/weblogic/subversion
[root@izwz91h49n3mj8r232gqwez subversion]# svnadmin create demo
[root@izwz91h49n3mj8r232gqwez subversion]# ll
total 8
drwxr-xr-x 6 root root 4096 Oct  4 15:53 demo
drwxr-xr-x 2 root root 4096 Oct  4 15:50 svndir
[root@izwz91h49n3mj8r232gqwez subversion]# cd demo/
[root@izwz91h49n3mj8r232gqwez demo]# ll
total 24
drwxr-xr-x 2 root root 4096 Oct  4 15:53 conf
drwxr-sr-x 6 root root 4096 Oct  4 15:53 db
-r--r--r-- 1 root root    2 Oct  4 15:53 format
drwxr-xr-x 2 root root 4096 Oct  4 15:53 hooks
drwxr-xr-x 2 root root 4096 Oct  4 15:53 locks
-rw-r--r-- 1 root root  229 Oct  4 15:53 README.txt

3.1资源库介绍

3.1.1 配置文件目录介绍 -conf

authz               是权限相关的配置
passwd              是帐号相关的配置
svnserve.conf       是资源库相关的配置

3.2.新增用户

[root@izwz91h49n3mj8r232gqwez conf]# pwd
/weblogic/subversion/demo/conf
[root@izwz91h49n3mj8r232gqwez conf]# vim passwd

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
gaoxinfu=gaoxinfu                                                                                                                                                                

新增
用户gaoxinfu
密码gaoxinfu

3.3 用户权限配置

编辑authz文件,在[/] 下添加权限, 格式为 用户名=权限 (rw) 为读写权限

[root@izwz91h49n3mj8r232gqwez conf]# pwd
/weblogic/subversion/demo/conf
[root@izwz91h49n3mj8r232gqwez conf]# vim authz 

新增两行

[/]
gaoxinfu=rw
### 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
[/]
gaoxinfu=rw

3.4 资源库权限配置

编辑svnserver.conf文件
原来的svnserver.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.apache.org/ for more information.

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete 
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
# 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
### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above.  Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
# force-username-case = none

[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

更改svnserver.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.apache.org/ for more information.

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete 
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
# anon-access = read
# auth-access = write
anon-access = none
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
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
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
realm = /weblogic/subversion/demo
### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above.  Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
# force-username-case = none

[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

备注解释

anon-access = read //匿名用户可读
auth-access = write //授权用户可写
password-db = passwd //使用哪个文件作为账号文件
authz-db = authz //使用哪个文件作为权限文件
realm =  /data/svn/repositories //认证空间名,版本库所在目录

更改对比图
SVN安装之linux安装

3.5 启动SVN服务

启动svn服务

[root@izwz91h49n3mj8r232gqwez subversion]# pwd
/weblogic/subversion
[root@izwz91h49n3mj8r232gqwez subversion]# svnserve -d -r demo/
[root@izwz91h49n3mj8r232gqwez subversion]# 

当然服务如果已经启动,如果改动配置东西,如果想重新启动,需要先将svn的服务杀掉,如下操作,然后再进行如上的启动操作

[root@izwz91h49n3mj8r232gqwez subversion]# ps -ef|grep svn
root      6463     1  0 16:25 ?        00:00:00 svnserve -d -r demo/
root      6478  4417  0 16:28 pts/1    00:00:00 grep --color=auto svn
[root@izwz91h49n3mj8r232gqwez subversion]# kill -9 6463

4.开放3690端口

我用的是阿里云的服务器,所以端口开放是直接在阿里云的控制台设置的;
SVN安装之linux安装

也可以用下面的命令,但是我没有试

vim /etc/sysconfig/iptables
//在里面增加以下代码
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3690 -j ACCEPT

5.测试验证是否成功

svn://xxx.xxx.xxx.xxx/demo
xxx.xxx.xxx.xxx 是ip
demo是你的仓库的名字
然后输入账户和密码即可;

相关文章:

  • 2021-08-26
  • 2021-11-01
  • 2021-11-24
猜你喜欢
  • 2021-11-30
  • 2021-09-03
  • 2021-09-25
  • 2021-12-14
  • 2022-01-21
相关资源
相似解决方案