Article

Table of Contents
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $300 by adding new articles!

Change Hostname on Fedora CoreOS

Last Updated: Mon, Aug 17, 2020
Best Practices Fedora CoreOS System Admin

Introduction

When creating a new Fedora CoreOS (FCOS) instance, you can set the server hostname in the Ignition file. If you decide to rename a running server, you'll need to update the name from the command line.

Examples

This guide uses olddog for the old hostname and newtricks for the new hostname.

1. Become Root

Connect to your FCOS instance and change to the root user.

$ sudo su - root

2. Check the Current Hostname

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
Operating System: Fedora CoreOS 32.20200731.dev.0
     CPE OS Name: cpe:/o:fedoraproject:fedora:32
          Kernel: Linux 5.7.8-200.fc32.x86_64
    Architecture: x86-64

3. Change Hostname

Change the hostname to newtricks.

# hostnamectl set-hostname newtricks

4. Confirm the Change

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

Update DNS

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.

Want to contribute?

You could earn up to $300 by adding new articles