Recommended Services
Supported Scripts

 

RHEL7/CentOS7 Servers:

Temporary Change (will not sustain a reboot)

Servers hostname can be changed temporarily by running the following command

hostname  new.hostname.here

Permanent Change (Will sustain even after a reboot)

Change the hostname of a server permanently using the hostnamectl utility

hostnamectl set-hostname new.hostname.here

Prior RHEL6/CentOS6 Servers:

Temporary Change (will not sustain a reboot)

Servers hostname can be changed temporarily by running the following command

hostname  new.hostname.here

Permanent Change (Will sustain even after a reboot)

Edit the network file using below command

vi /etc/sysconfig/network

And change the hostname to the desired one and reboot the server to make the permanent hostname change.

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME='new.hostname.here'

Debian/Ubuntu Servers:

Temporary Change (will not sustain a reboot)

Servers hostname can be changed temporarily by running the following command

hostname  new.hostname.here

Permanent Change (Will sustain even after a reboot)

To make a permanent hostname change edit the below file

vi  /etc/hostname

and change the hostname to the desired one and reboot the server

new.hostname.here