-
Change hostname on Centos6
There are two ways to change your server hostname :
1)Temporary :
You can get your current hostname by typing the following commande into your terminal :
[root@dhcppc2 ~]# hostname localhost.localdomain
To change the hostname temporarily ,run the following command:
[root@dhcppc2 ~]# hostname raafat.innovationsol.com
Note:After reboot these changes will be lost.
Now ,Check the current hostname with this command :
[root@dhcppc2 ~]# hostname --fqd raafat.innovationsol.com
2)Permanent hostname change :
To make a permanent change, you must modify the network file which is read on system boot as following :
[root@dhcppc2 ~]# nano /etc/sysconfig/network
Then,Change the value of hostname to the new one you want.
Old one :
NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=localhost.localdomain
New one:
NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=raafat.innovationsol.com
Then, You have to reboot your network service
[root@dhcppc2 ~]# /etc/init.d/network restart
Verify that the hostname has changed by typing :
[root@dhcppc2 ~]# hostname --fqdn raafat2.innovationsol.com
In order for your new hostname to resolve properly, you should also update your
/etc/hosts
file to reflect the change.
For an example:127.0.0.1 localhost.localdomain localhost raafat.innovationsol.com ::1 localhost6.localdomain6 localhost6
Approaching a MySQL Backup How to convert a FAT volume or a FAT32 volume to NTFS
Change hostname on Centos6
Recent Posts
Categories
Archives
Comments are currently closed.