Use this guide to learn how to rename your CoreOS server from the command line.
This guide uses olddog for the old hostname and newtricks for the new hostname.
Connect to your FCOS instance and change to the root user.
$ sudo su - root
Check the hostname with hostname
.
# hostname
olddog
You can also use hostnamectl
.
# hostnamectl
Static hostname: olddog
Icon name: computer-vm
Chassis: vm
Machine ID: 257f49f8befd44caade69b87d7b39b22
Boot ID: 5e111bff48644734988905c7cad7161b
Virtualization: kvm
CPE OS Name: cpe:/o:fedoraproject:fedora:32
Kernel: Linux 5.7.8-200.fc32.x86_64
Architecture: x86-64
Change the hostname to newtricks.
# hostnamectl set-hostname newtricks
Reboot the server.
# reboot
Test your change with hostnamectl
and hostname
.
$ hostnamectl
Static hostname: newtricks
Icon name: computer-vm
Chassis: vm
Machine ID: 00c6efc1008d46aabeed06a3b8a459ec
Boot ID: 539da7ee88a1499db77d3ef8b82b7a72
Virtualization: kvm
Kernel: Linux 5.4.0-26-generic
Architecture: x86-64
$ hostname
newtricks
Your server hostname is changed and ready to use. This procedure does not change your DNS name, and you'll need to perform those steps at your domain registrar.