沉沙
2019-06-14
来源 :
阅读 1369
评论 0
摘要:本篇文章探讨了大数据技术之Linux修改主机名,希望阅读本篇文章以后大家有所收获,帮助大家对相关内容的理解更加深入。
本篇文章探讨了大数据技术之Linux修改主机名,希望阅读本篇文章以后大家有所收获,帮助大家对相关内容的理解更加深入。

"
方法1:修改配置文件(/etc/hostname)
#vim /etc/hostname
centos7
方案2:使用hostnamectl的命令
[cqs@centos7 ~]$hostnamectl status
Static hostname: centos7
Icon name: computer-vm
Chassis: vm
Machine ID: 7c14d614a12042b8ad158b3f4a2b3c10
Boot ID: 04eb3c6a16ff442f871a4463dfdac607
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-514.26.1.el7.x86_64
Architecture: x86-64
[cqs@centos7 ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[cqs@centos7 ~]$ cat /etc/hostname
centos7
[cqs@centos7 ~]$ hostname
centos7
[cqs@centos7 ~]$hostnamectl set-hostname centos7
备注:主机名成功修改后,/etc/hostname文件内容更新为最新主机名,但是/etc/hosts文件中主机名不变,需要手工修改。
方案三:使用nmtui终端工具
打开图形界面进行修改#nmtui
NetworkManag--设定系统主机名-->主机名-->centos7
" 本文由职坐标整理发布,学习更多的相关知识,请关注职坐标IT知识库!
喜欢 | 0
不喜欢 | 1
您输入的评论内容中包含违禁敏感词
我知道了

请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式AI+学习就业服务平台 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号