LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to change my computer name? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-change-my-computer-name-728732/)

jalone 05-26-2009 09:31 PM

How to change my computer name?
 
Hi All,

I'm very new to linux.

Now I'm using RHEL5.

After installed, I want to change my computer name.

Please help me to find out solution.

Thx.

Jalone

pentode 05-26-2009 09:38 PM

Welcome to LQ

Here's a link to one of the 28,000,000 hits I got on Google regarding this subject:

http://www.cyberciti.biz/faq/linux-s...-of-my-server/

schneidz 05-26-2009 11:21 PM

Code:

[fedora@localhost ~]$ hostname
localhost.localdomain
[fedora@localhost ~]$ cat /etc/hosts
127.0.0.1                localhost.localdomain localhost
::1                localhost6.localdomain6 localhost6


billymayday 05-26-2009 11:23 PM

You should find the hostname (and be able to change it permanently) by editing /etc/sysconfig/network and restarting your network service.

jalone 05-27-2009 01:36 AM

Hi All,

thanks for ur quicky reply.

Now I already change the hostname by using root account.

But when I open my terminal, promt me as user@master:~ (now I'm using user account.)

so what is the master?

I think should be " user@hostname:~" Is the right one?

Jalone

jalone 05-27-2009 01:39 AM

Hi all,

I think I need to restart network service.

How do I restart the networking service?

Thanks

Jalone

billymayday 05-27-2009 01:40 AM

How did you change it?

You may need to change it via the hostname command for command prompts to change without rebooting.

saagar 05-27-2009 01:26 PM

If you want to change your host's name to station1, then:

1.log in as root user
2. vi /etc/sysconfig/network

HOSTNAME=station1

2b.save the file.

3.log out and log in, now you can see that it has gotten changed as you wished and it will not change even in successive reboots, because you have entered this in /etc/sysconfig/network file:

4.[root@station1~]# hostname
station1

5.It is always good to enter this hostname in /etc/hosts file:

6.vi /etc/hosts

127.0.0.1 station1 localhost.localdomain localhost

7. If you want to change your hostname temporarily, just type:

hostname stationX, but this will change to station1 once you reboot your system...!!

farslayer 05-27-2009 03:10 PM

Could check my Blog post on Setting the Linux Hostname so you won't miss anything or skip any steps.. this also includes info on changing the name on the fly without a reboot.

props to the cpqlinux site where I obtained the info.

namtustar 05-28-2009 02:28 AM

Hi saagar and all,

Thanks for all replies.

Now the terminal prompt me as [ user@mystation:~].

Finally successful.


All times are GMT -5. The time now is 10:48 AM.