If you need to change your system’s hostname, use hostname or hostnamectl commands.

<pre lang="bash">hostname servername
hostnamectl set-hostname servername

You can add the hostname to these 2 files and reboot.

<pre lang="bash">vi /etc/hostname
vi /etc/hosts
reboot

Without a reboot. Add the hostname to these 2 files.

<pre lang="bash">vi /etc/hostname
vi /etc/hosts

And add a hostname entry to 127.0.0.1 in /etc/hosts.

<pre lang="bash">127.0.0.1 servername

That’s all she wrote.