linux查看修改本机域名
最近做postfix本地测试。突然发现不会修改本机本地域名。查了查资料分享一下:
[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
HOSTNAME就是这个了,把他修改了。
[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
[root@localhost ~]# vi /etc/sysconfig/network
[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=linuxdomain
[root@localhost ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
[root@localhost ~]# vi /etc/hosts
[root@localhost ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1 localhost.localdomain localhost
127.0.0.1 linuxdomain localhost
::1 localhost6.localdomain6 localhost6
[root@localhost ~]#
-- 重启 --
查看一下
[root@localhost ~]# hostname