
9

Linux 更改 hostname 的方式
source link: https://www.80shihua.com/archives/1120
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Linux 更改 hostname 的方式
作者: dreamfly 分类: linux 发布时间: 2016-11-27 21:49
1.假設原本 hostname 為 mail2, 現在想要更改為mail,使用 root 才可以更改 hostname
#su - root
2.將 /etc/hosts 內出現的 mail2 都改成mail
:
127.0.0.1 mail localhost.localdomain localhost
3.將 /etc/sysconfig/network 內的 HOSTNAME 改成mail
NETWORKING=yesHOSTNAME=mail
GATEWAY=192.168.15.21
4.再使用 hostname 命令指定一次
#hostname mail
5.這時就已經設定完成. 可以使用 hostname 命令去確認一次
[root@mail2 etc]# hostnamemail
[root@mail2 etc]#
6.只要重新登入, 命令提示字串就會改成 [root@mail etc]#
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK