{"id":2020,"date":"2019-05-26T23:39:17","date_gmt":"2019-05-26T15:39:17","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=2020"},"modified":"2022-05-14T19:13:53","modified_gmt":"2022-05-14T11:13:53","slug":"hostnamectl","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/hostnamectl","title":{"rendered":"hostnamectl\u547d\u4ee4 – \u663e\u793a\u4e0e\u8bbe\u7f6e\u4e3b\u673a\u540d\u79f0"},"content":{"rendered":"\n

hostnamectl\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201chostname control\u201d\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u663e\u793a\u4e0e\u8bbe\u7f6e\u4e3b\u673a\u540d\u79f0\u3002\u57fa\u4e8e\/etc\/hostname\u6587\u4ef6\u4fee\u6539\u4e3b\u673a\u540d\u79f0\u9700\u8981\u91cd\u542f\u670d\u52a1\u5668\u540e\u624d\u53ef\u751f\u6548\uff0c\u800chostnamectl\u547d\u4ee4\u8bbe\u7f6e\u8fc7\u7684\u4e3b\u673a\u540d\u79f0\u53ef\u4ee5\u7acb\u5373\u751f\u6548\uff0c\u6548\u7387\u66f4\u9ad8\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f<\/strong>\uff1ahostnamectl [\u53c2\u6570] <\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570<\/strong>\uff1a<\/p>\n\n\n\n

-H<\/td>\u64cd\u4f5c\u8fdc\u7a0b\u4e3b\u673a<\/td><\/tr>
status<\/td>\u663e\u793a\u5f53\u524d\u4e3b\u673a\u540d\u8bbe\u7f6e<\/td><\/tr>
set-hostname<\/td>\u8bbe\u7f6e\u7cfb\u7edf\u4e3b\u673a\u540d<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u7684\u4e3b\u673a\u540d\u79f0\u53ca\u7cfb\u7edf\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# hostnamectl status <\/strong>\n   Static hostname: linuxcool.com\n         Icon name: computer-vm\n           Chassis: vm\n        Machine ID: c8b04558503242459d908c6c22a2d481\n           Boot ID: a08b17d3ed444ca6b86fdd52a499943e\n    Virtualization: vmware\n  Operating System: Red Hat Enterprise Linux 8.0 (Ootpa)\n       CPE OS Name: cpe:\/o:redhat:enterprise_linux:8.0:GA\n            Kernel: Linux 4.18.0-80.el8.x86_64\n      Architecture: x86-64\n<\/pre>\n\n\n\n

\u4fee\u6539\u5f53\u524d\u7cfb\u7edf\u7684\u4e3b\u673a\u540d\u79f0\u4e3a\u6307\u5b9a\u5b57\u7b26\u4e32\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# hostnamectl set-hostname linuxprobe.com<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"

hostnamectl\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201chostname control\u201d\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u663e\u793a\u4e0e\u8bbe\u7f6e\u4e3b\u673a […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2020"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=2020"}],"version-history":[{"count":11,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2020\/revisions"}],"predecessor-version":[{"id":9694,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/2020\/revisions\/9694"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=2020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=2020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=2020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}