如果你想部署一个nfs-server来用,只是TM的简单用一用,从现在开始,把你之前看到的网页全部关掉!!!!
如果没有docker那就装一个,作为只想使用工具的人,有多好用,试试就知道了,下面的步骤装个docker,一键的那种!!!
curl -sSL https://get.daocloud.io/docker | sh && curl -L https://get.daocloud.io/docker/compose/releases/download/v2.6.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
开启linux内核支持
# 临时生效
modprobe nfs
modprobe nfsd
# 永久生效
tee -a /etc/modules-load.d/modules.conf <<'EOF'
modprobe nfs
modprobe nfsd
EOF
创建一个nfs的文件夹,内部创建一个data文件夹,nfs文件夹下创建文件`docker-compose.yml`,写入下面内容
version: "2"
services:
nfs:
image: erichough/nfs-server:latest
container_name: nfs-server
user: root:root
privileged: true
restart: always
environment:
NFS_EXPORT_1: '/nfs *(ro,no_subtree_check)'
volumes:
- ./data:/nfs
#- ./exports.txt:/etc/exports:ro
- /etc/localtime:/etc/localtime:ro
network_mode: host
然后执行 `docker-compose up -d`