> 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

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

## 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="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2F8hpswd4ImqbRtnJmyURQ%2FScreen%20Shot%202566-12-01%20at%2014.32.59.png?alt=media&amp;token=37859683-0162-4481-a1bc-684d8d52a3c0" alt=""><figcaption><p>เปลี่ยน hostname ของ Instance และตรวจสอบ hostname ที่เปลี่ยนไป</p></figcaption></figure>

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2FUcQhuexmudAvXULbLq01%2FScreen%20Shot%202566-12-01%20at%2014.42.31.png?alt=media&amp;token=5abca7f0-1c94-499f-ac3f-8a558d8c2bda" alt=""><figcaption><p>ออกจาก Instance แล้วเข้าสู่ Instance ใหม่อีกครั้ง</p></figcaption></figure>
