{"id":2034,"date":"2021-12-15T09:06:59","date_gmt":"2021-12-15T01:06:59","guid":{"rendered":"https:\/\/www.yusian.com\/blog\/?p=2034"},"modified":"2021-12-15T09:07:31","modified_gmt":"2021-12-15T01:07:31","slug":"linux%e4%b8%8b%e5%a6%82%e4%bd%95%e4%bf%ae%e6%94%b9%e4%b8%bb%e6%9c%ba%e5%90%8d","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/centos\/2021\/12\/15\/0906592034.html","title":{"rendered":"Linux\u4e0b\u5982\u4f55\u4fee\u6539\u4e3b\u673a\u540d"},"content":{"rendered":"<h3>\u4e34\u65f6\u65b9\u6848<\/h3>\n<p>\u4f7f\u7528hostname\u547d\u4ee4<\/p>\n<pre><code class=\"language-shell line-numbers\">[root@Server-1 cer]# hostname xxxx\n<\/code><\/pre>\n<h3>\u91cd\u542f\u751f\u6548<\/h3>\n<p>\u4f7f\u7528hostnamectl\u547d\u4ee4<\/p>\n<ul>\n<li>\u67e5\u770b\u5f53\u524dhostname\u4fe1\u606f<\/li>\n<\/ul>\n<pre><code class=\"language-shell line-numbers\">[root@Server-1 cer]# hostnamectl\n   Static hostname: Server-1\nTransient hostname: xxxx\n         Icon name: computer-vm\n           Chassis: vm\n        Machine ID: b00cb986ec8e4fe4967c169f60547bb7\n           Boot ID: fe66b35c25b44fbc8973e48f0ac8f735\n    Virtualization: kvm\n  Operating System: CentOS Linux 7 (Core)\n       CPE OS Name: cpe:\/o:centos:centos:7\n            Kernel: Linux 3.10.0-1160.45.1.el7.x86_64\n      Architecture: x86-64\n[root@Server-1 cer]# \n<\/code><\/pre>\n<ul>\n<li>\u8bbe\u7f6ehostname\uff0cset-hostname<\/li>\n<\/ul>\n<pre><code class=\"language-shell line-numbers\">[root@Server-1 cer]# hostnamectl set-hostname Server-1\n[root@Server-1 cer]# \n<\/code><\/pre>\n<h3>\u4fee\u6539hosts\uff0c\u540c\u6b65\u672c\u5730\u89e3\u6790<\/h3>\n<pre><code class=\"language-shell line-numbers\">[root@Server-1 cer]# vim \/etc\/hosts\n<\/code><\/pre>\n<pre><code class=\"language-shell line-numbers\">127.0.0.1 Server-1 Server-1\n127.0.0.1 localhost.localdomain localhost\n127.0.0.1 localhost4.localdomain4 localhost4\n\n::1 Server-1 Server-1\n::1 localhost.localdomain localhost\n::1 localhost6.localdomain6 localhost6\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e34\u65f6\u65b9\u6848 \u4f7f\u7528hostname\u547d\u4ee4 [root@Server-1 cer]# hostname xxxx \u91cd\u542f\u751f\u6548 \u4f7f\u7528hostnamectl\u547d\u4ee4 \u67e5\u770b\u5f53\u524dhostname\u4fe1\u606f [root@Server-1 cer]# hostnamectl Static hostname: Server-1 Transient hostname: xxxx Icon name: computer-vm Chassis: vm Machine ID: b00cb986ec8e4fe4967c169f60547bb7 Boot ID: fe66b35c25b44fbc8973e48f0ac8f735 Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:\/o:centos:centos:7 Kernel: Linux 3.10.0-1160.45.1.el7.x86_64 Architecture: x86-64 [root@Server-1 cer]# \u8bbe\u7f6ehostname\uff0cset-hostname [root@Server-1 cer]# hostnamectl set-hostname Server-1 [root@Server-1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[67,367,368,8],"class_list":["post-2034","post","type-post","status-publish","format-standard","hentry","category-centos","tag-centos","tag-hostname","tag-hosts","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/2034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=2034"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/2034\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=2034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=2034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=2034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}