{"id":4799,"date":"2018-11-13T02:49:45","date_gmt":"2018-11-13T02:49:45","guid":{"rendered":"https:\/\/geekdecoder.com\/?p=4799"},"modified":"2018-11-13T02:49:45","modified_gmt":"2018-11-13T02:49:45","slug":"how-to-set-or-change-hostname-in-centos-7","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2018\/11\/13\/how-to-set-or-change-hostname-in-centos-7\/","title":{"rendered":"How to Set or Change Hostname in CentOS 7"},"content":{"rendered":"<p>Use this information when changing the hostname in centos 7.<\/p>\n<p>Ways to show the hostname<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# hostname\n# hostname -s\n# hostname -f\n# cat \/etc\/hostname\n# hostnamectl\n<\/pre>\n<p>How to change the hostname.<br \/>\nIn order to change or set a CentOS 7 machine hostname, use the hostnamectl command as shown in the below command excerpt.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# hostnamectl set-hostname your-new-hostname\n<\/pre>\n<p>In order to apply the new hostname, a system reboot is required, issue one of the below commands in order to reboot a CentOS 7 machine.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# init 6\n# systemctl reboot\n# shutdown -r now\n\n<\/pre>\n<p>A second method to setup a CentOS 7 machine hostname is to manually edit the \/etc\/hostname file<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# nano \/etc\/hostname\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Use this information when changing the hostname in centos 7. Ways to show the hostname # hostname # hostname -s # hostname -f # cat \/etc\/hostname # hostnamectl How to change the hostname. In order to change or set a CentOS 7 machine hostname, use the hostnamectl command as shown in the below command excerpt. &#8230; <a title=\"How to Set or Change Hostname in CentOS 7\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2018\/11\/13\/how-to-set-or-change-hostname-in-centos-7\/\" aria-label=\"Read more about How to Set or Change Hostname in CentOS 7\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-4799","post","type-post","status-publish","format-standard","hentry","category-administration"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/4799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=4799"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/4799\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=4799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=4799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=4799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}