The process of setting the hostname is typically associated with the installation process. If you ever need to change it or your server's Domain Name System (DNS) resolver, this recipe will show you how.
To complete this recipe, you will require a working installation of the CentOS 7 operating system with root privileges, and a console-based text editor of your choice.
To begin this recipe, we shall start by accessing the system as root and opening the following file in order to name or rename your current server's hostname:
Log in as root and type in the following command to see the current hostname:
hostnamectl status
Now, change the hostname value to your preferred name. For example, if you want to call your server
jimi
, you would type (change appropriately):hostnamectl set-hostname jimi