{"id":1983,"date":"2016-11-01T10:29:16","date_gmt":"2016-11-01T07:29:16","guid":{"rendered":"http:\/\/www.fatihacar.com\/blog\/?p=1983"},"modified":"2016-11-01T10:31:32","modified_gmt":"2016-11-01T07:31:32","slug":"change-hostname-in-rhel-7","status":"publish","type":"post","link":"http:\/\/www.fatihacar.com\/blog\/change-hostname-in-rhel-7\/","title":{"rendered":"Change Hostname in RHEL 7"},"content":{"rendered":"<p>Changing hostname is different from RHEL 6 version in RHEL 7. You can use few method to change hostname. I will demonstrate useful and easy method that is hostnamectl command.<\/p>\n<p><strong>Show Current Hostname<\/strong><\/p>\n<blockquote><p>[root@localhost ~]# hostname<br \/>\nlocalhost.localdomain<\/p>\n<p>or<\/p>\n<p>[root@localhost ~]# hostnamectl status<br \/>\n   Static hostname: localhost.localdomain<br \/>\n         Icon name: computer-vm<br \/>\n           Chassis: vm<br \/>\n        Machine ID: 418f684e1a5c45c9a22f76065c732de3<br \/>\n           Boot ID: 9b07d8a45e60437e9ef31164d394ad17<br \/>\n    Virtualization: vmware<br \/>\n  Operating System: CentOS Linux 7 (Core)<br \/>\n       CPE OS Name: cpe:\/o:centos:centos:7<br \/>\n            Kernel: Linux 3.10.0-327.36.3.el7.x86_64<br \/>\n      Architecture: x86-64\n<\/p><\/blockquote>\n<p><strong>Change Hostname<\/strong><br \/>\n<!--more--><\/p>\n<blockquote><p>[root@localhost ~]# hostnamectl set-hostname newname.domain<\/p><\/blockquote>\n<p><strong>Show New Value of Hostname<\/strong><\/p>\n<blockquote><p>[root@localhost ~]# hostnamectl<br \/>\n   Static hostname: newname.domain<br \/>\n         Icon name: computer-vm<br \/>\n           Chassis: vm<br \/>\n        Machine ID: 418f684e1a5c45c9a22f76065c732de3<br \/>\n           Boot ID: 9b07d8a45e60437e9ef31164d394ad17<br \/>\n    Virtualization: vmware<br \/>\n  Operating System: CentOS Linux 7 (Core)<br \/>\n       CPE OS Name: cpe:\/o:centos:centos:7<br \/>\n            Kernel: Linux 3.10.0-327.36.3.el7.x86_64<br \/>\n      Architecture: x86-64<br \/>\n[root@localhost ~]# hostname<br \/>\nnewname.domain<\/p><\/blockquote>\n<p>Also, you can see new hostname value at \/etc\/hostname file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.fatihacar.com\/blog\/resimler\/hostname_change.jpg\" alt=\"hostname_change\" width=\"586\" height=\"434\" class=\"aligncenter size-full wp-image-1984\" srcset=\"http:\/\/www.fatihacar.com\/blog\/resimler\/hostname_change.jpg 586w, http:\/\/www.fatihacar.com\/blog\/resimler\/hostname_change-300x222.jpg 300w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Changing hostname is different from RHEL 6 version in RHEL 7. You can use few method to change hostname. I will demonstrate useful and easy method that is hostnamectl command. Show Current Hostname [root@localhost ~]# hostname localhost.localdomain or [root@localhost ~]# hostnamectl status Static hostname: localhost.localdomain Icon name: computer-vm Chassis: vm Machine ID: 418f684e1a5c45c9a22f76065c732de3 Boot ID:&#8230;<\/p>\n","protected":false},"author":37,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[18],"tags":[31,22],"class_list":["post-1983","post","type-post","status-publish","format-standard","hentry","category-linux-unix","tag-linux-administration","tag-system-administration"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p39NFI-vZ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/1983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/comments?post=1983"}],"version-history":[{"count":3,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/1983\/revisions"}],"predecessor-version":[{"id":1987,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/1983\/revisions\/1987"}],"wp:attachment":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/media?parent=1983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/categories?post=1983"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/tags?post=1983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}