一,配置nfs服务端

nfs服务端IP:192.168.1.10

1,安装nfs

[root@localhost ~]# yum install -y nfs-utils
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
cdrom | 4.1 kB ::
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 :1.3.-.el7 will be installed
--> Processing Dependency: libtirpc >= 0.2.- for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libevent for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libnfsidmap for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: quota for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: rpcbind for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libevent-2.0.so.()(64bit) for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libnfsidmap.so.()(64bit) for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libtirpc.so.()(64bit) for package: :nfs-utils-1.3.-.el7.x86_64
--> Running transaction check
---> Package libevent.x86_64 :2.0.-.el7 will be installed
---> Package libnfsidmap.x86_64 :0.25-.el7 will be installed
---> Package libtirpc.x86_64 :0.2.-0.3.el7 will be installed
---> Package quota.x86_64 :4.01-.el7 will be installed
--> Processing Dependency: quota-nls = :4.01-.el7 for package: :quota-4.01-.el7.x86_64
--> Processing Dependency: tcp_wrappers for package: :quota-4.01-.el7.x86_64
---> Package rpcbind.x86_64 :0.2.-.el7 will be installed
--> Running transaction check
---> Package quota-nls.noarch :4.01-.el7 will be installed
---> Package tcp_wrappers.x86_64 :7.6-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================
Installing:
nfs-utils x86_64 :1.3.-.el7 cdrom k
Installing for dependencies:
libevent x86_64 2.0.-.el7 cdrom k
libnfsidmap x86_64 0.25-.el7 cdrom k
libtirpc x86_64 0.2.-0.3.el7 cdrom k
quota x86_64 :4.01-.el7 cdrom k
quota-nls noarch :4.01-.el7 cdrom k
rpcbind x86_64 0.2.-.el7 cdrom k
tcp_wrappers x86_64 7.6-.el7 cdrom k Transaction Summary
============================================================================================================================================================================
Install Package (+ Dependent packages) Total download size: 1.1 M
Installed size: 3.4 M
Downloading packages:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total MB/s | 1.1 MB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libtirpc-0.2.-0.3.el7.x86_64 /
Installing : rpcbind-0.2.-.el7.x86_64 /
Installing : :quota-nls-4.01-.el7.noarch /
Installing : tcp_wrappers-7.6-.el7.x86_64 /
Installing : :quota-4.01-.el7.x86_64 /
Installing : libevent-2.0.-.el7.x86_64 /
Installing : libnfsidmap-0.25-.el7.x86_64 /
Installing : :nfs-utils-1.3.-.el7.x86_64 /
Verifying : :nfs-utils-1.3.-.el7.x86_64 /
Verifying : libtirpc-0.2.-0.3.el7.x86_64 /
Verifying : libnfsidmap-0.25-.el7.x86_64 /
Verifying : libevent-2.0.-.el7.x86_64 /
Verifying : tcp_wrappers-7.6-.el7.x86_64 /
Verifying : :quota-nls-4.01-.el7.noarch /
Verifying : :quota-4.01-.el7.x86_64 /
Verifying : rpcbind-0.2.-.el7.x86_64 / Installed:
nfs-utils.x86_64 :1.3.-.el7 Dependency Installed:
libevent.x86_64 :2.0.-.el7 libnfsidmap.x86_64 :0.25-.el7 libtirpc.x86_64 :0.2.-0.3.el7 quota.x86_64 :4.01-.el7 quota-nls.noarch :4.01-.el7
rpcbind.x86_64 :0.2.-.el7 tcp_wrappers.x86_64 :7.6-.el7 Complete!

2,配置nfs服务端

[root@localhost ~]# mkdir /nfs          //创建共享目录
[root@localhost nfs]# vim /etc/exports /nfs 192.168..* (rw,sync,root_squash) //分别是共享目录、允许访问的客户端、权限(读写、同步内存和硬盘数据、映射root用户为匿名用户)

3,启动nfs服务端

[root@localhost nfs]# systemctl is-enabled nfs-server  //查看"nfs-server"是否开机启动
disabled
[root@localhost nfs]# systemctl enable nfs-server //将"nfs-server"加入开机启动
ln -s '/usr/lib/systemd/system/nfs-server.service' '/etc/systemd/system/nfs.target.wants/nfs-server.service'
[root@localhost nfs]# systemctl is-enabled rpcbind //查看"rpcbind"是否加入开机启动,"nfs-server"依赖于"rpcbind"
enabled
[root@localhost nfs]# systemctl restart rpcbind
[root@localhost ~]# showmount -e //查看是否共享成功
Export list for localhost.localdomain:
/nfs (everyone)
 

二,通过客户端验证

1,安装nfs-utils

[root@localhost ~]# yum -y install nfs-utils
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 :1.3.-.el7 will be installed
--> Processing Dependency: libtirpc >= 0.2.- for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libevent for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libnfsidmap for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: quota for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: rpcbind for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libevent-2.0.so.()(64bit) for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libnfsidmap.so.()(64bit) for package: :nfs-utils-1.3.-.el7.x86_64
--> Processing Dependency: libtirpc.so.()(64bit) for package: :nfs-utils-1.3.-.el7.x86_64
--> Running transaction check
---> Package libevent.x86_64 :2.0.-.el7 will be installed
---> Package libnfsidmap.x86_64 :0.25-.el7 will be installed
---> Package libtirpc.x86_64 :0.2.-0.3.el7 will be installed
---> Package quota.x86_64 :4.01-.el7 will be installed
--> Processing Dependency: quota-nls = :4.01-.el7 for package: :quota-4.01-.el7.x86_64
--> Processing Dependency: tcp_wrappers for package: :quota-4.01-.el7.x86_64
---> Package rpcbind.x86_64 :0.2.-.el7 will be installed
--> Running transaction check
---> Package quota-nls.noarch :4.01-.el7 will be installed
---> Package tcp_wrappers.x86_64 :7.6-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
nfs-utils x86_64 :1.3.-.el7 cdrom k
Installing for dependencies:
libevent x86_64 2.0.-.el7 cdrom k
libnfsidmap x86_64 0.25-.el7 cdrom k
libtirpc x86_64 0.2.-0.3.el7 cdrom k
quota x86_64 :4.01-.el7 cdrom k
quota-nls noarch :4.01-.el7 cdrom k
rpcbind x86_64 0.2.-.el7 cdrom k
tcp_wrappers x86_64 7.6-.el7 cdrom k Transaction Summary
================================================================================
Install Package (+ Dependent packages) Total download size: 1.1 M
Installed size: 3.4 M
Downloading packages:
--------------------------------------------------------------------------------
Total MB/s | 1.1 MB :
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libtirpc-0.2.-0.3.el7.x86_64 /
Installing : rpcbind-0.2.-.el7.x86_64 /
Installing : :quota-nls-4.01-.el7.noarch /
Installing : tcp_wrappers-7.6-.el7.x86_64 /
Installing : :quota-4.01-.el7.x86_64 /
Installing : libevent-2.0.-.el7.x86_64 /
Installing : libnfsidmap-0.25-.el7.x86_64 /
Installing : :nfs-utils-1.3.-.el7.x86_64 /
Verifying : :nfs-utils-1.3.-.el7.x86_64 /
Verifying : libtirpc-0.2.-0.3.el7.x86_64 /
Verifying : libnfsidmap-0.25-.el7.x86_64 /
Verifying : libevent-2.0.-.el7.x86_64 /
Verifying : tcp_wrappers-7.6-.el7.x86_64 /
Verifying : :quota-nls-4.01-.el7.noarch /
Verifying : :quota-4.01-.el7.x86_64 /
Verifying : rpcbind-0.2.-.el7.x86_64 / Installed:
nfs-utils.x86_64 :1.3.-.el7 Dependency Installed:
libevent.x86_64 :2.0.-.el7 libnfsidmap.x86_64 :0.25-.el7
libtirpc.x86_64 :0.2.-0.3.el7 quota.x86_64 :4.01-.el7
quota-nls.noarch :4.01-.el7 rpcbind.x86_64 :0.2.-.el7
tcp_wrappers.x86_64 :7.6-.el7 Complete!

2,启动"rpcbind"和"nfs-server",并加入开机启动

3,挂载服务端的nfs共享目录"/nfs"到客户端"/mnt/nfs"下

[root@localhost ~]# showmount -e 192.168.1.10  //查看可用共享文件
Export list for 192.168.1.10:
/nfs (everyone)
[root@localhost ~]# mkdir /mnt/nfs
[root@localhost ~]# mount -t nfs 192.168.1.10:/nfs /mnt/nfs
[root@localhost ~]# ls /mnt/nfs/ [root@localhost ~]# cat /mnt/nfs/
hello

或者将挂载信息写入"/etc/fstab"中,开机自动挂载

[root@localhost ~]# vim /etc/fstab

#
# /etc/fstab
# Created by anaconda on Sat Feb ::
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(), findfs(), mount() and/or blkid() for more info
#
/dev/mapper/rhel-root / xfs defaults
UUID=8d922f42-25a9-42aa-aee2-6e29b1ac7f1a /boot xfs defaults
/dev/mapper/rhel-swap swap swap defaults
/dev/cdrom /media/cdrom iso9660 defaults
192.168.1.10:/nfs /mnt/nfs nfs defaults

最新文章

  1. HTML2
  2. POJ 3278 题解
  3. Python黑客编程基础3网络数据监听和过滤
  4. Web安全之点击劫持(ClickJacking)
  5. 链接器工具错误 LNK2026 XXX模块对于 SAFESEH 映像是不安全的
  6. SQL2000的三种“故障还原模型”
  7. APICloud全面支持WiFi真机同步和实时预览功能
  8. 学习练习 java面向对象梯形面积
  9. 《squid网卡代理的实现》RHEL6.3——条理清晰,步骤明确
  10. MongoDB启动配置等
  11. js编码规范
  12. 灵活运用Zend框架
  13. /proc/kcore失效,调试其文件系统相关模块,使重新正常工作
  14. Java第十一周学习总结
  15. 通过 JS 实现简单的拖拽功能并且可以在特定元素上禁止拖拽
  16. idea git提交时候提示 --author 'java_suisui' is not 'Name ' and matches no existing author
  17. SSH和SSM对比总结
  18. IDEA下Maven的Offline Mode
  19. Spark技术的总结 以及同storm,Flink技术的对比
  20. linux杀掉tomcat应用进程。停止tomcat应用

热门文章

  1. Android OpenCV 图像识别
  2. angular.js input
  3. vi编辑器的简单使用
  4. 对ASP.NET运行机制之 一般处理程序ashx的学习
  5. windows下python3.4安装scikit-learn
  6. NHibernate和 FluentNHibernate
  7. Good Bye 2013 A
  8. nodejs Express 4.x req.body req.query req.params 三种获取参数的方法
  9. XML操作总结
  10. 通过AngularJS实现图片上传及缩略图展示