Assigning the Hostname - Temporarily
[root@localhost~]#hostname <computername>
Ex :
[root@localhost~]#hostname server.wings2linux.comChange hostname in Linux
Edit /etc/hostsYou need to edit /etc/hosts and add a line for your host name
$ cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost $
My new server IP is 72.232.196.90, i need to assign it hostname server12.hosthat.com, to do this, i have edited /etc/hosts as follows.
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 72.232.196.90 server12.hosthat.com server12
Edit /etc/sysconfig/network
First lets see what is in the file
$ cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=localhost.localdomain $
To change servers hostname to server12.hosthat.com, change the file as follows.
$ cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=server12.hosthat.com $
Now you need to reboot the server to change the hostname.
Good Presentation. Thanks for the useful blog. Keep updatingLinux online Training
ReplyDeleteLinux online course
Linux Online Training in Hyderabad
Linux Online Training in Bangalore
Linux Online Training in Chennai