Centos 6
永久修改
这个需要修改系统内的文件
vi /etc/sysconfig/network
把hostname的值修改为想要的就可以了
Centos 7
1)开启虚拟机
1>输入命令 net.ifnames=0 biosdevname=0
2>输入用户名root 密码....
3>点击编辑 选择虚拟网络编辑器 更改设置 VMnet8 子网 192.168.56.0
4>虚拟机中输入以下命令
ip a 查看2是否有eth0
cd /etc/sysconfig/network-scripts/
vi ifcfg-eth0
BOOTPROTD=static //点i就能编辑
DEFRDNS=yes
PEERDNS=no
PEERROUTES=yes
IPV_4....=no
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.56.11
NETMASK=255.255.255.0
GATEWAY=192.168.56.2
按esc键,然后shift+: 然后wq!+enter
Ctrl+z+z
5>关闭防火墙
systemctl disable firewalld
systemctl disable NetworkManager
查看防火墙状态: systemctl status firewalld.service
停止防火墙工作: systemctl stop firewalld.service
永久关闭防火墙: systemctl disable firewalld.service
确认SELinux处于关闭状态
vim /etc/sysconfig/selinux
SELINUX=disabled
6>设置DNS解析
vi /etc/resolv.conf
nameserver 192.168.56.2
ping www.baidu.com -c 4
7>设置主机名称
vim /etc/hostname
controller
8>设置主机名解析
vim /etc/hosts
修改为以下内容
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.11 controller
192.168.56.21 compute1
9、修改主机上的hosts--为了后面网页登陆大数据,用域名
打开C:\Windows\System32\drivers\etc
用记事本打开hosts
在最后加上虚拟机中大数据节点的ip映射
192.168.1.3 bigdata3
192.168.1.4 bigdata4
192.168.1.5 bigdata5
192.168.1.6 bigdata6