Dev License: This installation of WHMCS is running under a Development License and is not authorized to be used for production use. Please report any cases of abuse to abuse@whmcs.com

How to change a server's hostname in CentOS

By default, your server is started with the server’s given name as the hostname. Some software, such as cPanel, requires a valid Fully Qualified Domain Name (FQDN) for the hostname to be used during their licensing verification system. This article describes how to change a server hostname in CentOS.

Change a server’s hostname

  1. Using a text editor, open the server’s /etc/sysconfig/network file.

     # sudo nano /etc/sysconfig/network
    
  2. Modify the HOSTNAME= value to match your FQDN hostname.

     HOSTNAME=myserver.domain.com
    
  3. 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
    
  4. 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.

     [root@defiant ~]# hostname hostname.domain.com
    
     [root@defiant ~]# hostname
    
     hostname.domain.com
    
     [root@defiant ~]#
    
  5. Restart networking on your server to ensure that changes will persist on restart.

     # /etc/init.d/network restart
War diese Antwort hilfreich?

Verwandte Artikel

Find spam script location with Exim

Sometimes you can have a "tell a friend" feature on your website, or other type of email...

How to change the primary IP addres of a WHM/cPanel server

This is for CentOS/RHEL based servers. Steps in WHM: Log into WHM and go to Basic cPanel...

How to change file/folder permissions in linux cent os

Using SSH (Putty) > Login as root enter the following code to Change all permissions for...

clamAV installed, but not working on the command line and appears to not be installed

On 11.40+ You may try to install ClamAV and then see it have problems when trying to run on...

Exim Remove All messages From the Mail Queue

Question: I'm using Exim mail server under CentOS Linux. How do I remove all messages from the...

Powered by WHMCompleteSolution