How to Set or Change Hostname on CentOS 7

To change hostname on CentOS 7, follow these steps:

Step 1 : Check current hostname

Step 2 : Set new hostname

Step 3 : Verify the change

Step 4 : Update /etc/hosts with the new hostname

Add or modify the line:

Step 5 : Reboot your system

Congratulations! You have successfully set or changed the hostname on CentOS 7.