{"id":273941,"date":"2023-06-02T04:05:20","date_gmt":"2023-06-01T20:05:20","guid":{"rendered":"https:\/\/lrxjmw.cn\/lzdhxgzjmdff.html"},"modified":"2023-06-02T04:05:20","modified_gmt":"2023-06-01T20:05:20","slug":"lzdhxgzjmdff","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lzdhxgzjmdff.html","title":{"rendered":"Linux\u4e2d\u7684hostname\u4fee\u6539\u4e3b\u673a\u540d\u7684\u65b9\u6cd5\u603b\u7ed3"},"content":{"rendered":"
Linux<\/a>\u4e2d\u7684hostname\u5728\u5927\u591a\u6570\u5e94\u7528\u4e2d\u81f3\u4e3a\u91cd\u8981\uff0c\u8b6c\u5982\u6709\u4e9b\u5e94\u7528\u5f3a\u5236\u4f7f\u7528\u4e3b\u673a\u540d\u79f0\u800c\u4e0d\u80fd\u4f7f\u7528IP\u5730\u5740\uff0c\u5047\u5982\u9ed8\u8ba4\u4e3b\u673a\u540d\u79f0\u90fd\u4e3alocalhost.localdomain\u7684\u8bdd\u90a3\u4e00\u5b9a\u4f1a\u51fa\u73b0\u95ee\u9898\uff0c\u800c\u4e14\u770b\u4e0a\u53bb\u4e5f\u662f\u8fd9\u4e48\u7684\u4e0d\u5c3d\u4eba\u610f\u3002\u5728CentOS6\u53ca\u5176\u4ee5\u4e0b\u7248\u672c\u901a\u5e38\u901a\u8fc7\u66f4\u6539\u914d\u7f6e\u6587\u4ef6\u7684\u529e\u6cd5\u6765\u66f4\u6539\u4e3b\u673a\u540d\uff0c\u6b64\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4e3a\/etc\/sysconfig\/network\uff0c\u4f46\u5728CentOS7\u4e2d\uff0c\u597d\u591a\u7cfb\u7edf<\/a>\u7ba1\u7406\u5de5\u5177\u90fd\u88ab\u66ff\u6362\u4e86\u3002<\/p>\n \u6bd4\u5982\u60f3\u4fee\u6539\u4e3b\u673a\u540d\uff0c\u4e0d\u80fd\u53c2\u8003\u5148\u524d\u7684\u65b9\u5f0f\u4e86linux\u64cd\u4f5c\u7cfb\u7edf\u5b89\u88c5\uff0c\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\u65e9\u5df2\u66f4\u65b0\u4e3a\/etc\/hostnamelinux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86<\/strong>\uff0c\u867d\u7136\u66f4\u6539\/etc\/sysconfig\/network\u914d\u7f6e\u6587\u4ef6\uff08\u6b64\u6587\u4ef6\u4ecd\u7136\u5b58\u5728linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86<\/strong>linux\u8bba\u575b\uff0c\u53ea\u662f\u662f\u7a7a\u7684\uff09\u53ef\u80fd\u8d77\u4f5c\u7528\uff0c\u4f46\u4e0d\u5f97\u4e0d\u8003\u8651\u6709\u4e9bLinux\u8f6f\u4ef6\u662f\u5426\u4f1a\u4f7f\u7528source\u6b64\u6587\u4ef6\u6216\u662f\u5426\u4f7f\u7528\u73af\u5883\u53d8\u91cf$HOSTNAME\u3002\u56e0\u800c\u5728\u6b64\u603b\u7ed3\u4e86\u51e0\u79cdCentOS7\u66f4\u6539\u4e3b\u673a\u540d\u7684\u65b9\u5f0f\u3002<\/p>\n 1.\u76f4\u63a5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u66f4\u6539\/etc\/hostname\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n