构造NFS
一、设备nfs-utils
伺服器:
[root@server05 ftp]# yum install nfs-utils
这时会自己主动安装rpcbind需将此服务重新启动nfs服务才干启动
client安装nfs-utils
二、配置
创建一些文件
[root@server05 /]# mkdir common
[root@server05 /]# cd common/
[root@server05 common]# cp /etc/passwd ./
[root@server05 common]# vim abc
[root@server05 common]# ls
abc passwd
编辑配置文件
[root@server05 ~]# vim /etc/exports
/common 172.168.4.203(rw)
将 /common 共享给172.168.4.203 并赋予rw 权限
重新启动服务
[root@server05 Desktop]# service nfs restart
关闭防火墙:
[root@server05 Desktop]# iptables -F
[root@server05 Desktop]# setenforce 0
在 172.168.4.203 上:
[root@station3 ~]# showmount -e 172.168.4.103
Export list for 172.168.4.103:
/common 172.168.4.203
能够看到 172.168.4.103 共享的文件夹/common
随便一台同网段的机器 :
[root@station3 ~]# showmount -e 172.168.4.103
Export list for 172.168.4.103:
/common 172.168.4.203
都能够看到 所以说NFS是不安全的
在172.168.4.203上挂载common文件夹
[root@station3 /]# cd mnt/
[root@station3 mnt]# ls
hgfs
[root@station3 mnt]# mkdir commonmmnt
[root@station3 mnt]# mount 172.168.4.103:/common /mnt/commonmmnt/
[root@station3 mnt]#
成功挂载
[root@station3 mnt]# cd commonmmnt/
[root@station3 commonmmnt]# ls
abc passwd
能够看到挂载的内容
到172.168.4.103上
[root@server05 Desktop]# vim /etc/exports
改为:
/common 172.168.4.0/24(rw,sync)
#同一网段的主机都能够挂载 sync代表同步
保存退出
[root@server05 /]# chmod o+w common/
重新启动服务
到172.168.4.203上,卸载并又一次挂载
[root@station3 commonmmnt]# cd ..
[root@station3 mnt]# umount /mnt/commonmmnt/
[root@station3 mnt]# mount 172.168.4.103:/common /mnt/commonmmnt/
[root@station3 commonmmnt]# mkdir nfsdis
[root@station3 commonmmnt]# ls
abc nfsdis passwd
到172.168.4.103上
[root@server05 /]# cd /common/
[root@server05 common]# ls
abc nfsdis passwd
能够看到刚才创建的目录 实现了同步
######################################################################
二、自己主动挂载
在172.168.4.203 上
[root@server05 common]# yum install autofs
配置:
[root@server05 common]# vim /etc/auto.master
在第9行加入
/mnt /etc/auto.nfs
创建/etc/auto.nfs内容为:
abc -fstype=nfs 192.168.4.103:/common/share
以上两个文件配置的意思是:当訪问/mnt时。运行/etc/auto.nfs。将192.168.4.103:/common/share 挂载到本机的abc下,abc的位置是/mnt/abc
重新启动服务
[root@server203 /]# service autofs restart
Stopping automount: [ OK ]
Starting automount: [ OK ]
[root@server203 /]# cd /mnt/abc
[root@server203 abc]# ll
total 4
-rw-r--r--. 1 root root 1913 Oct 11 05:33 passwd
便可看到服务端放在/common/share 下的passwd文件
高级玩法:
将/etc/auto.nfs内容改为:
* -fstype=nfs 192.168.4.103:/common/&
意思是在/mnt下cd到 x ,右边的& 就等于x 就将192.168.4.103:/common/x 挂载到本地的/mnt/x 下,前提是服务端有x所代表的文件
版权声明:本文博主原创文章,博客,未经同意不得转载。
构造NFS的更多相关文章
- Ubuntu 14.1 构造NFS
主办IP:129.1.4.189.目标计算机IP:129.1.22.96 1.运行命令:apt-get install nfs-kernel-server ; 2.运行命令:mkdir /tftpbo ...
- ubuntu12.04下一个samba、tftp、nfs构造
1.samba setting 1>apt-get install samba apt-get install smbfs 2>mkdir /home/linux/shar ...
- 一步一步制作yaffs/yaffs2根文件系统(二)---安装BusyBox,构造/bin、/sbin、/usr、linuxr
开发环境:Ubuntu 12.04 开发板:mini2440 256M NandFlash 64M SDRAM 交叉编译器:arm-linux-gcc 4.4.3点此可下载 BusyBox版本: ...
- mkyaffs2image制作根文件系统、使用NFS挂载虚拟机目录(2)
1.制作根文件系统及nfs烧写 1.1 先解压文件系统,/wok/nfs_root 目录下是已经构造好的各种文件系统:① fs_mini.tar.bz2 是最小的根文件系统,里面的设备节点是事先建立好 ...
- 详解-制作根文件系统,并使用yaffs,jffs,nfs挂载系统(2)
1.安装mkyaffsimage, mkyaffs2image命令(用来制作yaffs文件系统) 第一个命令针对Flash小页512B,第二个针对Flash大页2KB首先下载压缩文件 yaffs_so ...
- 学习笔记:Maven构造版本号的方法解决浏览器缓存问题
需要解决的问题 在做WEB系统开发时,为了提高性能会利用浏览器的缓存功能,其实即使不显式的申明缓存,现代的浏览器都会对静态文件(js.css.图片之类)缓存.但也正因为这个问题导致一个问题,就是资源的 ...
- nfs 笔记 2
http://woxihuanpes.blog.163.com/blog/static/12423219820097139145238/ http://blog.csdn.net/willvc123/ ...
- linux NFS 配置步骤
转载 http://woxihuanpes.blog.163.com/blog/static/12423219820097139145238/ NFS server可以看作是一个FILE SERVER ...
- 一步步构造自己的vue2.0+webpack环境
前面vue2.0和webpack都已经有接触了些(vue.js入门,webpack入门之简单例子跑起来),现在开始学习如何构造自己的vue2.0+webpack环境. 1.首先新建一个目录vue-wk ...
随机推荐
- (ZT)LoadRunner9.0成功破解方法
LoadRunner9.0软件下载地址: http://www.3atesting.com/filedown/LR9Download.exe 破解所需文件 http://download.csdn.n ...
- POJ 3340 & HDU 2410 Barbara Bennett's Wild Numbers(数学)
题目链接: PKU:http://poj.org/problem?id=3340 HDU:http://acm.hdu.edu.cn/showproblem.php?pid=2410 Descript ...
- Linux下Apache PHP Mysql默认安装路径
Apache 假设採用RPM包安装.安装路径应在 /etc/httpd文件夹下 Apache配置文件: /etc/httpd/conf/httpd.conf Apache模块路径: /usr/sbin ...
- 在MVC应用程序中动态加载PartialView
原文:在MVC应用程序中动态加载PartialView 有时候,我们不太想把PartialView直接Render在Html上,而是使用jQuery来动态加载,或是某一个事件来加载.为了演示与做好这个 ...
- [置顶] android系统功能调用大全
1.从google搜索内容 Intent intent = new Intent(); intent.setAction(Intent.ACTION_WEB_SEARCH); intent.pu ...
- Knockout获取数组元素索引的2种方法,在MVC中实现
原文:Knockout获取数组元素索引的2种方法,在MVC中实现 在遍历数组.集合的时候,通常要获取元素的索引,本篇体验使用Knockout获取索引的2种方法. 假设有这样的一个模型: namespa ...
- apache +php +php curl 模块设置
2.2 linux 下面 2.2.1 web服务器安装 1目前采用的web服务器是apache2,在ubuntu 下安装 apt-getupdate apt-get installapache2 测试 ...
- Linux C语言写的超级简单port扫描器
这个本来曾经也写过的,今天无聊复习下 再写一遍.简单的一塌糊涂,写的不咋地大家见谅哦!有空再加强 嘿嘿! #include <stdio.h> #include <stdlib.h& ...
- 对于Web开发来说 8 个最好的跨平台编辑器
1) Best Cross Platform IDE - Brackets Brackets是一个在前端Web开发和设计人员中最流行的开放源代码IDE/代码编辑器之中的一个.它拥有一些有用工具可以将H ...
- STL顺序容器【vector】【deque】【list】
我们都知道,stl在集装箱船分为两类,订购集装箱和相关的容器. 顺序容器有三种即动态数组vector,双端队列deque,以及链表list (对csdn的文字排版严重吐槽.写好的版发表了就变了) 一: ...