How to Change Server Hostname on CentOS Server Print

  • 0

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

Example:
Code: [Select]
nano /etc/sysconfig/network
Code: [Select]
HOSTNAME=myserver.domain.com

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

BEFORE
# cat /etc/hosts
127.0.0.1  localhost.localdomain localhost

AFTER (add main server ip and hostname)
# cat /etc/hosts
127.0.0.1  localhost.localdomain localhost 
199.199.199.199 myserver.domain.com myserver

3.
From command line
Code: [Select]
hostname
hostname myserver.domain.com
 

Was this answer helpful?

« Back