Change Hostname in Red Hat



Share this article :

There are 2 ways of changing the Red Hat operating system hostname. You can do the changes for temporary or permanently.

Temporary Hostname:

1. Check your hostname.

# hostname
oldhostname

2. Change the hostname.

# hostname newhostname

3. Verify

# hostname
newhostname

Note:
The old hostname will revert back after you reboot the system.

Permanent Hostname:

1. Check your hostname.

# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=oldhostname

2. Edit the /etc/sysconfig/network file & save!

# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=newhostname

3. Next, edit the /etc/hosts file & save!

# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
10.0.0.10       newhostname

to

# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
10.0.0.10       newhostname

4. Restart network services.

# service xinetd restart

Tags:

Related posts

Enable FTP in Red Hat
Compress, Extract, Archive File in Red Hat
Red Hat Process Monitoring
Enable & Disable Rsync in Red Hat
© 2017 ITsiti. All Rights Reserved
Powered by KEEM