---
title: How to Change the Hostname of a Vultr Cloud Instance
url: https://docs.vultr.com/how-to-change-the-hostname-of-a-vultr-cloud-instance
description: Learn the step-by-step process to change the hostname of your Vultr Cloud Instance. This guide covers multiple operating systems and best practices.
publish_date: 2025-11-06T14:47:59.505000Z
last_updated: 2026-04-15T00:00:00.077250Z
author: Aashish Chaurasiya
header_image: https://docs.vultr.com/public/doc-assets/2364/c2a14b87-fa31-4329-a733-4fc93f448c43.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

A hostname is a name that is given to a system within a network to uniquely identify it among other devices. It serves as a human-readable label that simplifies communication, troubleshooting, and management. Instead of remembering **IP addresses**, administrators and users can reference machines using recognizable names like `web01`, `db-server`, or `node1.example.com`.

Hostname are important for:

* DNS resolution
* SSH access
* Monitoring and logging

Changing the hostname is a common task when setting up new servers, applying naming conventions, or preparing systems for production environments.

> [!NOTE]
> Changing the `hostname` using the [Vultr Console](https://console.vultr.com/) triggers a full server reinstall because it uses **cloud-init** to set the hostname during provisioning. This process **erases all data** on the server, including the **operating system** and **files**.

Follow this guide to change the hostname on **CentOS**, **Fedora**, **FreeBSD**, **Ubuntu**, and **Windows Server** without reinstalling the server or losing any data.

## Prerequisites

Before you begin, you need to:

* Have access to a [Linux server](https://www.vultr.com/features/operating-systems/) as a non-root user with sudo privileges.

## Disable the Automatic Hostname Update

To make your hostname changes permanent, remove the hostname related directives from the `/etc/cloud/cloud.cfg` file. This prevents **cloud-init** from resetting the hostname on reboot.

1. Open the `/etc/cloud/cloud.cfg` file using an test editor.

    ```console
    $ sudo nano /etc/cloud/cloud.cfg
    ```

1. Locate the `cloud_init_modules` section and remove the following directives.

    ```
    - set_hostname
    - update_hostname
    - update_etc_hosts
    ```

    Save and close the file.

???+ note "Change Hostname on CentOS and Fedora"

    Follow the steps below to change the `hostname` on RHEL-based distros like CentOS or Fedora.

    1. View the `hostname` of your server.

        ```console
        $ hostname
        ```

        Your output should be similar to the one below:

        ```
        my-hostname
        ```

    1. Change the server `hostname` by running the following command.

        ```console
        $ sudo hostnamectl set-hostname my-new-hostname
        ```

        Replace `my-new-hostname` with the new hostname you want to set.

    1. Update the `/etc/hosts` file with the new `hostname`. Also if you have a DNS entry then the best practice is to update the name in this file as well.

        ```console
        $ sudo nano /etc/hosts
        ```

        After updating, the file should be similar to the one below:

        ```
        ...
        127.0.0.1 my-new-hostname my-new-hostname.example.com
        127.0.0.1 localhost.localdomain localhost
        ...
        ```

    1. Reboot the server to apply the changes.

        ```console
        $ sudo reboot
        ```

    1. Verify that your `hostname` changes are reflected on the server.

        ```console
        $ hostnamectl
        ```

        Output:

        ```
        Static hostname: my-new-hostname
        ...
        ```

    1. Verify that your **hosts** file changes is also reflected.

        ```console
        $ cat /etc/hosts
        ```

        Your output should be similar to the one below:

        ```
        ...
        127.0.1.1 my-new-hostname my-new-hostname.example.com
        127.0.0.1 localhost
        ...
        ```

??? note "Change Hostname on Ubuntu and Debian"

    Follow the steps below to change the hostname on Ubuntu or other Debian-based distributions without reinstalling the system or losing any data.

    1. View the `hostname` of your server.

        ```console
        $ hostname
        ```

        Your output should be similar to the one below:

        ```
        my-hostname
        ```

    1. Change the `hostname` using the `hostnamectl` command.

        ```console
        $ sudo hostnamectl set-hostname my-new-hostname
        ```

        Replace `my-new-hostname` with the new hostname you want to set.

    1. Update the `/etc/hosts` file with the new `hostname`. Also if you have a DNS entry then the best practice is to update the name in this file as well.

        ```console
        $ sudo nano /etc/hosts
        ```

        After updating, the file should be similar to the one below:

        ```
        ...
        127.0.1.1 my-new-hostname my-new-hostname.example.com
        127.0.0.1 localhost
        ...
        ```

    1. Reboot the server to apply the changes.

        ```console
        $ sudo reboot
        ```

    1. After rebooting, verify that the `hostname` and **hosts** file changes are applied.

        ```console
        $ hostnamectl
        $ cat /etc/hosts
        ```

        The above commands should display your new `hostname` in both the system configuration and the `/etc/hosts` file, confirming that the changes are reflected and is persistent.

??? note "Change Hostname on FreeBSD"

    Follow the steps below to change the `hostname` on a FreeBSD system.

    1. View the hostname of your server.

        ```console
        $ hostname
        ```

        Your output should be similar to the one below:

        ```
        my-hostname
        ```

    1. Edit the `/etc/rc.conf` file to update the server `hostname`.

        ```console
        $ sudo vim /etc/rc.conf
        ```

        Your updated configuration file should be similar to the one below:

        ```
        hostname="my-new-hostname"
        sshd_enable="YES"
        ...
        ```

        Replace `my-new-hostname` with the new hostname you want to set.

    1. Update the `/etc/hosts` file to include the new `hostname`.

        ```console
        $ sudo vim /etc/hosts
        ```

        After updating, the file should be similar to the one below:

        ```
        ...
        127.0.0.1 my-new-hostname my-new-hostname.example.com
        ::1       my-new-hostname
        ...
        ```

    1. Reboot your system to apply the changes.

        ```console
        $ sudo reboot
        ```

    1. After reboot, verify that your `hostname` and **hosts** related changes are reflected.

        ```console
        $ hostname
        $ cat /etc/hosts
        ```

        This above commands should display the new `hostname` and your **hosts** file with new changes.

??? note "Change Hostname on Windows Server"

    Follow the steps below to change the hostname on Windows Server using either **PowerShell** or the **graphical** interface.

    > [!NOTE]
    > Before changing the hostname, ensure that no critical roles are already installed. Renaming a system with configured roles such as a **domain** controller or **Exchange** server can lead to conflicts. Always create a snapshot or backup before proceeding.

    ### Change the Hostname Using PowerShell

    Follow the steps below to change the Windows server hostname using Powershell.

    1. Open the Windows PowerShell as an administrator.

    1. View the Windows server hostname.

        ```pwsh
        PS C:\> $env:COMPUTERNAME
        ```

        Output:

        ```
        MY-HOSTNAME
        ```

    1. Change the Windows server hostname.

        ```pwsh
        PS C:\> Rename-Computer -NewName "MY-NEW-HOSTNAME" -Restart
        ```

        Replace `MY-NEW-HOSTNAME` with your desired hostname. The `-Restart` parameter restarts the server to apply the change.

    1. After the system reboots, verify the hostname.

        ```pwsh
        PS C:\> $env:COMPUTERNAME
        ```

        Output:

        ```
        MY-NEW-HOSTNAME
        ```

    ### Change the Hostname Using the Windows GUI

    1. Log in to your server using Remote Desktop (RDP).
    1. Open **File Explorer**, right click **This PC**, and select **Properties**.
    1. In the **Properties** window, go to the **System** section and open the **About** page.
    1. Click the **Rename this PC** button.
    1. Enter the new **hostname** and click **Next**.
    1. Click **Restart now** to restart the server and44444 apply the changes.

## Conclusion

In this guide, you changed the hostname across multiple operating systems without reinstalling your server or losing data. You updated the hostname configuration on CentOS, Fedora, FreeBSD, Ubuntu, and Windows Server using system-specific tools and disabled cloud-init to prevent overwrites. These steps ensured the changes persisted across reboots and followed best practices for system administration.
