First, see if your host name is set correclty using the following commands:
If the above commands return correctly with no errors then all may be well; however, you may want to read on to verify that all settings are correct.
Normally we will set the hostname of a system during the installation process.
Change the hostname on a running Linux system
On any Linux system you can change its hostname with the command ‘hostname‘.
without any parameter it will output the current hostname of the system.
it will output the fully qualified domain name (or FQDN) of the system.
will set the hostname of the system to NEW_NAME. This is active right away and will remain like that until the system will be rebooted (because at system boot it will set this from some particular file configurations -- see bellow how to set this permanently). You will most probably need to exit the current shell in order to see the change in your shell prompt.
Permanent hostname change on Debian based Linux systems
Debian based systems use the file /etc/hostname to read the hostname of the system at boot time and set it up using the init script /etc/init.d/hostname.sh
So on a Debian based system we can edit the file /etc/hostname and change the name of the system and then run
/etc/init.d/hostname.sh startto make the change active. The hostname saved in this file (/etc/hostname) will be preserved on system reboot (and will be set using the same script we used hostname.sh).
If you want more details check hostname man page
Use sysctl to change the hostname
use sysctl to change the variable kernel.hostname:
to read the current hostname, and
to change it.
If you want more details check sysctl man page
You can use the same process for all debian based distributions and other linux machines