> For the complete documentation index, see [llms.txt](https://docs-epc.gitbook.io/ncs-documents/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-epc.gitbook.io/ncs-documents/compute/compute-instance/how-to-change-compute-instance-hostname.md).

# How to change Compute Instance hostname

## Prerequisite

* Instance ที่ต้องการเปลี่ยน hostname ใช้งาน OS ดังต่อไปนี้ Ubuntu 18.04-22.04, AlmaLinux 8, Rocky Linux 8 และ CentOS 7-8

## Instruction

## 1. เข้าสู่  Instance ที่ต้องการเปลี่ยน hostname

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

## 2. ใช้ command ดังต่อไปนี้ เพื่อเปลี่ยน hostname

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

## 3. หากต้องการตรวจสอบ hostname หลังเปลี่ยนสำเร็จ ใช้ command ดังต่อไปนี้ หรือออกจาก Instance แล้วเข้าสู่ Instance ใหม่อีกครั้ง

```
$ hostnamectl
```

<figure><img src="/files/aM4X5Nfqu3hCM92SBlYZ" alt=""><figcaption><p>เปลี่ยน hostname ของ Instance และตรวจสอบ hostname ที่เปลี่ยนไป</p></figcaption></figure>

<figure><img src="/files/XlJKUMCGAjm7rgGjKzJN" alt=""><figcaption><p>ออกจาก Instance แล้วเข้าสู่ Instance ใหม่อีกครั้ง</p></figcaption></figure>
