# 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="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&#x26;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&#x26;token=5abca7f0-1c94-499f-ac3f-8a558d8c2bda" alt=""><figcaption><p>ออกจาก Instance แล้วเข้าสู่ Instance ใหม่อีกครั้ง</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-epc.gitbook.io/ncs-documents/compute/compute-instance/how-to-change-compute-instance-hostname.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
