How do I set the hostname on CentOS ?

In order to set the hostname on CentOS you will need to change the HOSTNAME section within /etc/sysconfig/network
Your hostname will now be updated once you logout and then back in. Its also worth noting that this will survive reboots.

About the Author


R Donato

Rick Donato is the Founder and Chief Editor of He currently works as an SDN/NFV Solutions Architect and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001