How to Change Hostname in Fedora/Red Hat

Temporary Hostname:

1. Check your hostname

[root@keem ~]# hostname
keem

2. Change the hostname

[root@keem ~]# hostname asknadya

3. Verify

[root@keem ~]# hostname
asknadya

Note:
** asknadya is your new hostname
** the hostname will revert back after you reboot the system

Permanent Hostname:

1. Check your hostname

[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=keem

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

[root@localhost ~]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=asknadya

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

[root@keem ~]# 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    keem

to

[root@keem ~]# 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    asknadya

4. Reboot the system or restart network services

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)