A hostname is used to identify a server. The requirements for enabling computers to communicate with each other on a network using the concept of the hostname. Normally the hostname of a System/Server is used to make it easier to identify the host and it will reduce the difficulties to remember the IP address.
This article will guide you on how to change the hostname on Centos, Ubuntu & Debian servers.
To view the current hostname for the server by running the following command:
# hostname
or
# hostnamectl
To update the new hostname of the server using the following command:
Syntax:
# hostname new-serverhostname-name-here
or
# hostnamectl set-hostname new-serverhostname-name-here
NOTE: Replace new-serverhostname-name-here with your new hostname (E.g. server4857testing.com).
Once you have updated the hostname, use the following commands to view the new hostname:
# hostname
or
# hostnamectl
Related Tutorial