How to Set or Change Hostname in CentOS 7

    Posted in Linux Servers on Oct 31, 2018

    to change or set a CentOS 7 machine hostname, use the hostnamectl

    hostnamectl set-hostname your-new-hostname

    hostname command you can also use hostnamectl command to display a Linux machine hostname

    hostnamectl

    New hostname, a system reboot is required, issue one of the below commands in order to reboot a CentOS 7 machine

    init 6
    systemctl reboot
    shutdown -r