[Linux][hostname] – (Redhat / Fedora / CentOS) 更改 hostname 的方式

Step 1:假設原本 hostname 為 NS, 現在想要更改為 NSx64
使用 root 才可以更改 hostname
    # su – root

Step 2:將 /etc/hosts 內出現的 NS 都改成 NSx64
    # vi /etc/hosts:
    127.0.0.1 NSx64 localhost.localdomain localhost

Step 3:
將 /etc/sysconfig/network 內的 HOSTNAME 改成 NSx64
    # vi /etc/sysconfig/network
    NETWORKING=yes
    HOSTNAME=NSx64

Step 4:再使用 hostname 命令指定一次
# hostname NSx64
這時就已經設定完成. 可以使用 hostname 命令去確認一次
# hostname
NSx64
只要重新登入, 命令提示字串就會改成 [root@NSx64 /]#

Filed under Linux · Tagged with

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!