{"id":2110,"date":"2012-03-06T21:06:55","date_gmt":"2012-03-06T13:06:55","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=2110"},"modified":"2023-04-28T09:49:42","modified_gmt":"2023-04-28T09:49:42","slug":"how-to-change-the-hostname-on-linux-centos-6-2-server","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-change-the-hostname-on-linux-centos-6-2-server\/","title":{"rendered":"How to Change the Hostname on Linux CentOS 6.2 Server"},"content":{"rendered":"<p>In this post, i will show you on how to change the Hostname on linux CentOS 6.2. I have tested this on RHEL 6, CentOS 5.5 and CentOS 6.2. Reboot is required for both options (A) and (B) for the changes to take effect.<\/p>\n<p>Check current hostname with this command :<\/p>\n<pre>[root@centos62 ~]# hostname --fqd\ncentos62.ehowstuff.local<\/pre>\n<p><strong>Option A:<\/strong><br \/>\n1. Modify \/etc\/sysconfig\/network<\/p>\n<pre class=\"code\">[root@centos62 ~]# vi \/etc\/sysconfig\/network<\/pre>\n<p>2. Edit to your preferred hostname :<\/p>\n<pre class=\"code\">NETWORKING=yes\nHOSTNAME=NewHostname.ehowstuff.local<\/pre>\n<p>3. Modify \/etc\/hosts file as below :<\/p>\n<pre>[root@centos62 ~]# vi \/etc\/hosts<\/pre>\n<pre>127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4\n::1         localhost localhost.localdomain localhost6 localhost6.localdomain6\n\n192.168.1.44 NewHostname.ehowstuff.local NewHostname<\/pre>\n<p>4. Save and reboot your server.<\/p>\n<p><strong>Option B:<\/strong><br \/>\n1. Type the following command to enter GUI mode.<\/p>\n<pre class=\"code\">[root@centos62 ~]# system-config-network<\/pre>\n<p>2. Go to &#8220;DNS Configuration&#8221;.<br \/>\n<img decoding=\"async\" class=\"alignnone lazyload\" title=\"Hostname\" data-src=\"http:\/\/4.bp.blogspot.com\/-eXX8b0tmeJc\/TxzSTjPPA_I\/AAAAAAAABfg\/A612NAgl4ec\/s1600\/1.PNG\" alt=\"Hostname\" width=\"267\" height=\"231\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 267px; --smush-placeholder-aspect-ratio: 267\/231;\" \/><\/p>\n<p>3. Modify your preferred hostname and click OK.<br \/>\n<img decoding=\"async\" class=\"alignnone lazyload\" title=\"Hostname\" data-src=\"http:\/\/2.bp.blogspot.com\/-xloUfOh-lT8\/T1YKcUqE9tI\/AAAAAAAAB7g\/gwrQf4dcQ84\/s1600\/2.PNG\" alt=\"Hostname\" width=\"295\" height=\"262\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 295px; --smush-placeholder-aspect-ratio: 295\/262;\" \/><\/p>\n<p>4. Click &#8221; Save &amp; Quit&#8221;.<br \/>\n<img decoding=\"async\" class=\"alignnone lazyload\" title=\"Hostname\" data-src=\"http:\/\/4.bp.blogspot.com\/-55xQXtAflmQ\/TxzST4qSHII\/AAAAAAAABf0\/Dtf5YdRJQT0\/s1600\/3.PNG\" alt=\"Hostname\" width=\"261\" height=\"229\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 261px; --smush-placeholder-aspect-ratio: 261\/229;\" \/><\/p>\n<p>5. Modify \/etc\/hosts file as below :<\/p>\n<pre>[root@centos62 ~]# vi \/etc\/hosts<\/pre>\n<pre>127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4\n::1         localhost localhost.localdomain localhost6 localhost6.localdomain6\n\n192.168.1.44 NewHostname.ehowstuff.local NewHostname<\/pre>\n<p>6.Reboot your server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, i will show you on how to change the Hostname on linux CentOS 6.2. I have tested this on RHEL 6, CentOS 5.5 and CentOS 6.2. Reboot&#8230;<\/p>\n","protected":false},"author":6,"featured_media":1554,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055],"tags":[1244,1253,1414,1536],"class_list":["post-2110","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos","tag-centos-6-2","tag-hostname","tag-linux"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/2110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=2110"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/2110\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/1554"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=2110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=2110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=2110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}