Linux搭建nfs服务以及客户端配置
2017-12-19 10:55
567 查看
CentOS 6.5安装配置NFS服务器
OS:centos 6.5
服务端:10.7.8.24
客户端:10.7.8.23
1.服务端配置
[root@nfsclient ~]# rpm -aq nfs-utils rpcbind #检查nfs相关的包如果有这两个包的话使用yum
remove -y卸载 重新安装
yum方式安装,此处统一使用aliyun中centos和epel源
# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
# vim /etc/yum.repos.d/ali.repo
[centos6]
name=centeros6 base
baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/
gpgcheck=0
[epel]
name=epel base
baseurl=http://mirrors.aliyun.com/epel/6/x86_64
gpgcheck=0
安装必须的yum包:
yum -y install nfs-utils rpcbind
创建共享目录:
mkdir /nfs
编辑/etc/exports,注意IP地址和权限配置之间没有空格:
cat /etc/exports
/nfs 10.7.8.23(rw,sync,no_root_squash,no_all_squash)
启动服务,并设置开机启动
service rpcbind start
service nfs start
chkconfignfs on
chkconfig rpcbind on
2.客户端配置
# rpm -aq nfs-utils rpcbind #检查nfs相关的包如果有这两个包的话使用yum
remove -y卸载 重新安装
yum remove -y rpcbind-0.2.0-11.el6.x86_64
yum方式安装,此处统一使用aliyun中centos和epel源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
# vim /etc/yum.repos.d/ali.repo
[centos6]
name=centeros6 base
baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/
gpgcheck=0
[epel]
name=epel base
baseurl=http://mirrors.aliyun.com/epel/6/x86_64
gpgcheck=0
安装必须的yum包:
yum -y install nfs-utils rpcbind、
创建目录:
mkdir /nfs
查看服务端共享的目录:
showmount -e 10.7.8.24
挂载共享目录到本地,并测试读写:
mount -t nfs 10.7.8.24:/nfs /nfs
cd /nfs && touch 123.txt
设置开机自动挂载:
vim /etc/fstab
10.7.8.24:/nfs /nfs nfs defaults 0 0
OS:centos 6.5
服务端:10.7.8.24
客户端:10.7.8.23
1.服务端配置
[root@nfsclient ~]# rpm -aq nfs-utils rpcbind #检查nfs相关的包如果有这两个包的话使用yum
remove -y卸载 重新安装
yum方式安装,此处统一使用aliyun中centos和epel源
# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
# vim /etc/yum.repos.d/ali.repo
[centos6]
name=centeros6 base
baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/
gpgcheck=0
[epel]
name=epel base
baseurl=http://mirrors.aliyun.com/epel/6/x86_64
gpgcheck=0
安装必须的yum包:
yum -y install nfs-utils rpcbind
创建共享目录:
mkdir /nfs
编辑/etc/exports,注意IP地址和权限配置之间没有空格:
cat /etc/exports
/nfs 10.7.8.23(rw,sync,no_root_squash,no_all_squash)
启动服务,并设置开机启动
service rpcbind start
service nfs start
chkconfignfs on
chkconfig rpcbind on
2.客户端配置
# rpm -aq nfs-utils rpcbind #检查nfs相关的包如果有这两个包的话使用yum
remove -y卸载 重新安装
yum remove -y rpcbind-0.2.0-11.el6.x86_64
yum方式安装,此处统一使用aliyun中centos和epel源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
# vim /etc/yum.repos.d/ali.repo
[centos6]
name=centeros6 base
baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/
gpgcheck=0
[epel]
name=epel base
baseurl=http://mirrors.aliyun.com/epel/6/x86_64
gpgcheck=0
安装必须的yum包:
yum -y install nfs-utils rpcbind、
创建目录:
mkdir /nfs
查看服务端共享的目录:
showmount -e 10.7.8.24
挂载共享目录到本地,并测试读写:
mount -t nfs 10.7.8.24:/nfs /nfs
cd /nfs && touch 123.txt
设置开机自动挂载:
vim /etc/fstab
10.7.8.24:/nfs /nfs nfs defaults 0 0
附:/etc/exports文件里读写配置参数含义
rw:read-write,可读写; ro:read-only,只读; sync:同步写入(文件同时写入硬盘和内存),适用在通信比较频繁且实时性比较高的场合 async:异步写入(文件先写入内存,稍候再写入硬盘),性能较好(速度快),适合超大或者超多文件的写入,但有数据丢失的风险,比如突然断电等情况; 注意:除非特別有需要,否则不建议使用 async。如果沒有指定 sync 或 async,NFS 服务器在启动的时候会印出警告信息。 no_root_squash:NFS客户端连接服务端时如果使用的是 root 的话,那么对服务端分享的目录也使用 root 权限。不安全! root_squash:把客户端 root 身份的 UID/GID (0/0) 对应到服务端的 nobody 用户去,即服务端使用 nobody 用户来操作共享目录; all_squash:不论NFS客户端连接服务端时使用什么用户,对服务端分享的目录来说都是拥有匿名用户权限; anonuid:匿名用户的UID值,通常是nobody或nfsnobody,可以在此处自行设定; anongid:匿名用户的GID值。
相关文章推荐
- 【NFS服务搭建】NFS介绍、NFS服务端安装配置、NFS配置选项和客户端挂载
- linux服务___Linux下NFS服务器的搭建与配置
- 搭建nfs共享存储服务之三客户端配置
- Linux下搭建svn以及svn服务配置
- Linux系统下搭建SVN服务以及客户端
- linux学习第五十二篇: exportfs命令,NFS客户端问题,FTP介绍,使用vsftpd搭建ftp服务
- Linux NFS 服务配置及AIX NFS 客户端挂载实施步骤
- 教你如何快速的在linux5.0上为大型公司企业搭建DHCP(动态主机配置)服务以及中继代理服务
- 【服务器搭建环境配置】Linux上部署Nginx服务以及故障排除
- linux搭建nfs服务配置
- Linux搭建—NFS服务的安装与配置
- Linux安装配置maven3.0以及搭建nexus私服
- linux-2.6.32.2 配置NFS服务
- Jprofiler在linux上的安装和配置,以及如何通过windows客户端监控JAVA应用程序
- SUSE以及linux下Telnet服务的配置
- Linux SVN 服务器配置以及客户端使用
- 在linux平台上搭建目前企业公司中基于域名,ip以及端口的虚拟主机apache服务!还有
- Linux安装配置maven3.0以及搭建nexus私服
- linux下的nfs服务配置
- linux下Samba服务和NFS服务配置