This article is intended for Linux server administrators who need to change the hostname of their server. If your server is hosted with and managed by Maxer, please contact our support team and we can do this for you. Do not attempt these steps if you are unsure.
Your server hostname should always be a fully qualified domain name (FQDN), for example:
server1.example.com
For cPanel servers
On cPanel servers, the recommended method is to change the hostname in WHM:
-
Log in to WHM as root.
-
Navigate to:
WHM » Home » Networking Setup » Change Hostname -
Enter the new hostname (for example
server1.example.com
) and click Change.
After changing the hostname, you must resync your cPanel license to ensure it matches the new hostname. Run this command via SSH as root:
For non-cPanel servers with a control panel
If you are using a different control panel (e.g. Plesk, DirectAdmin, Webmin), refer to the official documentation for that panel. Each control panel has its own method for changing the system hostname.
For servers without a control panel
On a standard Linux server, you can change the hostname directly from the command line.
Temporary change (until reboot):
Permanent change (across reboots):
-
On systemd-based distributions (CentOS 7+, AlmaLinux, Rocky Linux, Ubuntu 16.04+):
-
On older distributions (without
hostnamectl
):-
Edit
/etc/hostname
and replace the old hostname with the new one. -
Edit
/etc/hosts
and update the hostname entry. -
Apply the change:
-
✅ Your server hostname is now updated.
Updated by SP on 02/10/2025