Header Ads

How to Change Hostname in CentOS



In our previous post about CentOS we looked at how to upgrade  to CentOS 7.2 from 7.1/7.0 in this tutorial we are going to show you how to simply change and ip address.

When you setup your server for the first time, there is usually a default name given to it which you must change since Some platforms such as cPanel, requires a valid Fully Qualified Domain Name (FQDN) for the hostname to be used during their licensing verification system.


Using a text editor, open the /etc/sysconfig/network file.

Modify the HOSTNAME= value to match your FQDN hostname.

Type # sudo nano /etc/sysconfig/network
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).

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.
Restart networking on your server to ensure that changes will persist on restart.
  1. # /etc/init.d/network restart

No comments:

Powered by Blogger.