centos how to change hostname code example
Example 1: set hostname centos 7
hostnamectl set-hostname <mention the host name>
Example 2: centos change hostname
# hostnamectl set-hostname your-new-hostname
Example 3: linux change hostname
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot