How-To Update Your Hostname Before cPanel Is Installed.

  WHM

Introduction

A hostname is the unique name that identifies your server on a network (for example: server1.yourdomain.com). Before installing cPanel, it is very important to set a proper Fully Qualified Domain Name (FQDN) hostname.

cPanel strictly checks the hostname during installation. If it is not correctly configured, installation may fail or later cause mail/DNS issues.

Prerequisites

Before changing the hostname, ensure you have:

  • Root access to the server (SSH login)
  • A valid domain name (e.g., yourdomain.com)
  • A properly created A record pointing hostname → server IP
  • Example:
    • server1.yourdomain.com → YOUR_SERVER_IP

IMPLEMENTATION

When installing cPanel to your new server, a check is performed to see if an FQDN (fully-qualified domain name) is set up as the hostname. If this hostname is not valid, the installation will fail at that point. 

Your hostname (mycpanel.hostname) is invalid, and must be 
set to a fully qualified domain name before installing cPanel. 

A fully qualified domain name must contain two dots, and consists of two parts: the hostname and the domain name. 
You can update your hostname by running `hostname your-hostname.example.com`, then re-running the installer. 
********************* ERROR ********************* 
Exiting...

You can update the hostname through a couple of different methods through the command line, but the following directions are to use ‘hostnamectl,’ which is available for the majority of the OSes cPanel Supports.

Procedure

You can verify your current hostname by running the hostname command: 

~# hostname
mycpanel.hostname

Step 1: Use set-hostname to Change the Hostname

Type the following command:

hostnamectl set-hostname new-hostname

Be sure to use your own hostname choice instead of new-hostname

*Make sure the new hostname the requirements for an FQDN.

Effective Hostname Usage With cPanel & WHM

Step 2: Use hostnamectl to Confirm the Change

When the command is successful, ‘hostnamectl set-hostname does not produce any output.

Therefore, use ‘hostnamectl’ to check the result.

~# hostnamectl
Static hostname: server.mycpanel.net
Icon name: computer-vm
Chassis: vm
Machine ID: 25e1cd57343e45ba9385a719b7233809
Boot ID: f671cce601254c1f83d61a0007ed8cb6
Virtualization: kvm
Operating System: Ubuntu 20.04.2 LTS
Kernel: Linux 5.4.0-77-generic
Architecture: x86-64

Conclusion

Setting the correct hostname before installing cPanel is a critical first step in server setup. A properly configured FQDN ensures smooth installation, avoids email delivery issues, and prevents DNS conflicts later.

If you set the hostname correctly and ensure DNS resolution works, cPanel installation will proceed without errors.

LEAVE A COMMENT