Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
During the instalation of a system, I didn't set the the name of the machine. So it was set to the default of localhost.localdomain. So I did the command;
hostname fileserver.mydomain
However, I am not sure if that is all that I have to do. I pico into /etc/hosts and it still says localhost.localdomain localhost
Also, at the shell screen it still says kenny@localhost
When I run the command hostname to get the output it does say fileserver.mydomain
127.0.0.1 should be listed as localhost as this is the loopback addresses used by lots of software. You might also want to add your server's name after 'localhost' if you don't have any other IP addresses (say associated with a network card etc).
At boot time your system must read the hostname from somewhere and set it. So you'll find that your sucessful canges to you hostname won't survive a reboot. Take a look at /etc/sysconfig/network
I was told that there are several different places that need to have the hostname and domainname changed in order for it to work. He told me that the command will take care of it. But I guess it isn't working. Because both /etc/host and /etc/sysconfig/network still say localhost.localdomain
So you are telling me that if I reboot that machine, it will go back to localhost.localdomain?
Neither hostname or domainname change either of the files you've mentioned. You need to change them yourself.
At boot time settings are read from the relevant files and programs like hostname are called to set them for the system. The hosts file (/etc/hosts) is only used to resolve hostnames to ip addresses, it doesn't actually effect what hostname is used by a system.
Try editing /etc/sysconfig/network then reboot and see what happens. If you don't edit the files yourself then yeah - the hostname will be reset to localhost.localdomain the next time you reboot.
One more thing. My friend also told me the reason that I had to change the name using the command was because there might be other parts of the system that will not know the name had changed and that the dependenies would be broke. Is this true?
Originally posted by KennyK That did it thanks for your help.
Good good...
Quote:
Originally posted by KennyK One more thing. My friend also told me the reason that I had to change the name using the command was because there might be other parts of the system that will not know the name had changed and that the dependenies would be broke. Is this true?
You were right to use hostname and domainname to change your settings, but to make it persistant accross reboots you needed to edit the files that the system reads at boot time to decide what it should set your hostname/domain name to. I'm sure that there is some nice graphical tool that you would typically use in Redhat to set this, but I've got no idea what it is.
Originally posted by jharris I'm sure that there is some nice graphical tool that you would typically use in Redhat to set this, but I've got no idea what it is.
That's ok. I would rather learn how to do everything from the command line anyway. So far everything I was doing was using SSH through the network.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.