Google it ....

Monday, March 18, 2013

How to Change the Hostname of a Linux System

Normally we will set the hostname of a system during the installation process. but if we need to change hostname what can we do?

On any Linux system you can change its hostname with the command
hostname new_name.
[oracle@oel6 ~]$ hostname
oel6
[oracle@oel6 ~]$ hostname aaa
hostname: you must be root to change the host name
[oracle@oel6 ~]$ su - 
Password: 
[root@oel6 ~]# hostname aaa
[root@oel6 ~]# hostname
aaa

This new name will be until the system rebooted. To permanent change in Red Hat base systems we need to change hostname in /etc/sysconfig/network file.
[root@oel6 ~]# vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=oel6


and change hostname in file.

that's all.

No comments:

Post a Comment