CentOS 5 Change Hostname

In this CentOS tutorial we will be showing you how to find and change the hostname of your system.

The assumption is that you are running as root and have a basic understanding of the software required but if you follow this tutorial you should be able to complete the task successfully.

Let us begin by finding the CentOS systems fully qualified domain name (FQDN) by seeing how it identifies itself.

Print the network node hostname

Show the systems DNS domain name

There are a couple of ways to change the hostname.

Edit /etc/sysconfig/network

or run System Config

Select Edit DNS configuration

Edit the hostname and select OK and then Save&Quit

Dont forget to change the hostname in your hosts file

However we’re not finished. The machine wont normally see the updated hostname until about it reboots, but we can force it to update.