# How to change Compute Instance hostname

## Prerequisite

* An instance running one of the following operating systems: Ubuntu 18.04-22.04, AlmaLinux 8, Rocky Linux 8, or CentOS 7-8.

## Instruction

## 1. **Access the instance you want to modify**<br>

[SSH to the Linux Instance](https://docs-epc.gitbook.io/ncs-documents/ncs-documents-en/compute/compute-instance/ssh-to-linux-compute-instance).

## 2. **Use the following command to change the hostname**

Replace with your desired new hostname.

```
$ sudo hostnamectl set-hostname <newNameHere>
```

## 3. **To verify the change was successful, use the command below.** Alternatively, you can log out and log back into the instance to see the updated hostname.

```
$ hostnamectl
```

<figure><img src="https://content.gitbook.com/content/4csDFrNQz0Q4tDnx3xyT/blobs/i1X8j7OEAaB8eT4KBWND/Screen%20Shot%202566-12-01%20at%2014.32.59.png" alt=""><figcaption><p>Change the instance's hostname and verify the change.</p></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/4csDFrNQz0Q4tDnx3xyT/blobs/niXDomH3z51twIxLCnbx/Screen%20Shot%202566-12-01%20at%2014.42.31.png" alt=""><figcaption><p>Log out of the instance and then log back in.</p></figcaption></figure>
