一,配置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

NFS配置的更多相关文章

  1. NFS 配置服务

    NFS 配置服务 北京市海淀区  张俊浩 一.NFS.即网络文件系统(Network File System,NFS).一种使用于分散式文件系统的协议,由升阳公司开发.于1984年向外发布.功能是通过 ...

  2. 某电商网站线上drbd+heartbeat+nfs配置

    1.环境 nfs1.test.com 10.1.1.1 nfs2.test.com 10.1.1.2 2.drbd配置 安装drbd yum -y install gcc gcc-c++ make g ...

  3. Nginx负载均衡NFS配置

    Nginx配置 首先在两台服务器上部署同一个项目,例如下: 测试网站节点1: http://192.168.168.61/nfstest/ 测试网站节点2: http://192.168.64.145 ...

  4. NFS配置不当导致的那些事儿

    NFS(Network File System):是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源: NFS配置:(声明:以下NFS实验是在RedHat7上 ...

  5. Linux:NFS配置

    NFS配置 1.创建分享的文件:touch /var/www/html/aa.txt2.查看是否安装NFS:rpm -qa|grep nfs3.查看IP地址:ifconfig4.配置NFS:vi /e ...

  6. Redhat Linux NFS配置

    Linux下,All deviceis file,所有的设备都是文件.当我们需要把某些文件夹就或者文件共享给其他用户,就可以使用网络文件系统. 本文介绍Redhat Linux下的NFS配置. 在使用 ...

  7. NFS介绍 NFS服务端安装配置 NFS配置选项

    NFS 介绍 • NFS是Network File System的缩写 • NFS最早由Sun公司开发,分2,,4三个版本,2和3由Sun起草开发,.0开始Netapp公司参与并主导开发,最新为4.1 ...

  8. CentOS6.6下DRBD+HeartBeat+NFS配置

    一.DRBD配置 Distributed Replicated Block Device(DRBD)是一个用软件实现的.无共享的.服务器之间镜像块设备内容的存储复制解决方案. 我们可以理解为它其实就是 ...

  9. NFS介绍、服务端安装配置、NFS配置选项

    6月21日任务 14.1 NFS介绍14.2 NFS服务端安装配置14.3 NFS配置选项 14.1 NFS介绍 14.2 NFS服务端安装配置 1.首先需要2台机器,一台是服务端,一台是客户端,分别 ...

  10. centos7下NFS配置

    NFS是Network File System的缩写,即网络文件系统.客户端通过挂载的方式将NFS服务器端共享的数据目录挂载到本地目录下. 前言 四台机器: ,218三台机器的/root/filedi ...

随机推荐

  1. Oracle Commit 方式 COMMIT WRITE batch NOWAIT;

    1111 CREATE OR REPLACE PROCEDURE update_hav_tpnd IS  CURSOR hav_tpnd_cur IS    SELECT d.hav_tpnd, d. ...

  2. tensorflow 学习1 环境搭建

    1. 下载Anaconda(首选官网,但很慢) Anaconda2-4.0.0-Linux-x86_64.sh Anaconda 安装包还可以到 https://mirrors.tuna.tsingh ...

  3. Android 通过按钮弹出系统菜单(通过Button显示菜单)转

    myButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { openOpti ...

  4. Haproxy+asp.net +RedisSessionStateProvider 完美实现负载均衡,并且session保持

    .net framework 4.5下测试成功,使用RedisSessionStateProvider 2.2.1保持session数据,通过Haproxy保持会话数据.首先在PM下安装RedisSe ...

  5. Linux下的GNU Emacs 24命令_信息竞赛使用_C++

    C代表Ctrl,M代表Alt 一.文件命令 C-x b 新建 build C-x C-f 打开文件 find C-s 保存文件 save C-x C-w 另存为 为wei w C-x C-b 打开所有 ...

  6. AX2012 常用表关系(客户地址,联系信息)

    //客户地址信息 static void CustAddressInformation(Args _args) { CustTable custTable; DirPartyTable dirPart ...

  7. leetcode-【简单题】Two Sum

    题目: Given an array of integers, return indices of the two numbers such that they add up to a specifi ...

  8. PHP中使用Session配合Javascript实现文件上传进度条功能

    Web应用中常需要提供文件上传的功能.典型的场景包括用户头像上传.相册图片上传等.当需要上传的文件比较大的时候,提供一个显示上传进度的进度条就很有必要了. 在PHP .4以前,实现这样的进度条并不容易 ...

  9. css固定div头部不随滚动条滚动

    给div加浮动: position:fixed; 固定宽度,高度,距离头部,左部为0:width: 99%; height: 80px; top:0; left: 0;

  10. yum 介绍

    yum是一个用于管理rpm包的后台程序,用python写成,可以非常方便的解决rpm的依赖关系.在建立好yum服务器后,yum客户端可以通过 http.ftp方式获得软件包,并使用方便的命令直接管理. ...