100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > CentOS8 NFS配置部署

CentOS8 NFS配置部署

时间:2024-06-16 23:25:43

相关推荐

CentOS8 NFS配置部署

网络文件系统部署

NFS简介NFS部署实践服务端配置创建共享目录编辑NFS服务程序配置文件启动和启用NFS服务程序重要总结客户端配置查询NFS服务器共享信息结果显示

NFS简介

NFS网络文件系统是一种用于在linux系统中共享资源的服务软件。

特点:

基于TCP/IP协议,服务于linux之间资源共享将远程主机上共享资源挂载到本地目录,使得像使用本地资源一样使用共享文件。

NFS部署实践

CentOS8中默认安装了nfs-utils软件包。

服务端配置

创建共享目录

步骤:

创建共享目录设置目录权限,确保其他人有写入权限

[root@MyCentOS home]# mkdir nfs_database[root@MyCentOS home]# chmod 777 nfs_database[root@MyCentOS home]# cd nfs_database/[root@MyCentOS nfs_database]# ll总用量 0[root@MyCentOS nfs_database]# echo "this is nfs database test !!" > nfs_test.txtecho "this is nfs database test ll" > nfs_test.txt

编辑NFS服务程序配置文件

NFS配置文件中默认没有任何内容。

定义要共享的目录与相应权限格式:

共享文件路径 允许访问的NFS客户端

配置文件路径/etc/exports

---------------------------------------------------------NFS配置文件参数-------------------------------------------------------

/home/nfs_database 192.168.127.* (rw,async,root_squash) 《《《允许该IP地址范围内的所有主机访问NFS共享资源文件夹

启动和启用NFS服务程序

在使用NFS服务之前,首先需要调用RPC服务程序将NFS服务器IP地址和端口号信息发送给客户端。

步骤:

重启并启用rpc服务程序启动NFS服务程序将两个程序都加入到开启自动项中

[root@MyCentOS home]# systemctl restart rpcbind[root@MyCentOS home]# systemctl enable rpcbind[root@MyCentOS home]# systemctl start nfs-server[root@MyCentOS home]# systemctl enable nfs-serverCreated symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/system/nfs-server.service.

重要总结

在完成上述配置之后,一定要注意查看当下防火墙和SELinux安全上下文

每当部署一个服务之后一定要将该服务添加到防火墙中进行放行。部署nfs服务不仅需要nfs服务软件包,还需要rpc-bind服务和mountd服务。因为nfs服务需要向客户端广播地址和端口信息,nfs客户端需要使用mount对远程nfs服务器目录进行挂载。

十分重要:在向防火墙添加服务后一定要使用firewall-cmd --reload进行更新

[root@MyCentOS home]# firewall-cmd --permanent --zone=internal --add-service=nfssuccess[root@MyCentOS home]# firewall-cmd --permanent --zone=internal --add-service=rpc-bindsuccess[root@MyCentOS home]# firewall-cmd --permanent --zone=internal --add-service=mountdsuccess[root@MyCentOS home]# firewall-cmd --reload success

客户端配置

查询NFS服务器共享信息

使用showmount命令查询NFS服务器共享信息

输出格式:共享目录名称 允许使用的客户端地址

--------------------------------------------------------showmount参数----------------------------------------------------------

在linux系统中部署nfs客户端,另以linux系统是Ubuntu系统。

安装nfs客户端

root@ubuntu:~# apt-get install nfs-common

查询远程nfs服务器是否能够连通

root@ubuntu:~# showmount -e 192.168.127.200Export list for 192.168.127.200:/home/nfs_database (everyone)

创建本地nfs专用共享目录

root@ubuntu:~# mkdir nfs_database

将远程nfs服务器共享目录挂载到本地创建的nfs共享目录

root@ubuntu:~# mount -t nfs 192.168.127.200:/home/nfs_database nfs_database

释义:

-t 参数表示使用的是TCP协议nfs 表示为nfs服务192.168.127.200:/home/nfs_database 表示远程nfs服务器资源共享目录nfs-database 表示本地资源共享目录 将挂载信息写入到客户端fstab文件中

192.168.127.200:/home/nfs_database /nfs_database nfs defaults 0 0

结果显示

root@ubuntu:~# cd nfs_database/root@ubuntu:~/nfs_database# lltotal 8drwxrwxrwx 2 root root 26 8月 14 15:49 ./drwx------ 6 root root 4096 8月 14 19:44 ../-rw-r--r-- 1 root root 29 8月 14 15:49 nfs_test.txtroot@ubuntu:~/nfs_database# cat nfs_test.txtthis is nfs database test created by CentOS8 !!

bingo ! ! ! ! ! !

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。
相关阅读
linux nfs 配置_centos7 NFS 配置

linux nfs 配置_centos7 NFS 配置

2024-03-02

Centos7部署NFS-V4

Centos7部署NFS-V4

2021-06-02

Centos配置NFS

Centos配置NFS

2024-03-22

Centos 7 配置 NFS

Centos 7 配置 NFS

2020-07-02