NFS服务
1、修改两个节点的名称:
hostnamectl set-hostname nfs-server
hostnamectl set-hostname nfs-client
修改好后Ctrl+D 回车重登CRT
2、查看主机名信息:
hostnamectl
3、挂载:
mkdir /opt/centos(创建目录)
mount /dev/cdrom /opt/centos(挂载)
4、配置yum源:
cd /etc/yum.repos.d/
ls
mv * /media/(移走文件)
ls
vi local.repo(进入local.repo编辑)
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
yum list
yum install nfs-utils rpcbind (安装)
【以上两个节点都一样】
[root@nfs-server ~]# mkdir /mnt/test
vi /etc/exports
/mnt/test/ 192.168.100.0/24(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501)
exportfs -r
systemctl start rpcbind
systemctl start nfs
showmount -e 192.168.100.10
( showmount命令:显示被客户挂载的目录名。 -e或--exports)
setenforce 0
systemctl stop firewalld (关闭防火墙)
[root@nfs-client ~]#
hostnamectl
setenforce 0
systemctl stop firewalld
mount -t nfs 192.168.100.10:/mnt/test /mnt/
df -h
cd /mnt/
ll
touch abc.txt
md5sum abc.txt
[root@nfs-server ~]#
cd /mnt/test/
ll
md5sum abc.txt