CentOS下的NFS安装、配置、启动及mount挂载方法
主要说明centos配置nfs服务详细步骤,及mount挂载方法。
服务端配置
1. 安装nfs-utils和rpcbind
1 |
yum install nfs-utils rpcbind |
2.设置开机启动服务
1 2 |
chkconfig nfs on chkconfig rpcbind on |
3.启动相关服务
1 2 |
service rpcbind start service nfs start |
4.创建共享目录
1 2 |
mkdir -p /export/primary mkdir -p /export/secondary |
5.编辑/etc/exports文件添加如下内容
1 2 |
vi /etc/exports /export*(rw,async,no_root_squash,no_subtree_check) |
6.刷新配置立即生效
1 |
exportfs -a |
客户端配置
1. 安装nfs-utils和rpcbind
1 |
yum install nfs-utils rpcbind |
2.设置开机启动服务
1 2 |
chkconfig nfs on chkconfig rpcbind on |
3.启动相关服务
1 2 |
service rpcbind start service nfs start |
4.创建挂载点
1 2 |
mkdir -p /mnt/primary mkdir -p /mnt/secondary |
5.挂载目录
1 2 |
mount -t nfs server_ip:/export/primary /mnt/primary mount -t nfs server_ip:/export/secondary /mnt/secondary |
6.查看挂载的目录
1 |
df -h |
7.卸载挂载的目录
1 2 |
umount /mnt/primary umount /mnt/secondary |
8.编辑/etc/fstab,开机自动挂载
1 2 3 |
vi /etc/fstab server_ip:/export/primary/mnt/primary nfs rw,tcp,intr 0 1 server_ip:/export/secondary/mnt/secondary nfs rw,tcp,intr 0 1 |
或者编辑/etc/rc.d/rc.local
1 2 3 4 |
vi /etc/rc.d/rc.local #写入以下命令 mount -t nfs server_ip:/export/primary /mnt/primary mount -t nfs server_ip:/export/secondary /mnt/secondary |