AWS EC2更改hostname

现在的很多教程都是参考官方的wiki写的,但是wiki里面写的很清楚支持Amazon Linux,各大教程改个标题就说Ubuntu 这么改,centos 这么改等等。。

对于正常的主机,确实是改下/etc/hostname就可以显示我们想要的主机名的,但是AWS EC2 比较奇葩,hostname 都是开机时自动从云端获取并写道/etc/hostname中,这就是为什么直接修改/etc/hostname无效的原因

对于centos 来说,要用hostnamectl命令来修改hostname

sudo hostnamectl set-hostname --static www.iamhippo.com

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.