CentOS - Hostname Change



Hostname Change

There are 4 steps in a hostname change, luckily all the steps are easy.

Sysconfig/Network

Open the /etc/sysconfig/network file with your favorite text editor. Modify the HOSTNAME= value to match your FQDN host name.

# sudo nano /etc/sysconfig/network
HOSTNAME=myserver.domain.com

Hosts File

Change the host that is associated to your main IPaddress for your server, this is for internal networking (found at /etc/hosts):

change hostname centos


Run Hostname

The 'hostname' command will let you change the hostname on the server that the commandline remembers, but it will not actively update all programs that are running under the old hostname.

Servere dedicate , Hosting Profesional


Restart Networking

At this point all the necessary changes that needed to be made have been made, you will want to restart networking on your server to make sure that changes will be persistent on reboot:

# /etc/init.d/network restart





  • 1705 Users Found This Useful
Was this answer helpful?

Related Articles

Custom php settings when you enable Fast-CGI

When you enable fast-cgi, there should be a custom php.ini in the cgi-bin folder of the account.*...

Disk quota exceeded: mailbox is full

Issue:Email fails with the following error message.===Subject: Mail delivery failed: returning...

Can I edit DNS records from my CPanel?

You can edit DNS records from your CPanel by following the instructions in the two CPanel...

What Is A Reverse PTR Record?

PTR record or more appropriately a reverse PTR record is a process of resolving an IP address to...

Why Do You Need A Reverse PTR Record?

The most common use for looking up a PTR record is done by spam filters. Concept behind this idea...