Stay Connected
CentOS how to change hostname?
| Print article | This entry was posted by Ivan Versluis on November 21, 2007 at 4:41 pm, and is filed under CentOS. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |

about 1 year ago
# system-config-network
and change hostname under DNS tab, logout then login again would do also.
about 1 year ago
You don’t need to reboot, just logout and login.
about 1 year ago
echo “newhostname” > /proc/sys/kernel/hostname and you dont need to reboot. Reboot is just for new kernel ;D
about 1 year ago
I have changed hostname, on a CentOS 5.3 on VMWare player, but after the change the startup becomes extremely slow, even opening Terminal takes 30s…. I have made sure the entry in the DNS tab in system-config-network is correct, and restarted…. if I restore the previous hostname value (bagvapp) the respose times become normal again…
anybody experiencing the same problem?
about 1 year ago
ah ok I forgot to add the new hostname in the 127.0.0.1 entry in the hosts file…
the procedure is described here:
http://javamonamour.blogspot.com/2009/06/centos-change-hostname-and-ips.html
about 9 months ago
/etc/init.d/network restart will do after change the hostname.
about 8 months ago
And you can also type as root in console: “setup” and then go to “Network Configuration” and edit the DNS config.
And you may want to check your /etc/hosts
about 6 months ago
Thanks guys, but the TheBigK’s solution don’t persist before restart.
The Umarzuki and Bob solutions are OK.
Muchas gracias, Thank to all.
Sorry for my bad english.
about 6 months ago
don’t persist “after” restart… is the correct form…
Sorry again.
Good luck.
about 2 months ago
no need to restart :
hostname -v yourhostname
about 1 month ago
This is a nice guide.
Most control panels have GUI to do this for novice users.
about 1 month ago
edit /etc/sysconfig/network then do service network restart.
about 1 day ago
Thanks MAN its works!!!