Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

We have centos machine. We have tried both the /etc/hosts and also /etc/sysconfig/network. Edited both files and service network restart. Yet the hostname is showing as localhost.localdomain. How to resolve on this? Googling almost all talking about the same method too.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

From this answer : How to change the hostname of a linux machine using terminal?

Have you tried running the command :

hostname new_hostname

where "new_hostname" would be value you are trying to set ?

share|improve this answer
    
it works but will it be permanent there? How about the other steps with regards to /etc/sysconfig/network and /etc/hosts? Must I still edit those ? –  biz14 Jul 27 '13 at 16:49
    
Yes, you should edit those files too. The two files are for the "permanent" changes, the "hostname" command is for "on the fly" change. –  Louis Carrese Jul 28 '13 at 9:50
    
ok let me test I am not too sure about the /etc/hosts how where and what to change exactly can you please verify as some said just put beside the 127.0.0.1 hostname is this correct? –  biz14 Jul 28 '13 at 15:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.