📝 Writing docs.

This commit is contained in:
Zhang Peng 2018-09-28 20:12:32 +08:00
parent 8598e62f2d
commit 62d2995f80
3 changed files with 157 additions and 3 deletions

View File

@ -35,3 +35,4 @@
* RocketMQ 安装和配置:| [CODES](codes/deploy/tool/rocketmq) | [DOCS](docs/deploy/tool/rocketmq/install-rocketmq.md) |
* Tomcat 安装和配置:| [CODES](codes/deploy/tool/tomcat) | [DOCS](docs/deploy/tool/tomcat/install-tomcat.md) |
* Zookeeper 安装和配置:| [CODES](codes/deploy/tool/zookeeper) | [DOCS](docs/deploy/tool/zookeeper/install-zookeeper.md) |
* Svn 安装和配置:| [DOCS](docs/deploy/tool/svn/install-svn.md) |

View File

@ -0,0 +1,153 @@
# Subversion(svn) 安装
<!-- TOC depthFrom:2 depthTo:3 -->
- [1. 安装配置](#1-安装配置)
- [1.1. 安装 svn](#11-安装-svn)
- [1.2. 创建 svn 仓库](#12-创建-svn-仓库)
- [1.3. 配置 svnserve.conf](#13-配置-svnserveconf)
- [1.4. 配置 passwd](#14-配置-passwd)
- [1.5. 配置 authz](#15-配置-authz)
- [1.6. 启动关闭 svn](#16-启动关闭-svn)
- [1.7. 开机自启动 svn 方法](#17-开机自启动-svn-方法)
- [1.8. svn 客户端访问](#18-svn-客户端访问)
- [2. 参考资料](#2-参考资料)
<!-- /TOC -->
## 1. 安装配置
### 1.1. 安装 svn
```sh
$ yum install -y subversion
```
### 1.2. 创建 svn 仓库
```sh
$ mkdir -p /share/svn
$ svnadmin create /share/svn
$ ls /share/svn
conf db format hooks locks README.txt
```
在 conf 目录下有三个重要的配置文件
- authz - 是权限控制文件
- passwd - 是帐号密码文件
- svnserve.conf - 是 SVN 服务配置文件
### 1.3. 配置 svnserve.conf
```sh
$ vim /share/svn/conf/svnserve.conf
```
打开下面的 5 个注释
```ini
anon-access = read #匿名用户可读
auth-access = write #授权用户可写
password-db = passwd #使用哪个文件作为账号文件
authz-db = authz #使用哪个文件作为权限文件
realm = /share/svn # 认证空间名,版本库所在目录
```
### 1.4. 配置 passwd
```sh
$ vim /share/svn/conf/passwd
```
添加内容如下:
```ini
[users]
user1 = 123456
user2 = 123456
user3 = 123456
```
### 1.5. 配置 authz
```sh
$ vim /share/svn/conf/authz
```
添加内容如下:
```ini
[/]
user1 = rw
user2 = rw
user3 = rw
*=
```
### 1.6. 启动关闭 svn
```sh
$ svnserve -d -r /share/svn # 启动 svn
$ killall svnserve # 关闭 svn
```
### 1.7. 开机自启动 svn 方法
安装好 svn 服务后,默认是没有随系统启动自动启动的,而一般我们有要求 svn 服务稳定持续的提供服务。所以,有必要配置开机自启动 svn 服务。
#### Centos7 以前
编辑 `/etc/rc.d/rc.local` 文件:
```sh
$ vi /etc/rc.d/rc.local
```
输入以下内容:
```sh
# 开机自动启动 svn默认端口是 3690
$ /usr/bin/svnserve -d -r /share/svn --listen-port 3690
```
注意:
我们在用终端操作的时候,可以直接使用以下命令启动 SVN`svnserve -d -r /share/svn`,但是在 `/etc/rc.d/rc.local` 文件中必须写上完整的路径!
如果不知道 svnserve 命令安装在哪儿,可以使用 whereis svnserve 查找。
#### Centos7
CentOS 7 中的 `/etc/rc.d/rc.local` 是没有执行权限的,系统建议创建 `systemd service` 启动服务。
找到 svn 的 service 配置文件 `/etc/sysconfig/svnserve` 编辑配置文件
```sh
$ vi /etc/sysconfig/svnserve
```
`OPTIONS="-r /var/svn"` 改为 svn 版本库存放的目录,:wq 保存退出。
执行 `systemctl enable svnserve.service`
重启服务器后,执行 `ps -ef | grep svn` 应该可以看到 svn 服务的进程已经启动。
### 1.8. svn 客户端访问
进入 [svn 官方下载地址](https://tortoisesvn.net/downloads.html),选择合适的版本,下载并安装。
新建一个目录,然后打开鼠标右键菜单,选择 **SVN Checkout**。如下图所示:
![](http://oyz7npk35.bkt.clouddn.com/images/20180920180928200552.png)
在新的窗口,输入地址 `svn://<你的 IP>` 即可,不出意外输入用户名和密码就能连接成功了(这里的用户、密码必须在 passwd 配置文件的清单中)。默认端口 3690如果你修改了端口那么要记得加上端口号。如下图所示
![](http://oyz7npk35.bkt.clouddn.com/images/20180920180928200332.png)
## 2. 参考资料
- https://www.cnblogs.com/liuxianan/p/linux_install_svn_server.html
- https://blog.csdn.net/testcs_dn/article/details/45395645
- https://www.cnblogs.com/moxiaoan/p/5683743.html
- https://blog.csdn.net/realghost/article/details/52396648

View File

@ -41,7 +41,7 @@ tags:
本文将以一个完整的示例来展示如何配置 samba 来实现 Linux 和 Windows 的文件共享。
目标:假设希望共享 Linux 服务器上的 /fs 目录。
目标:假设希望共享 Linux 服务器上的 /share/fs 目录。
### 1.1. 查看是否已经安装 samba
@ -101,7 +101,7 @@ vim /etc/samba/smb.conf
[fs]
comment = share folder
path = /fs
path = /share/fs
browseable = yes
writable = yes
read only = no
@ -115,7 +115,7 @@ vim /etc/samba/smb.conf
> 说明:
>
> - 我在这里添加了一个 **[fs]** 标签,这就是共享区域的配置。
> - 这里设置 `path` 属性为 `/fs`,意味着准备共享 `/fs` 目录,需要根据实际需要设置路径。`/fs` 目录的权限要设置为 **777**`chmod 777 /fs`。
> - 这里设置 `path` 属性为 `/share/fs`,意味着准备共享 `/share/fs` 目录,需要根据实际需要设置路径。`/share/fs` 目录的权限要设置为 **777**`chmod 777 /share/fs`。
> - `browseable`、`writable` 等属性就比较容易理解了,即配置共享目录的访问权限。
> - `valid users` 属性指定允许访问的用户,需要注意的是指定的用户必须是 Linux 机器上实际存在的用户。