Howdy, How do I change the hostname? In particular, what is the difference between /etc/hosts and /etc/sysconfig/network files? Where should I make the changes? Thanks, CS. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20090615/fb9e463a/attachment-0001.html>
On Mon, Jun 15, 2009 at 7:51 PM, Carlos Santana<neubyr at gmail.com> wrote:> Howdy, > > How do I change the hostname? > In particular, what is the difference between /etc/hosts and > /etc/sysconfig/network files? Where should I make the changes? > > Thanks, > CS. > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos > >You should change it in both places, and then run /etc/init.d/network restart to make it effective. /etc/hosts basically tells your own machine on which IP a certain domain resolves to. It's a "scaled down DNS server", and normally only used if you only need to maintain a few hosts on a network. /etc/sysconfig/network tells your machine what it's actual hostname is. -- Kind Regards Rudi Ahlers CEO, SoftDux Hosting Web: http://www.SoftDux.com Office: 087 805 9573 Cell: 082 554 7532
> > > How do I change the hostname? > In particular, what is the difference between /etc/hosts and > /etc/sysconfig/network files? Where should I make the changes? >/etc/hosts has nothing to do with the hostname this is just a way to resolve a name to an IP where DNS is not available or some other badness is going on hostname is set in /etc/sysconfig/network but if you want to change it on the fly you can also echo it into /proc/sys/kernel/hostname
>How do I change the hostname? >In particular, what is the difference between /etc/hosts and >/etc/sysconfig/network files? > Where should I make the changes?change /etc/sysconfig/netowrk and make the hostname=server.domain.com change localhostnames add the new hostname to the file change etc/hosts xx.xx.xx.xx server.domain.com server restart the computer. You need to do this. Yes, you need to restart/reboot it. then run these commands. (assumes your hostname is mail.example.com) if any of these do not jibe, more to do until you get it right. shell prompt> uname -n mail.example.com shell prompt> hostname -s mail shell prompt> hostname -d example.com shell prompt> hostname -f mail.example.com shell prompt> hostname mail.example.com Lastly, you need to redo your certifercates for your computer since they (your openssh and maybe some others) are set up for the previous domain. In actual practice you may seldom see any issues with this, but the error messages will appear for some users trying to access different things.... Also, if you have stuff like logwatch or other system things going to a local mail make sure spamassassin or procmail rules are updated to deal with the change in localhost.localdomain so they are not junked. Always make sure the normal things you are used to are still happening or being received after you change the hostname....many things can be affected, slightly or more, when doing it. Nothing usually server breaking. This should do you well