By default, your server is started with the server’s given name as the hostname. This article describes how to change a server hostname in CentOS.
Using a text editor, open the server’s /etc/sysconfig/network file.
# cd /etc/sysconfig # vi network
Modify the HOSTNAME= value to match your FQDN hostname.
HOSTNAME=
HOSTNAME=myserver.domain.com
For internal networking, change the host that is associated with the main IP address for your server (found at /etc/hosts).
127.0.0.1 localhost localhost.localdomain 123.45.67.89 hostname.domain.com hostname -- INSERT -- 2,43-57 ALL
Run the hostname command. This command lets you change the hostname on the server that the command line remembers, but it does not actively update all programs that are running under the old hostname.
hostname
[root@defiant ~]# hostname hostname.domain.com [root@defiant ~]# hostname hostname.domain.com [root@defiant ~]#
Restart networking on your server to ensure that changes will persist on restart.
# /etc/init.d/network restart
Trouble logging in? Simply enter your email address OR username in order to reset your password.
For faster and more reliable delivery, add SupportTeam@TechHausHost.com to your trusted senders list in your email software.