Linux下修改主机名为gpdb
步骤一、运行vi /etc/sysconfig/network命令
NETWORKING=yes
HOSTNAME=gpdb
步骤二、运行hostname gpdb命令
步骤三、运行vi /etc/hosts命令
192.168.1.121 gpdb # Added by NetworkManager
127.0.0.1 localhost.localdomain localhost
::1 gpdb localhost6.localdomain6 localhost6
步骤四、运行reboot命令重新启动电脑后或者使用service network restart命令重新启动网络服务后生效
修改前的/etc/sysconfig/network文件默认内容为
NETWORKING=yes
HOSTNAME=bogon
修改前下的/etc/hosts文件默认内容为
192.168.1.121 bogon # Added by NetworkManager
127.0.0.1 localhost.localdomain localhost
::1 bogon localhost6.localdomain6 localhost6