?
Solved

Do I have to reboot after changing hostname in Ubuntu

Posted on 2009-04-23
6
Medium Priority
?
659 Views
Last Modified: 2013-12-06
I'm changing my hostname on a server running Ubuntu and I read in an article that when you change your hostname it's one of the only times you need to reboot linux. Is this true? As everything seems to run fine after running :

sudo /etc/init.d/hostname.sh stop
sudo /etc/init.d/hostname.sh start
0
Comment
Question by:TotallyMe
  • 3
  • 2
6 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 24221362
I think no need.
0
 
LVL 35

Expert Comment

by:torimar
ID: 24221414
It may be just the other way round:
Your method will work as long as you don't reboot. On reboot, the name will most likely revert (test it, if you can afford to do so).

If you wish to change the hostname for good (which means: persistent to reboots), you will needs have to change the files /etc/hosts and /etc/hostname. Since there may be complications involved in changing them one at a time, check out the following post for two methods of changing both files simultaneously:
http://ubuntuforums.org/showpost.php?p=6325522&postcount=6
0
 

Author Comment

by:TotallyMe
ID: 24221538
Hi torimar, sorry for not explaining better, yes I am changing /etc/hosts and /etc/hostname and it's a script thats doing it so it happens straight away.

But im unsure if I need to reboot after doing this or if restarting the service is fine.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:torimar
ID: 24221577
If restarting the service results in a hostname change, and everything else looks fine, then you don't *have* to reboot, of course not.

But if you can afford to reboot (means: no third-party interests are damaged), I'd still suggest you do so in order to make absolutely sure that your changes will survive a reboot.
There may be conditions out of your reach and control that will result in a reboot (like maintenance work of your hosting provider etc), so it's always better to run a test.
0
 

Author Comment

by:TotallyMe
ID: 24221595
It's persistent across reboots as we've tested this on development servers. But we're unsure if anything else happens during a reboot that the service restart doesn't do. We just wanted to ensure there was nothing we missed.
0
 
LVL 35

Accepted Solution

by:
torimar earned 2000 total points
ID: 24221637
In this case I should say that you are set to go.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question