Tag Archives: linux system

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
[oracle@oel6 ~]$ hostname aaa
hostname: you must be root to change the host name
[oracle@oel6 ~]$ su - 
[root@oel6 ~]# hostname aaa
[root@oel6 ~]# hostname

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


and change hostname in file.

that’s all.