锋盈数科-知识库 Logo
首页
软件开发
计算机基础
Hello Halo
新手必读
关于本知识库
登录 →
锋盈数科-知识库 Logo
首页 软件开发 计算机基础 Hello Halo 新手必读 关于本知识库
登录
  1. 首页
  2. 软件开发
  3. Linux
  4. linux nfs 服务启用以及开发权限配置

linux nfs 服务启用以及开发权限配置

0
  • Linux
  • 发布于 2024-09-20
  • 0 次阅读
黄健
黄健

文章出处:http://www.linuxidc.com/Linux/2014-05/101165.htm

RHEL6.4 NFS文件共享服务器搭建

相关阅读:

Ubuntu 12.04安装NFS server http://www.linuxidc.com/Linux/2012-09/70728.htm

NFS服务器安装配置实现Ubuntu 12.04与ARM文件共享 http://www.linuxidc.com/Linux/2012-10/73159.htm

Ubuntu搭建nfs服务器 http://www.linuxidc.com/Linux/2012-10/71930.htm

文件服务器NFS配置详解 http://www.linuxidc.com/Linux/2013-06/86542.htm

Ubuntu下搭建NFS网络文件系统服务器 http://www.linuxidc.com/Linux/2013-07/87367.htm

Heartbeat_ldirector+LB+NFS实现HA及LB、文件共享 http://www.linuxidc.com/Linux/2013-06/85292.htm

CentOS 5.5配置NFS服务器教程 http://www.linuxidc.com/Linux/2013-03/81737.htm

Ubuntu 12.10下NFS的安装使用 http://www.linuxidc.com/Linux/2013-03/80478.htm

1 实验方案

使用2台RHEL6.4虚拟机,其中一台作为NFS共享服务器(192.168.100.1)、另外一台作为测试用的NFS客户机(192.168.100.2)

2.实现

2.1.配置NFS共享服务器。

1)安装软件包及创建共享目录。

[root@nfs-server \~]# rpm -q rpcbind nfs-utils

rpcbind-0.2.0-11.el6.x86_64

nfs-utils-1.2.3-36.el6.x86_64

[root@nfs-server \~]# mkdir /nfstest

[root@nfs-server \~]# echo “test file” > /nfstest/nfs.txt //创建测试文件

[root@nfs-server \~]# ls -ld /nfstest //查看测试目录权限

drwxr-xr-x. 2 root root 4096 Apr 14 07:18 /nfstest

2)修改nfs主配置文件/etc/exports,添加/nfstest共享设置。

[root@nfs-server \~]# vim /etc/exports

[root@nfs-server \~]# cat /etc/exports

/nfstest 192.168.100.2(rw,sync,no_root_squash) //设置为只对192.168.100.2用户读写权限,并同步写入内存与硬盘,开放客户端使用root身份

3)启用NFS相关服务程序。

rpcbind和nfs服务均启动成功后,执行showmount -e可查看本机当前已发布的共享资源列表:

[root@nfs-server \~]# service rpcbind start

[root@nfs-server \~]# service nfs start

[root@nfs-server \~]# chkconfig rpcbind on //设置开机启动服务

[root@nfs-server \~]# chkconfig nfs on

[root@nfs-server \~]# chkconfig –list rpcbind //确保服务开机启动

rpcbind 0:off1:off2:on3:on4:on5:on6:off

[root@nfs-server \~]# chkconfig –list nfs

nfs 0:off1:off2:on3:on4:on5:on6:off

[root@nfs-server \~]# showmount -e localhost //查看本机发布共享资源

Export list for localhost:

/nfstest 192.168.100.2

2.2使用NFS客户机,查看及访问/nfstest共享。

1)客户端也需要安装相应软件

[root@client01 \~]# rpm -q rpcbind nfs-utils

rpcbind-0.2.0-11.el6.x86_64

nfs-utils-1.2.3-36.el6.x86_64

2)从客户机上查看服务器的NFS共享资源列表。

客户机必须安装了nfs-utils软件包,才能使用showmount命令查看NFS资源:

[root@client01 \~]# showmount -e 192.168.100.1

Export list for 192.168.100.1:

/nfstest 192.168.100.2

3)从客户机192.168.100.2上挂载/nfstest共享,并测试读写权限。

[root@client01 \~]# mount 192.168.100.1:/nfstest /mnt //将共享目录挂载到本地mnt目录下

[root@client01 \~]# cd /mnt; ls

nfs.txt

[root@client01 mnt]# cd

[root@client01 \~]# cd /mnt;ls

nfs.txt

[root@client01 mnt]# touch aa.txt //测试写入权限

[root@client01 mnt]# ll

total 4

-rw-r–r–. 1 root root 0 Apr 14 07:40 aa.txt

-rw-r–r–. 1 root root 10 Apr 14 07:18 nfs.txt

4)设置开机后自动挂载NFS共享资源。

[root@client01 \~]# vim /etc/fstab

192.168.100.1:/nfstest /mnt nfs defaults 0 0 //文件类型为nfs

[root@client01 \~]# umount /mnt

[root@client01 \~]# mount -a

[root@client01 \~]# mount \| tail -n 1

192.168.100.1:/nfsteston /mnt type nfs (rw,vers=4,addr=192.168.100.1,clientaddr=192.168.100.2) //开机自动挂载成功

更多RedHat相关信息见RedHat 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=10

本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-05/101165.htm

本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http://www.linuxidc.com/Linux/2014-05/101165.htm

原文链接: https://blog.csdn.net/javajingling/article/details/47171135

标签: #Linux 85
相关文章

【Linux】如何用shell脚本一键安装Java和Maven环境 2024-10-08 11:24

Shell脚本安装环境 前言 脚本 * Java安装脚本 * 使用方式 Java卸载脚本 Maven安装脚本 Maven卸载脚本 前言 无论是在云服务器上部署Java项目 还是在本地的Linux虚拟机上运行Java项目 都需要Java的环境 设置环境则需要一些繁琐的操作 为了简化并复用这些操作 我们

linux 网卡配置 2024-09-30 17:34

linux网卡可以通过命令和配置文件配置,如果是桌面环境还可以通过图形化界面配置. 1.ifconfig(interfaces config)命令方式 通常需要以root身份登录或使用sudo以便在Linux机器上使用ifconfig工具。依赖于ifconfig命令中使用一些选项属性,ifconfi

【Linux】进程间通信——System V共享内存 2024-09-30 17:34

目录 一、概念和原理 二、API介绍与使用 2.1 shmget 2.2 ftok 2.3 shmat 2.4 shmdt 2.5 shmctl

Linux如何修改时间和时区? 2024-09-30 17:34

Linux 修改时间 修改时区 * 时间修改 时区修改 时间修改 #查看时间 [root@localhost ~]# date 2024年 07月 08日 星期一 17:55:48 JST #设置时间 例:2024-07-08 18:00:00 [root@localhost ~]# date -

CentOS 修改服务器登录密码的完整指南 2024-09-30 17:34

个人名片 🎓作者简介 :java领域优质创作者 🌐个人主页 :码农阿豪 📞工作室 :新空间代码工作室(提供各种软件服务) 💌个人邮箱 :[2435024119@qq.com] 📱个人微信 :15279484656 🌐个人导航网站 :www.forff.top 💡座右铭:总有

虚拟机Ubuntu忘记密码 2024-09-30 17:34

Ubuntu重置密码 因为前几天虚拟机上刚安装的Ubuntu系统,密码忘记了,这次留个笔记记录一下。 有两种情况: 1、第一种 1、虚拟机上的Ubuntu开启,按住Shift键,直到出现下面的界面。(记住,一开启系统就长按Shift) 如果没有出现下面的界面,直接关闭Ubuntu,重新启动。 2、选

目录

IT 外包服务商

  • 意见投递
  • zyf6619

软件开发应用

主菜单

  • 首页
  • 软件开发
  • 计算机基础
  • Hello Halo
  • 新手必读
  • 关于本知识库
Copyright © 2024 your company All Rights Reserved. Powered by Halo.