How to change Linux hostname permanently

0
Matt 12 Rep.

I have changed my Linux server’s hostname using hostname command as follow:

hostname my-newhostname.com

But the problem is, whenever I reboot my server, it is reverting to old hostname again. How can I set permanent hostname?

Kailash selected answer

Best answer

0
Kailash 188 Rep.

hostname command will not change your server’s hostname permanently. If you have latest Linux operating system (systemD based OS), you can do it using hostnamectl command. For complete details, you can refer our following blog post:

How to set or change Hostname in Linux

Kailash selected as best answer
×

Login

Login to see your profile links
Bloom Email Optin Plugin

Users

Kailash
188 Rep. 21 Best 33 Answers 1 Questions
User1984
User1984
59 Rep. 0 Best 0 Answers 24 Questions
Scott
Scott
43 Rep. 6 Best 7 Answers 1 Questions