How to change hostname in CentOS

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 theHOSTNAME= 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):


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.

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
Esta resposta lhe foi útil?

Artigos Relacionados

Adding and viewing IP addresses on CentOS servers

To add newly assigned IP addresses from SSH, follow this procedure: (Please follow the steps...

How to Backup VOS3000 Database and download to your local PC

Login to your server Via SSH ( You can use Putty...

How to Change SSH Port in Centos

Login into your Server Via Putty or any SSH client.type in following commandvi...

How to Reset Mysql passowrd

Step # 1 : Stop mysql service # /etc/init.d/mysql stopOutput: Stopping MySQL database server:...

Linux OS login software [putty]

Please click the link for download Putty software.  If this is not working then copy and paste...