Linux hosts主机名不对

Linux的root用户和oracle用户显示的主机名不一致

安装完oracle之后,root用户的主机名为localhost,但是oracle用户的主机名显示bogon。

转载:Linux hosts主机名不对

1、现象:

[root@bogon ~]#
[root@bogon ~]# hostname
bogon

2、查看几个相关文件,都正确

[root@bogon ~]# vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=localhost.localdomain

[root@bogon ~]# vi /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

3、继续,dns的的配置

[root@bogon logs]# vi /etc/resolv.conf
#Generated by NetworkManager
search com (大爷的,这行不知道咋来的,删不掉)
nameserver 10.211.55.1

4、解决:

[root@bogon ~]# hostname localhost
[root@localhost logs]# hostname
localhost

5、若4操作后重启发现hostname又变回去了,如下操作
vi /etc/hosts,追加 本机IP localhost

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.211.55.12 localhost(追加的)

参考:https://www.cnblogs.com/armo/p/6739472.html

posted @ 2024-08-23 17:18  零の守墓人  阅读(9)  评论(0编辑  收藏  举报