一、查看主机名
在CentOS 7中,我们可以通过hostname
命令查看当前的主机名。
[root@33f ~]# hostname
33f
二、临时修改主机名
我们可以通过命令“hostname 主机名
”来临时修改主机名,当主机重启之后,主机名会自动改成原来的主机名。
[root@33f ~]# hostname centos
[root@33f ~]# hostname
centos
三、永久更改主机名
如果希望永久更改主机名(即重启主机也不会改变),可以有两种方法。
1、方法一:使用hostnamectl命令
我们可以通过命令“hostnamectl set-hostname 主机名
”来永久修改主机名。
[root@33f ~]# hostnamectl set-hostname 33f
[root@33f ~]# hostname
33f
2、方法二:修改主机名文件
除了方法一,还可以通过修改主机名文件(/etc/hostname
)来永久修改主机名。
[root@33f ~]# vi /etc/hostname
33f
版权属于: 三三世界-百宝箱
本文链接: http://33f.net/linux/centos7_change_hostname.html
本文最后更新于2022年04月29日 ,已超过995天没有更新,若内容或图片失效,请留言反馈。
本文允许转载,但请在转载时请以超链接或其它形式标明文章出处
@Doug Shume it's ok for me , you can post here.
Saved as a favorite, I like your website!
If some one wishes to be updated with hottest technologies after that he must be visit this site and be up to date daily.
Heello would you mind sharing which blog platform you're using? I'm planning to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then moost blogs and I'm looking for something completely unique. P.S Apologies forr being off-topic butt I had to ask!
Thanks to my father who shared with me regarding this webpage, this website is genuinely amazing.
Hi, I have an overflow of customers that I'd like to send to you but I want to make sure you can handle more leads, let me know if you'd like me to send you more info.
zh.us.to 有效
kms.03k.org 有效
kms.chinancce.com
kms.shuax.com 有效
kms.dwhd.org 有效
kms.luody.info 有效
kms.digiboy.ir 有效
kms.lotro.cc 有效
www.zgbs.cc 有效
cy2617.jios.org 有效
@ 权限问题,试试sudo 再加命令。
你好提示Permission denied 怎么办啊