Setting your hostname and resolving the network

The process of setting the hostname is typically associated with the installation process. If you ever need to change it or your server's Domain Name System (DNS) resolver, this recipe will show you how.

Getting ready

To complete this recipe, you will require a working installation of the CentOS 7 operating system with root privileges, and a console-based text editor of your choice.

How to do it...

To begin this recipe, we shall start by accessing the system as root and opening the following file in order to name or rename your current server's hostname:

  1. Log in as root and type in the following command to see the current hostname:
    hostnamectl status
    
  2. Now, change the hostname value to your preferred name. ...

Get Linux: Powerful Server Administration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.