Linux使用hostnamectl设置大写主机名

Linux通过hostnamectl set-hostname [主机名]设置主机名可以在不重启服务器生效,如果你的主机名里面存在大写字母,它便会自动将大写字母转换为小写,而这并不是我们期望的,问题详见下图:

 

解决办法:

我们可以添加--static参数进行静态设置就可以达到我们期望的效果,不需要重启服务器,配置如下:
hostnamectl set-hostname --static [主机名]

 

Guess you like

Origin blog.csdn.net/weixin_39833509/article/details/119826378