DB2 installation issue : The hostname is invalid

During DB2 installation you might get error The hostname is invalid. We get this error if your hostname is not properly configured and mapped to an IP Address which is reachable.

While performing DB2 installation using db2setup command you might get below error screen.

Same solution is valid for error during installation with db2_install command.

To fix this first check your server hostname by executing hostname command

Ping your hostname to check if it responding locally, you will get ping failure.

ping <hostname>

Check /etc/hosts file for mapping for hostname with ip address.

cat /etc/hosts

Correct hostname and IP address mapping in /etc/hosts file by editing /etc/hosts file using vi or any other editor.

After correcting /etc/hosts file, ping your hostname to see if it is responding.

This should fix the issue and you can continue with installation.

If you liked this blog and interested in knowing more about DB2, please subscribe by clicking on Subscribe to ChoudharySumit.com by Email.


  1. I was getting this error! Now it's resolved.
    Thanks for the info!

  2. If like me, on Linux, you are setting up a new machine with a new DB2 instance and the machine has the same hostname as the current active machine, you will get this, as the DNS name will resolve to the old machine and not the new one you are setting up.
    To get around this problem, I put the DNS name in /etc/local with resolution to for the duration of the install.