Linux下安装SVN

2022-01-17  本文已影响0人  87d6dc4b11a7

1、安装svn

[root@localhost ~]# yum install -y subversion

[root@localhost ~]# svn --version
[root@localhost ~]# svnserve --version

2、创建目录并配置

[root@localhost ~]# cd /mnt/
[root@localhost mnt]# mkdir -p svn
[root@localhost svn]# svnadmin create repo
[root@localhost svn]# ll
总用量 0
drwxr-xr-x 6 root root 86 1月  14 18:14 repo
[root@localhost svn]# cd repo/
[root@localhost repo]# ll
总用量 8
drwxr-xr-x 2 root root  54 1月  14 18:14 conf
drwxr-sr-x 6 root root 233 1月  14 18:14 db
-r--r--r-- 1 root root   2 1月  14 18:14 format
drwxr-xr-x 2 root root 231 1月  14 18:14 hooks
drwxr-xr-x 2 root root  41 1月  14 18:14 locks
-rw-r--r-- 1 root root 229 1月  14 18:14 README.txt

3、用户密码passwd配置

[root@localhost repo]# cd conf/
[root@localhost conf]# ll
总用量 12
-rw-r--r-- 1 root root 1080 1月  14 18:14 authz
-rw-r--r-- 1 root root  309 1月  14 18:14 passwd
-rw-r--r-- 1 root root 3090 1月  14 18:14 svnserve.conf
[root@localhost conf]# vi 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
test=test@123

4、权限控制authz配置

[root@localhost conf]# vi authz

用于设置哪些用户可以访问哪些目录,向authz文件追加以下内容:

#[/]代表根目录下所有的资源
[/]
test = rw

5、服务svnserve.conf配置

[root@localhost conf]# vi svnserve.conf

追加以下内容:

[general]
#匿名访问的权限,可以是read,write,none,默认为read
anon-access=none
#使授权用户有写权限 
auth-access=write
#密码数据库的路径 
password-db=passwd
#访问控制文件 
authz-db=authz
#认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字 
realm=/mnt/svn

6、启动svn服务

查看svn的服务是否启动

ps -ef | grep svn

如果没有启动的话,执行下面命令启动:

#启动命令: svnserve -d -r 版本库路径 --listen 端口号
[root@localhost conf]# svnserve -d -r /mnt/svn  --listen-port=3690
[root@localhost conf]#
[root@localhost conf]# ps -ef | grep svn
root      99402      1  0 19:08 ?        00:00:00 svnserve -d -r /mnt/svn/repo --listen-port=3690
root      99624   5157  0 19:08 pts/0    00:00:00 grep --color=auto svn

7、访问

客户端安装:TortoiseSVN及中文语言包(需要下载和客户端版本相同的)。
安装完成后,输入svn://192.168.116.128访问。

https://www.runoob.com/w3cnote/linux-subversion-yum.html
https://www.cnblogs.com/cac2020/p/9783710.html

上一篇 下一篇

猜你喜欢

热点阅读