Linux配置主机名和映射

1. 查看主机名:

hostname
uname -n

2. 修改主机名

sudo vim /etc/hostname

Centos7
sudo hostnamectl set-hostname  hadoop-master

3. 配置映射

sudo vim  /etc/hosts

添加
ip hostname

//如:
192.168.100.21  hadoop-master

4. 重启网络

sudo service restart network

Centos7
sudo systemctl restart network

5. 检测

ping hostname

如:
ping hadoop-master

 

你可能感兴趣的:(Linux)