Vultr DocsLatest Content

How to Change the Hostname of a Vultr Cloud Instance

Updated on 06 November, 2025
Guide
Learn how to change the hostname on CentOS, Fedora, Ubuntu, Debian, FreeBSD, and Windows Server systems without reinstalling or losing data, while ensuring the new name persists across reboots and cloud-init resets.
How to Change the Hostname of a Vultr Cloud Instance header image

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 Customer Portal 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 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
    
  2. Locate the cloud_init_modules section and remove the following directives.

    - set_hostname
    - update_hostname
    - update_etc_hosts

    Save and close the file.

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
  2. 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.

  3. 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
    ...
  4. Reboot the server to apply the changes.

    console
    $ sudo reboot
    
  5. Verify that your hostname changes are reflected on the server.

    console
    $ hostnamectl
    

    Output:

    Static hostname: my-new-hostname
    ...
  6. 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
    ...

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.

Comments