2021-04-17

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  (关闭防火墙)

2021-04-17

[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

2021-04-17

上一篇:代码调试(1) 现场代码调试


下一篇:ubuntu16.04 nfs挂载 (虚拟机到板子上)