{"id":50,"date":"2014-09-22T02:58:00","date_gmt":"2014-09-22T02:58:00","guid":{"rendered":"http:\/\/onlinelab.info\/2014\/09\/22\/change-hostname-on-centos-7\/"},"modified":"2014-09-22T02:58:00","modified_gmt":"2014-09-22T02:58:00","slug":"change-hostname-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.asianux.org.vn\/index.php\/2014\/09\/22\/change-hostname-on-centos-7\/","title":{"rendered":"Change hostname on CentOS 7"},"content":{"rendered":"<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">After<span>&nbsp;<\/span><a href=\"http:\/\/www.itzgeek.com\/how-tos\/linux\/centos-how-tos\/centos-7-installation-step-by-step-with-screenshot-part-1.html\" rel=\"nofollow noopener\" style=\"color: #326693; text-decoration: none;\" target=\"_blank\" title=\"CentOS 7 Installation Step by Step with ScreenShot \u2013 Part 1\">installing the CentOS 7<\/a><span>&nbsp;<\/span>on my server, i tried to change host name by modifying the \/etc\/sysconfig\/network; it did not take an effect of the modification. Even after multiple reboot of server, the host name remains localhost.localdomain. The procedure to change the host name in CentOS 7 is now totally different from the previous version, this guide will help you to setup the host name on CentOS 7 \/ RHEL 7.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"text-decoration: underline;\"><span style=\"color: maroon;\"><strong>CentOS 7 supports three class of Host Names:<\/strong><\/span><\/span><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"color: navy;\"><strong>Static<\/strong><\/span><span>&nbsp;<\/span>\u2013 The static host name is traditional host which can be chosen by the user and is stored in \/etc\/hostname file.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"color: navy;\"><strong>Transient<\/strong><\/span><span>&nbsp;<\/span>\u2013 The transient host name is maintained by kernel and can be changed by DHCP and mDNS.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><strong><span style=\"color: navy;\">Pretty<\/span><\/strong><span>&nbsp;<\/span>\u2013 It is a free form UTF -8 host name for the presentation to the user.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"color: maroon;\"><strong>HostName can be,<\/strong><\/span><\/div>\n<ul style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; list-style: none; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">\n<li style=\"font-family: 'Open Sans', arial, sans-serif; margin: 0px; padding: 0px;\">64 character in a length<\/li>\n<li style=\"font-family: 'Open Sans', arial, sans-serif; margin: 0px; padding: 0px;\">Recommend to have FQDN<\/li>\n<li style=\"font-family: 'Open Sans', arial, sans-serif; margin: 0px; padding: 0px;\">Consists of a-z,A-Z, 0-9, \u201c-\u201d, \u201c_\u201d and \u201c.\u201d only<\/li>\n<\/ul>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"text-decoration: underline;\"><span style=\"color: maroon;\"><strong>How to Change:<\/strong><\/span><\/span><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">Before changing the host name, lets check the current host name.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root<span style=\"color: black;\">@<\/span>localhost ~]# hostname<br \/>localhost.localdomain<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"text-decoration: underline;\"><span style=\"color: navy;\"><strong>1. nmtui tool: you using command nmtui<\/strong><\/span><\/span><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font\n-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">NetworkManaget tool is used to set the static host name in \/etc\/hostname file.<\/div>\n<div style=\"clear: both; text-align: center;\"><a href=\"http:\/\/3.bp.blogspot.com\/-EYl2T5yLo4w\/VB-PMIM76UI\/AAAAAAAABWM\/wjEeVvpZ0Nw\/s1600\/1.png\" style=\"margin-left: 1em; margin-right: 1em;\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" src=\"http:\/\/3.bp.blogspot.com\/-EYl2T5yLo4w\/VB-PMIM76UI\/AAAAAAAABWM\/wjEeVvpZ0Nw\/s1600\/1.png\" height=\"478\" width=\"640\" alt=\"\" title=\"\"><\/a><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background: rgb(247, 247, 247); border: 1px solid rgb(230, 230, 230); color: black; display: block; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px auto 10px; orphans: auto; padding: 4px 0px 5px; text-align: center; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 226px; word-spacing: 0px;\"><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">Set the host name.<\/div>\n<div style=\"clear: both; text-align: center;\"><a href=\"http:\/\/1.bp.blogspot.com\/-Yh0-vcj38ac\/VB-PeGPv2KI\/AAAAAAAABWU\/EzCjeJOz9Gs\/s1600\/2.png\" style=\"margin-left: 1em; margin-right: 1em;\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" src=\"http:\/\/1.bp.blogspot.com\/-Yh0-vcj38ac\/VB-PeGPv2KI\/AAAAAAAABWU\/EzCjeJOz9Gs\/s1600\/2.png\" height=\"154\" width=\"640\" alt=\"\" title=\"\"><\/a><\/div>\n<p><\/p>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">restart the hostnamed to force the hostnamectl to notice the change in static host name.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root<span style=\"color: black;\">@<\/span>localhost ~]# systemctl restart systemd-hostnamed<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">You can verify the change in host name.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root@localhost ~]# hostname<br \/>web.sysadmin.com.vn<br \/>[root@localhost ~]# cat \/etc\/hostname<br \/>web.sysadmin.com.vn<br \/>[root@localhost ~]# cat \/etc\/sysconfig\/network<br \/># Created by anaconda<br \/>sysadmin<br \/>[root@localhost ~]#<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"text-decoration: underline;\"><span style=\"color: navy;\"><strong>2. hostnamectl:<\/strong><\/span><\/span><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"color: navy;\"><span style=\"color: black;\">hos<br \/>\ntnamectl is used to change the host name, with this tool we can change all the three class of host name; here we look only static host nam<\/span><\/span><span style=\"color: black;\">e.<\/span><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">Check the current host name.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root<span style=\"color: black;\">@<\/span>server ~]# hostnamectl status<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root@localhost ~]# hostnamectl status<br \/>   Static hostname: web.sysadmin.com.vn<br \/>         Icon name: computer<br \/>           Chassis: n\/a<br \/>        Machine ID: 3132ab42b3b7405bbdc647ce36ca659f<br \/>           Boot ID: 0938b49f7e4045b899a110ccf17b54a7<br \/>    Virtualization: vmware<br \/>  Operating System: CentOS Linux 7 (Core)<br \/>       CPE OS Name: cpe:\/o:centos:centos:7<br \/>            Kernel: Linux 3.10.0-123.6.3.el7.x86_64<br \/>      Architecture: x86_64<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">Set the hostname.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root<span style=\"color: black;\">@<\/span>server ~]# hostnamectl set-hostname web.sysadmin.com.vn<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">Check the host name again (Close the session and open new session using putty or console)<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px\n!important; width: 2558px;\"><\/p>\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root<span style=\"color: black;\">@<\/span>client ~]# hostnamectl status<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root@localhost ~]# hostnamectl status<br \/>   Static hostname: web.sysadmin.com.vn<br \/>         Icon name: computer<br \/>           Chassis: n\/a<br \/>        Machine ID: 3132ab42b3b7405bbdc647ce36ca659f<br \/>           Boot ID: 0938b49f7e4045b899a110ccf17b54a7<br \/>    Virtualization: vmware<br \/>  Operating System: CentOS Linux 7 (Core)<br \/>       CPE OS Name: cpe:\/o:centos:centos:7<br \/>            Kernel: Linux 3.10.0-123.6.3.el7.x86_64<br \/>      Architecture: x86_64<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">If you use this command, you do not require to notify the change in host name. Close the current session and re launch the terminal.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"text-decoration: underline;\"><span style=\"color: navy;\"><strong>3. nmcli tool:<\/strong><\/span><\/span><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">It can be used to query and setup the static host name in \/etc\/hostname file.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">Check the hostname.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root@localhost ~]# nmcli general hostname<br \/>web.sysadmin.com.vn<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">Change the host name.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; wo\nrd-spacing: 0px;\"><\/p>\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root@localhost ~]# nmcli general hostname web.sysadmin.com.vn<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">restart the hostnamed to force the hostnamectl to notice the change in static host name.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: #f9f9f9; border: 1px solid silver; color: #110000; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px 0px 1.5em; orphans: auto; overflow-x: auto; overflow-y: hidden; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; width: 2558.15625px; word-spacing: 0px;\">\n<table style=\"border-collapse: collapse !important; border-spacing: 0px; border: none !important; margin: 0px !important; padding: 0px !important; width: 2558px;\">\n<tbody>\n<tr>\n<td style=\"background-color: #eeeeee; background-image: linear-gradient(transparent 50%, rgba(255, 255, 255, 0.901961) 50%); background-size: 1px 32px; border: none !important; line-height: normal !important; margin: 0px; padding: 0px !important; text-align: left !important; vertical-align: top !important; white-space: normal !important; width: 2558px;\">\n<pre style=\"-webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; background: white !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 1px dashed rgb(47, 111, 171) !important; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px !important; clear: none !important; float: none !important; font-family: monospace; font-size: 12px !important; font-style: normal; font-variant: normal; font-weight: normal; line-height: 16px !important; margin: 0px !important; overflow: visible !important; padding: 10px !important; white-space: pre !important; width: auto !important;\">[root<span style=\"color: black;\">@<\/span>localhost ~]# systemctl restart systemd-hostnamed<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"color: navy; text-decoration: underline;\"><strong>4. Edit \/etc\/hostname<\/strong><\/span><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\">This is the simple, but requires a reboot of server to take an effect.<\/div>\n<div style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; margin: 0px; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span style=\"color: maroon;\"><strong>Note:<\/strong><\/span><span>&nbsp;<\/span><span style=\"color: #003366;\"><strong>Use the hostnamectl to change the host name, which fair better than other commands and does not require to update the kernel about the change in host name.<\/strong><\/span><\/div>\n<p><span style=\"-webkit-text-stroke-width: 0px; color: black; font-family: 'Open Sans', arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22.8199996948242px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;\"><span><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After&nbsp;installing the CentOS 7&nbsp;on my server, i tried to change host name by modifying the \/etc\/sysconfig\/network; it did not take an effect of the modification. Even after multiple reboot of server, the host name remains&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":0,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}