Login/Register

How to: Change Hostname on CentOS 7

created by BasicSysAdmin

Tags: Linux, CentOS, CentOS 7

Jun 18, 2016

Introduction

In this guide, I will show you how you can update the hostname on your CentOS machine.
Prerequisites


In order to follow this tutorial, you will need the following

  • Sudo Privileges


  • View current hostname

    You can view your current hostname and additional information by typing in
    hostnamectl


    Changing Hostname

    To change the hostname, you can use this command
    sudo hostnamectl set-hostname "myhostname.domain.tld"

    To see the changes have taken affect, you can use the hostnamectl command. If you would like it to update the terminal window, type in
    bash