CentOS 6 NFS的安装配置

查看CentOS版本方法
有以下命令可以查看:

# lsb_release -a

exports文件:
/data/tomcat-/webapps/ROOT 10.0.0.1/8(insecure,rw,sync)
/data/tomcat-/webapps/ROOT 10.0.0.1/8(insecure,rw,sync)


常用
/etc/init.d/nfs start
/etc/init.d/nfs stop
/etc/init.d/nfs reload
service nfs status
exportfs -r
mount
umount 路径


http://blog.chinaunix.net/uid-26284318-id-3111651.html

NFS的安装配置:
centos 5 :
yum install nfs-utils portmap
centos 6 :
yum install nfs-utils rpcbind


本节是使用centos 6的配置过程:
设备:两台 centos6 OS 安装的时候选择的是"Basic Server"软件配置包。
首先,让两台机器都安装NFS的 软件包,如下显示的是服务器端:
$ yum install nfs-utils rpcbind
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
Setting up Install Process
Package rpcbind-0.2.0-8.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.2.3-15.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
nfs-utils x86_64 1:1.2.3-15.el6 base 308 k

Transaction Summary
================================================================================
Install 0 Package(s)
Upgrade 1 Package(s)

Total download size: 308 k
Is this ok [y/N]: y
Downloading Packages:
nfs-utils-1.2.3-15.el6.x86_64.rpm | 308 kB 00:10
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
base/gpgkey | 3.3 kB 00:00 ...
Importing GPG key 0xC105B9DE "CentOS-6 Key (CentOS 6 Official Signing Key) " from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : 1:nfs-utils-1.2.3-15.el6.x86_64 1/2
Cleanup : 1:nfs-utils-1.2.2-7.el6.x86_64 2/2

Updated:
nfs-utils.x86_64 1:1.2.3-15.el6

Complete!
$

服务器端:
###(建立挂载的目录,并且挂载目录。)
$ mkdir /opt/centos6
$ cd /opt/centos6/
$ mkdir thisISnfsFile
$ ls
thisISnfsFile
$ vi /etc/exports
$ cat /etc/exports

/opt/centos6 192.168.1.0/24(ro,no_root_squash)
### 备注:/opt/centos6表示nfs共享的目录 192.168.1.0-192.168.1.254区间的IP可以访问,访问权限是自读,root 用户
###(启动对应的服务)
$ chkconfig nfs on
$ /etc/init.d/rpcbind start
$ /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
$ service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]


客户端:
$ yum install nfs-utils rpcbind
安装完毕!
# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
###查看是否能访问nfs服务
# showmount -e 192.168.1.75
Export list for 192.168.1.75:
/opt/centos6 192.168.1.0/24
# mkdir /opt/centos6
# mount -t nfs 192.168.1.75:/opt/centos6/ /opt/centos6/
# ls /opt/centos6/
thisISnfsFile
###配置开机自动挂载
# vi /etc/fstab
### 添加 #192.168.1.75:/opt/centos6/ /opt/centos6/ nfs nodev,ro,rsize=32768,wsize=32768 0 0

# init 6
#
login as: root
root@192.168.1.116's password:
Last login: Mon Mar 5 17:29:04 2012 from 192.168.1.23
# ls /opt/centos6/
thisISnfsFile
#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值