How to Change Hostname on Ubuntu 25.10

Displaying the Current Hostname

To find out your current system hostname, run the following command:

hostnamectl

Output:

root@server:~# hostnamectl
 Static hostname: server
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 7e3c835b73b44f50a7e676144e993199
         Boot ID: 9b87d53f88f142d6a6b44b93e2aa3f54
    Product UUID: ab5e548c-fe08-4f6f-82c8-cd8ac4b87875
  Virtualization: kvm
Operating System: Ubuntu 25.10                          
          Kernel: Linux 6.12.0-5-generic
    Architecture: x86-64
 Hardware Vendor: Red Hat
  Hardware Model: KVM
Firmware Version: 1.16.0-4.module_el8.8.0+3612+f18d2b89
   Firmware Date: Tue 2014-04-01
    Firmware Age: 11y 6month 16d

Changing the System Hostname

Once you know the current hostname, change it using the command below:

hostnamectl set-hostname vps.crowncloud.net

Replace vps.crowncloud.net with your desired hostname.

Now, update the /etc/hosts file to reflect your new hostname.

nano /etc/hosts

Edit the file to look like this:

127.0.0.1 localhost
127.0.1.1 vps.crowncloud.net

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

If cloud-init is installed on your Ubuntu 25.10 system, modify the following file to preserve the hostname change:

nano /etc/cloud/cloud.cfg

Find the line:

preserve_hostname: false

Change it to:

preserve_hostname: true

Save the file and exit.

Verify the Change

Finally, verify the hostname has been successfully updated:

hostnamectl

Output:

root@server:~# hostnamectl
 Static hostname: vps.crowncloud.net
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 7e3c835b73b44f50a7e676144e993199
         Boot ID: 9b87d53f88f142d6a6b44b93e2aa3f54
    Product UUID: ab5e548c-fe08-4f6f-82c8-cd8ac4b87875
  Virtualization: kvm
Operating System: Ubuntu 25.10                          
          Kernel: Linux 6.12.0-5-generic
    Architecture: x86-64
 Hardware Vendor: Red Hat
  Hardware Model: KVM
Firmware Version: 1.16.0-4.module_el8.8.0+3612+f18d2b89
   Firmware Date: Tue 2014-04-01
    Firmware Age: 11y 6month 16d

Your system hostname has now been successfully updated on Ubuntu 25.10.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS