Tech Junkie Blog - Real World Tutorials, Happy Coding!: Networking: Changing the Hostname in Linux

Monday, May 24, 2021

Networking: Changing the Hostname in Linux

 When you are planning and configuring your server farm, one of the most common task will probably be changing your server names to fit your organization's naming convention.  In this post we are going to change one of our Linux hostname with the hostnamectl command.  Here are the steps to change your Linux hostname.

1.  Open a terminal session on the host that you want to change the hostname, then type the command hostnamectl the hostname information will be displayed, as you can see the hostname is currently localhost.localdomain


2.  Let's see we want to change the name of the server to dc.acmebanking.com because this is the server for our company ACME Banking Inc.  and we want this server to be the domain controller hence the letters dc. to label it as the domain controller.  Some people like to be creative and use movie characters or attractions as the server names.  It's a matter of preference, but I like to look at a server name and know exactly what it's for.  But it's really up to you.

3. Now what you want to do is type in the following command, to change the hostname

hostnamectl set-hostname 'dc.acmebanking.com'

4. Type hostnamectl again to verify that the hostname has been changed



No comments:

Post a Comment

Search This Blog