统信安装nfs服务实现文件共享
1. 服务端
root@user-PC:~# sudo apt-get install nfs-kernel-server
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
fbterm imageworsener libc-ares2 libde265-0 libheif1 liblqr-1-0 libmaxminddb0 libqtermwidget5-0 libsbc1 libsmi2ldbl libspandsp2 libutf8proc2 libwireshark-data
libwireshark11 libwiretap8 libwscodecs2 libwsutil9 qtermwidget5-data squashfs-tools
使用'sudo apt autoremove'来卸载它(它们)。
将会同时安装下列软件:
keyutils libnfsidmap2 nfs-common rpcbind
建议安装:
open-iscsi watchdog
下列【新】软件包将被安装:
keyutils libnfsidmap2 nfs-common nfs-kernel-server rpcbind
升级了 0 个软件包,新安装了 5 个软件包,要卸载 0 个软件包,有 232 个软件包未被升级。
需要下载 478 kB 的归档。
解压缩后会消耗 1,570 kB 的额外空间。
您希望继续执行吗? [Y/n] y
获取:1 https://enterprise-packages.chinauos.com/server-enterprise fou/sp3/main mips64el libnfsidmap2 mips64el 0.25-5.1 [30.0 kB]
获取:2 https://enterprise-packages.chinauos.com/server-enterprise fou/sp3/main mips64el keyutils mips64el 1.6-6 [50.8 kB]
获取:3 https://enterprise-packages.chinauos.com/server-enterprise fou/sp3/main mips64el rpcbind mips64el 1.2.5-0.3+deb10u1 [46.1 kB]
获取:4 https://enterprise-packages.chinauos.com/server-enterprise fou/sp3/main mips64el nfs-common mips64el 1:1.3.4-2.5+deb10u1+rebuild [226 kB]
获取:5 https://enterprise-packages.chinauos.com/server-enterprise fou/sp3/main mips64el nfs-kernel-server mips64el 1:1.3.4-2.5+deb10u1+rebuild [125 kB]
已下载 478 kB,耗时 4秒 (129 kB/s)
正在选中未选择的软件包 libnfsidmap2:mips64el。
(正在读取数据库 ... 系统当前共安装有 177266 个文件和目录。)
准备解压 .../libnfsidmap2_0.25-5.1_mips64el.deb ...
正在解压 libnfsidmap2:mips64el (0.25-5.1) ...
正在选中未选择的软件包 keyutils。
准备解压 .../keyutils_1.6-6_mips64el.deb ...
正在解压 keyutils (1.6-6) ...
正在选中未选择的软件包 rpcbind。
准备解压 .../rpcbind_1.2.5-0.3+deb10u1_mips64el.deb ...
正在解压 rpcbind (1.2.5-0.3+deb10u1) ...
正在选中未选择的软件包 nfs-common。
准备解压 .../nfs-common_1%3a1.3.4-2.5+deb10u1+rebuild_mips64el.deb ...
正在解压 nfs-common (1:1.3.4-2.5+deb10u1+rebuild) ...
正在选中未选择的软件包 nfs-kernel-server。
准备解压 .../nfs-kernel-server_1%3a1.3.4-2.5+deb10u1+rebuild_mips64el.deb ...
正在解压 nfs-kernel-server (1:1.3.4-2.5+deb10u1+rebuild) ...
正在设置 rpcbind (1.2.5-0.3+deb10u1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/rpcbind.service → /lib/systemd/system/rpcbind.service.
Created symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket → /lib/systemd/system/rpcbind.socket.
正在设置 keyutils (1.6-6) ...
正在设置 libnfsidmap2:mips64el (0.25-5.1) ...
正在设置 nfs-common (1:1.3.4-2.5+deb10u1+rebuild) ...
Creating config file /etc/idmapd.conf with new version
正在添加系统用户"statd" (UID 120)...
正在将新用户"statd" (UID 120)添加到组"nogroup"...
无法创建主目录"/var/lib/nfs"。
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-client.target → /lib/systemd/system/nfs-client.target.
Created symlink /etc/systemd/system/remote-fs.target.wants/nfs-client.target → /lib/systemd/system/nfs-client.target.
nfs-utils.service is a disabled or a static unit, not starting it.
正在设置 nfs-kernel-server (1:1.3.4-2.5+deb10u1+rebuild) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /lib/systemd/system/nfs-server.service.
Job for nfs-server.service canceled.
Creating config file /etc/exports with new version
Creating config file /etc/default/nfs-kernel-server with new version
正在处理用于 systemd (241.8-1+dde) 的触发器 ...
正在处理用于 man-db (2.8.5-2) 的触发器 ...
正在处理用于 libc-bin (2.28.10-1+dde) 的触发器 ...
root@user-PC:~# sudo apt-get install rpcbind
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
rpcbind 已经是最新版 (1.2.5-0.3+deb10u1)。
rpcbind 已设置为手动安装。
下列软件包是自动安装的并且现在不需要了:
fbterm imageworsener libc-ares2 libde265-0 libheif1 liblqr-1-0 libmaxminddb0 libqtermwidget5-0 libsbc1 libsmi2ldbl libspandsp2 libutf8proc2 libwireshark-data
libwireshark11 libwiretap8 libwscodecs2 libwsutil9 qtermwidget5-data squashfs-tools
使用'sudo apt autoremove'来卸载它(它们)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 232 个软件包未被升级。
root@user-PC:/# cd data
root@user-PC:/data# mkdir sharefiles
## 开机自动挂载
root@user-PC:/data/sharefiles# vim /etc/exports
/data/sharefiles *(rw,sync,no_subtree_check,no_root_squash)
root@user-PC:/data# sudo systemctl restart nfs-kernel-server
root@user-PC:/data# sudo systemctl enable nfs-kernel-server
Synchronizing state of nfs-kernel-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nfs-kernel-server
root@user-PC:/data/sharefiles# showmount -e
Export list for
2.客户端
root@node131:/# sudo apt install -y nfs-common
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
fbterm imageworsener libc-ares2 libde265-0 libheif1 liblqr-1-0 libmaxminddb0 libqtermwidget5-0 libsbc1 libsmi2ldbl libspandsp2 libutf8proc2 libwireshark-data
libwireshark11 libwiretap8 libwscodecs2 libwsutil9 qtermwidget5-data squashfs-tools
使用'sudo apt autoremove'来卸载它(它们)。
将会同时安装下列软件:
keyutils libnfsidmap2 rpcbind
建议安装:
open-iscsi watchdog
下列【新】软件包将被安装:
keyutils libnfsidmap2 nfs-common rpcbind
升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 232 个软件包未被升级。
需要下载 353 kB 的归档。
解压缩后会消耗 1,200 kB 的额外空间。
获取:1 https://enterprise-packages.chinauos.com/server-enterprise fou/sp3/main mips64el libnfsidmap2 mips64el 0.25-5.1 [30.0 kB]
获取:2 https://enterprise-packages.chinauos.com/server-enterprise fou/sp3/main mips64el keyutils mips64el 1.6-6 [50.8 kB]
获取:3 https://enterprise-packages.chinauos.com/server-enterprise fou/sp3/main mips64el rpcbind mips64el 1.2.5-0.3+deb10u1 [46.1 kB]
获取:4 https://enterprise-packages.chinauos.com/server-enterprise fou/sp3/main mips64el nfs-common mips64el 1:1.3.4-2.5+deb10u1+rebuild [226 kB]
已下载 353 kB,耗时 1秒 (398 kB/s)
正在选中未选择的软件包 libnfsidmap2:mips64el。
(正在读取数据库 ... 系统当前共安装有 177266 个文件和目录。)
准备解压 .../libnfsidmap2_0.25-5.1_mips64el.deb ...
正在解压 libnfsidmap2:mips64el (0.25-5.1) ...
正在选中未选择的软件包 keyutils。
准备解压 .../keyutils_1.6-6_mips64el.deb ...
正在解压 keyutils (1.6-6) ...
正在选中未选择的软件包 rpcbind。
准备解压 .../rpcbind_1.2.5-0.3+deb10u1_mips64el.deb ...
正在解压 rpcbind (1.2.5-0.3+deb10u1) ...
正在选中未选择的软件包 nfs-common。
准备解压 .../nfs-common_1%3a1.3.4-2.5+deb10u1+rebuild_mips64el.deb ...
正在解压 nfs-common (1:1.3.4-2.5+deb10u1+rebuild) ...
正在设置 rpcbind (1.2.5-0.3+deb10u1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/rpcbind.service → /lib/systemd/system/rpcbind.service.
Created symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket → /lib/systemd/system/rpcbind.socket.
正在设置 keyutils (1.6-6) ...
正在设置 libnfsidmap2:mips64el (0.25-5.1) ...
正在设置 nfs-common (1:1.3.4-2.5+deb10u1+rebuild) ...
Creating config file /etc/idmapd.conf with new version
正在添加系统用户"statd" (UID 120)...
正在将新用户"statd" (UID 120)添加到组"nogroup"...
无法创建主目录"/var/lib/nfs"。
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-client.target → /lib/systemd/system/nfs-client.target.
Created symlink /etc/systemd/system/remote-fs.target.wants/nfs-client.target → /lib/systemd/system/nfs-client.target.
nfs-utils.service is a disabled or a static unit, not starting it.
正在处理用于 systemd (241.8-1+dde) 的触发器 ...
正在处理用于 man-db (2.8.5-2) 的触发器 ...
正在处理用于 libc-bin (2.28.10-1+dde) 的触发器 ...
root@node131:~/sharefiles# sudo showmount -e 10.17.200.146
Export list for 10.17.200.146:
/data/sharefiles *
root@node131:~# pwd
/root
root@node131:~# mkdir sharefiles
root@node131:~# cd sharefiles/
root@node131:~/sharefiles# pwd
/root/sharefiles
root@node131:~/sharefiles# vim /etc/fstab
10.17.200.146:/data/sharefiles /root/sharefiles nfs defaults 0 0
root@node131:~/sharefiles# mount -a
## 查看挂在的磁盘情况
root@node131:~/sharefiles# df -h
文件系统 容量 已用 可用 已用% 挂载点
udev 32G 0 32G 0% /dev
tmpfs 6.4G 5.4M 6.4G 1% /run
/dev/sdd3 94G 5.8G 83G 7% /
tmpfs 32G 32M 32G 1% /dev/shm
tmpfs 5.0M 16K 5.0M 1% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sdd5 29G 8.1G 19G 30% /recovery
/dev/sdd2 1.5G 49M 1.4G 4% /boot
/dev/sdd1 300M 6.5M 293M 3% /boot/efi
/dev/sdd4 329G 19G 294G 6% /data
tmpfs 6.4G 176K 6.4G 1% /run/user/0
10.17.200.146:/data/sharefiles 329G 2.4G 310G 1% /root/sharefiles
root@node131:~/sharefiles# pwd
/root/sharefiles
root@node131:~/sharefiles# touch 1.txt
root@node131:~/sharefiles# ls -l
总用量 0
-rw-r--r-- 1 root root 0 5月 25 17:55 1.txt
客户端安装
root@node148:~# sudo apt install -y nfs-common
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
nfs-common 已经是最新版 (1:1.3.4-2.5+deb10u1+rebuild)。
nfs-common 已设置为手动安装。
下列软件包是自动安装的并且现在不需要了:
fbterm imageworsener libc-ares2 libde265-0 libheif1 liblqr-1-0 libmaxminddb0 libqtermwidget5-0 libsbc1 libsmi2ldbl libspandsp2 libutf8proc2 libwireshark-data
libwireshark11 libwiretap8 libwscodecs2 libwsutil9 qtermwidget5-data squashfs-tools
使用'sudo apt autoremove'来卸载它(它们)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 232 个软件包未被升级。
root@node148:~# sudo showmount -e 10.173.203.146
Export list for 10.173.203.146:
/data1/sharefiles *
root@node148:~# cd /
root@node148:/# mkdir sharefiles
root@node148:/# sudo mount -t nfs 10.173.203.146:/data1/sharefiles /sharefiles
root@node148:/# vim /etc/fstab
10.173.203.146:/data1/sharefiles /sharefiles nfs defaults 0 0
root@node148:/# mount -a
root@node148:/# df -h
文件系统 容量 已用 可用 已用% 挂载点
udev 32G 0 32G 0% /dev
tmpfs 6.4G 5.9M 6.4G 1% /run
/dev/sdd3 94G 9.0G 80G 11% /
tmpfs 32G 61M 32G 1% /dev/shm
tmpfs 5.0M 16K 5.0M 1% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sdd5 29G 8.1G 19G 30% /recovery
/dev/sdd2 1.5G 49M 1.4G 4% /boot
/dev/sdd1 300M 6.5M 293M 3% /boot/efi
/dev/sdd4 329G 9.0G 303G 3% /data
tmpfs 6.4G 176K 6.4G 1% /run/user/1001
tmpfs 6.4G 128K 6.4G 1% /run/user/0
/dev/sr0 292K 292K 0 100% /media/root/BlackCube
10.173.203.146:/data1/sharefiles 1.8T 76M 1.7T 1% /sharefiles
root@node148:/# cd sharefiles/
root@node148:/sharefiles# touch 148.txt