增加 NFS 服务安装和配置.
Signed-off-by: ithink.chan <chenyang@autoai.com>
This commit is contained in:
parent
15e2c1cfe4
commit
22a1c767e9
|
@ -0,0 +1,65 @@
|
|||
# NFS 服务安装和配置
|
||||
|
||||
## 安装
|
||||
|
||||
```sh
|
||||
# Ubuntu
|
||||
sudo apt-get install nfs-kernel-server
|
||||
sudo apt-get install nfs-common
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
```sh
|
||||
sudo vim /etc/exports
|
||||
```
|
||||
|
||||
若需要把 “/nfsroot” 目录设置为 NFS 共享目录,请在该文件末尾添加下面的一行:
|
||||
|
||||
```sh
|
||||
/nfsroot *(rw,sync,no_root_squash) # * 表示允许任何网段 IP 的系统访问该 NFS 目录
|
||||
```
|
||||
|
||||
新建“/nfsroot”目录,并为该目录设置最宽松的权限:
|
||||
|
||||
```sh
|
||||
sudo mkdir /nfsroot
|
||||
# -R 表示递归更改该目录下所有文件
|
||||
sudo chmod -R 777 /nfsroot
|
||||
sudo chown <usr>:<group> /nfsroot/ -R
|
||||
```
|
||||
|
||||
如果修改了 exports 文件需要通过以下命令使修改生效:
|
||||
|
||||
```sh
|
||||
sudo exportfs -rv
|
||||
```
|
||||
|
||||
## 使能/启动 NFS 服务
|
||||
|
||||
```sh
|
||||
sudo systemctl enable nfs-kernel-server
|
||||
sudo systemctl start nfs-kernel-server
|
||||
```
|
||||
|
||||
## 停止/禁用 NFS 服务
|
||||
|
||||
```sh
|
||||
sudo systemctl stop nfs-kernel-server
|
||||
sudo systemctl disable nfs-kernel-server
|
||||
```
|
||||
|
||||
## 挂载 NFS 文件系统
|
||||
|
||||
```sh
|
||||
sudo mount -t nfs <nfs server ip>:/nfsroot /mnt -o nolock
|
||||
```
|
||||
|
||||
## 查看状态
|
||||
|
||||
```sh
|
||||
# 查看NFS的运行状态
|
||||
sudo nfsstat
|
||||
# 查看rpc执行信息,可以用于检测rpc运行情况
|
||||
sudo rpcinfo
|
||||
```
|
Loading…
Reference in New Issue