hostname -i, does not resolve to IP of machine

Hi,

I'm installing the portal (developer services). I need to instal Postgres. The first parameter in the Postgres config file is this:

# Must resolve to IP address or DNS name of host - not to 127.0.0.1 or localhost.
HOSTIP=$(hostname -i)

From my servers cmd line (this is Centos 7), I get this:

[root@localhost ~]# hostname -i

::1 127.0.0.1

Which id not good according to the comment. So what do I need to do so that it does resolve to the Ip of the system, or to an alias in /etc/hosts?

Thanks, Sam

0 2 363
2 REPLIES 2

Which is not good...

Hi,

I ended up using this:

HOSTIP=$(hostname -all-ip-addresses)

This resolved to the IP. I'm running this on a VM that will only have 1 IP.

Thanks, Sam