The hostname is a unique identifier for your server on a network. By default, this name is automatically generated, but it can be changed manually at any time. Changing the server name is a straightforward process that can be completed either via the command line or permanently using `hostnamectl`.


Your VPS has two distinct names: the name displayed within mPanel and the hostname configured within the operating system. To modify the displayed hostname within the mPanel, please refer to this helpdesk article we have on the matter: How to rename services on BinaryLane





TABLE OF CONTENTS




Changing Your Hostname Temporarily (Command-line)


This method changes the hostname temporarily. The new name will revert to the original after a reboot.

1. Open a terminal session on your Ubuntu system.


2. Display your current hostname by running the following command:


hostname



3. Change the hostname by running the following command (replace `new-hostname` with your desired hostname):


hostname new-hostname


4. Verify that the hostname has changed:


hostname



Note: The new hostname will be active only until the next system reboot.


Changing Your Hostname Permanently via `hostnamectl` (Command-line)


To change the hostname permanently, we use the `hostnamectl` utility. This ensures that the hostname persists after a 

reboot.


1. Open a terminal on your Ubuntu system.

2. Run the following command to set a new static hostname (replace `new-hostname` with your desired hostname):


hostnamectl set-hostname new-hostname


For example, to set the hostname to `myserver.example.com`:


hostnamectl set-hostname myserver.example.com



3. You can verify the hostname change and other system information by running:


hostnamectl





If you require assistance, feel free to submit a support ticket at our helpdesk here: Submit a ticket | BinaryLane