{"id":3854,"date":"2019-09-09T20:30:55","date_gmt":"2019-09-09T08:30:55","guid":{"rendered":"http:\/\/www.zoyinc.com\/?p=3854"},"modified":"2019-09-15T12:09:21","modified_gmt":"2019-09-15T00:09:21","slug":"rename-a-centos-7-host","status":"publish","type":"post","link":"http:\/\/www.zoyinc.com\/?p=3854","title":{"rendered":"Rename a CentOS 7 host"},"content":{"rendered":"<p>Simple and official way to rename a host:<\/p>\n<p style=\"padding-left: 30px;\">hostnamectl set-hostname centos7-base.cantabrian<\/p>\n<p>Then restart the host.<\/p>\n<p>You should find the new name is reflected in the file:<\/p>\n<p style=\"padding-left: 30px;\">\/etc\/hostname<\/p>\n<p>Note: You only need to edit &#8220;\/etc\/resolv.conf &#8221; if you are changing workgroups or domains.<\/p>\n<h2>Get hostname details<\/h2>\n<p>You can use hostnamectl to get other details by running:<\/p>\n<p style=\"padding-left: 30px;\">hostnamectl status<\/p>\n<p>Which gives:<\/p>\n<p style=\"padding-left: 30px;\">Static hostname: centos7-base.cantabrian<br \/>\nIcon name: computer-vm<br \/>\nChassis: vm<br \/>\nMachine ID: 71c11ed5c0aa41ad909ab96d4c6ad395<br \/>\nBoot ID: a7f1d108ceae42e796e43ea0cd249e6b<br \/>\nVirtualization: vmware<br \/>\nOperating System: CentOS Linux 7 (Core)<br \/>\nCPE OS Name: cpe:\/o:centos:centos:7<br \/>\nKernel: Linux 3.10.0-957.27.2.el7.x86_64<br \/>\nArchitecture: x86-64<\/p>\n<p>&nbsp;<\/p>\n<h1>Additional stuff<\/h1>\n<p>These are things that I need to do when I rename my centos7-base VM. They may or may not apply to you.<\/p>\n<h2>AWStats<\/h2>\n<p>Update the &#8220;HostAliases&#8221; section in the config file:<\/p>\n<p style=\"padding-left: 30px;\">\/etc\/awstats\/awstats.www.zoyinc.com.conf<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Simple and official way to rename a host: hostnamectl set-hostname centos7-base.cantabrian Then restart the host. You should find the new name is reflected in the file: \/etc\/hostname Note: You only need to edit &#8220;\/etc\/resolv.conf &#8221; if you are changing workgroups or domains. Get hostname details You can use hostnamectl to get other details by running: [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":868,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[553,552],"tags":[555,572,571,554,573,94],"class_list":["post-3854","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-redhat","tag-centos","tag-change","tag-hostname","tag-red-hat","tag-rename","tag-setup"],"_links":{"self":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/3854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3854"}],"version-history":[{"count":5,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/3854\/revisions"}],"predecessor-version":[{"id":3872,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/3854\/revisions\/3872"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/media\/868"}],"wp:attachment":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3854"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}