{"id":80,"date":"2023-12-08T09:10:47","date_gmt":"2023-12-08T01:10:47","guid":{"rendered":"https:\/\/bt.079300.xyz\/?p=80"},"modified":"2023-12-08T09:10:47","modified_gmt":"2023-12-08T01:10:47","slug":"pve%e4%bd%bf%e7%94%a8cloud-image%e5%81%9a%e6%a8%a1%e6%9d%bf-linux%e7%af%87","status":"publish","type":"post","link":"https:\/\/bt.079300.xyz\/index.php\/2023\/12\/08\/pve%e4%bd%bf%e7%94%a8cloud-image%e5%81%9a%e6%a8%a1%e6%9d%bf-linux%e7%af%87\/","title":{"rendered":"PVE\u4f7f\u7528Cloud Image\u505a\u6a21\u677f-Linux\u7bc7"},"content":{"rendered":"\n<p>\u4f7f\u7528PVE\u7684Cloud-Init\u529f\u80fd\uff0c\u914d\u5408Cloud Image\u955c\u50cf\uff0c\u521b\u5efa\u4e3b\u673a\u6a21\u677f\uff0c\u5feb\u901f\u751f\u6210\u65b0\u7cfb\u7edf\u3002<\/p>\n\n\n\n<p>\u524d\u8a00<\/p>\n\n\n\n<p>Cloud Image\u4e13\u7528\u4e8e\u9002\u914d\u4e91\u8ba1\u7b97\u7684\u4e00\u79cd\u955c\u50cf\u683c\u5f0f\uff08\u6a21\u677f\uff09\uff0c\u9762\u5411\u79c1\u6709\u4e91\u548c\u516c\u6709\u4e91\uff1b\u5b83\u4e0eISO\u955c\u50cf\u7684\u533a\u522b\u662f\uff0cISO\u955c\u50cf\u662f\u53ef\u5f15\u5bfc\u7684\u5e26\u5b89\u88c5\u5668\u7684\u4e00\u79cd\u955c\u50cf\u683c\u5f0f\uff0c\u901a\u5e38\u60c5\u51b5\uff0c\u8d70\u5149\u9a71\u901a\u9053\u542f\u52a8\u5b89\u88c5\u5668\uff0c\u628a\u7cfb\u7edf\u5b89\u88c5\u5230\u786c\u76d8\u4e0a\uff1b\u800c\u8fd9\u4e2a\u8fc7\u7a0b\u9700\u8981\u586b\u5199\u4e00\u4e9b\u7cfb\u7edf\u9700\u8981\u7684\u4fe1\u606f\uff0c\u5982\u8ba1\u7b97\u673a\u540d\u79f0\u3001\u7528\u6237\u540d\u4fe1\u606f\u3001\u7f51\u7edc\u4fe1\u606f\u548c\u673a\u5668\u914d\u7f6e\u4e4b\u7c7b\u7684\uff1b\u867d\u7136\u4e5f\u53ef\u4ee5\u901a\u8fc7PXE\u7684\u65b9\u5f0f\u8fdb\u884c\u5168\u81ea\u52a8\u5f15\u5bfc\u5b89\u88c5\uff0c\u4f46\u4e0e\u4e91\u955c\u50cf\u7684\u65b9\u5f0f\u8fd8\u662f\u6709\u5f88\u5927\u4e0d\u540c\uff1b\u81f3\u5c11\u4e91\u955c\u50cf\u7684\u65b9\u5f0f\u66f4\u5feb\uff0c\u4ece\u672c\u5730\u76f4\u63a5\u62c9\u8d77\u955c\u50cf\uff1b<\/p>\n\n\n\n<p>\u4e91\u955c\u50cf\u662f\u4e0d\u5e26\u5b89\u88c5\u5668\u7684\uff0c\u5b83\u672c\u8eab\u5c31\u662f\u4e2a\u865a\u62df\u78c1\u76d8\u6587\u4ef6\u683c\u5f0f\uff0c\u6362\u53e5\u8bdd\u8bf4\u5c31\u662f\uff0c\u5b83\u5c31\u662f\u4e00\u4e2a\u88c5\u597d\u7684\u7cfb\u7edf\uff0c\u52a0\u4e0aCloud-Init\u7a0b\u5e8f\u8fdb\u884c\u521d\u59cb\u5316\u3002<\/p>\n\n\n\n<p>\u4e0d\u7ba1\u662fPXE\u8fd8\u662f\u4e91\u955c\u50cf\u7684\u65b9\u5f0f\uff0c\u90fd\u6709\u4e00\u4e2a\u5171\u540c\u7684\u7279\u70b9\uff0c\u5c31\u662f\u4e00\u4e2a\u5168\u65b0\u7684\u7cfb\u7edf\uff1b\u8fd9\u91cc\u5168\u65b0\u7684\u7cfb\u7edf\u66f4\u591a\u6307\u7684\u662f\u7cfb\u7edf\u5185\u5404\u79cdID\u4f1a\u81ea\u52a8\u751f\u6210\uff0c\u8fd9\u4e00\u70b9\u5bf9\u4e8e\u9700\u8981\u642d\u5efa\u96c6\u7fa4\u7684\u73af\u5883\u6765\u8bf4\uff0c\u81f3\u5173\u91cd\u8981\uff1b\u5e76\u901a\u8fc7Cloud-Init\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u6bcf\u6b21\u5b9a\u4e49\u4e0d\u540c\u7684\u7528\u6237\u540d\u3001\u5bc6\u7801\u3001IP\u548cSSH\u5bc6\u94a5\u3002\u5728\u514b\u9686\u65b9\u9762VMware Workstation\u505a\u7684\u4e0d\u9519\u3002<\/p>\n\n\n\n<p>\u503c\u5f97\u9ad8\u5174\u7684\u662f\uff0cPVE\u7684\u975e\u8ba2\u9605\u7248\u672c\u63d0\u4f9b\u4e86\u8fd9\u4e2a\u529f\u80fd\uff0c\u914d\u5408\u64cd\u4f5c\u7cfb\u7edf\u5382\u5546\u63d0\u4f9b\u7684\u4e91\u955c\u50cf\u6587\u4ef6\uff0c\u5236\u4f5c\u955c\u50cf\u4e4b\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5feb\u901f\u7684\u514b\u9686\u51fa\u5404\u79cd\u673a\u578b\uff0c\u5b9e\u73b0\u5feb\u901f\u548c\u4e2a\u6027\u5316\u4ea4\u4ed8\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E7%89%88%E6%9C%AC%E4%BF%A1%E6%81%AF\">\u7248\u672c\u4fe1\u606f<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PVE 7.0-13<\/li>\n\n\n\n<li>CentOS-7-x86_64-GenericCloud-2009.qcow2<\/li>\n\n\n\n<li>ubuntu-20.04-server-cloudimg-amd64.img\uff0820211004\uff09<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"update\">update<\/h2>\n\n\n\n<p>2021\u5e7410\u670814\u65e5<\/p>\n\n\n\n<p><strong>\u4e0d\u77e5\u9053\u4ec0\u4e48\u539f\u56e0\uff0c\u7528Ubuntu cloud image\u505a\u7684\u6a21\u677f\uff0c\u5728\u514b\u9686\u540e\u83b7\u53d6IP\u7684\u65f6\u5019\uff0c\u514b\u9686\u51fa\u6765\u7684\u673a\u5668\u7adf\u7136\u53ea\u4f1a\u83b7\u53d6\u4e00\u4e2aIP\uff0c\u7528centos\u5c31\u4e0d\u4f1a\uff1b\u540e\u6765\u7528ubuntu\u7684ISO\u955c\u50cf\u5b89\u88c5\u540e\uff0820.04\u9ed8\u8ba4\u5df2\u7ecf\u5b89\u88c5cloud-init\uff09\u624b\u52a8\u6dfb\u52a0\u5916\u90e8\u7684Cloud-Init\uff0c\u505a\u6a21\u677f\uff0c\u8fd9\u4e2a\u95ee\u9898\u89e3\u51b3\u4e86\uff1b<\/strong><\/p>\n\n\n\n<p>\u5373\u4fbf\u662f\u4f7f\u7528\u4e0a\u8ff0\u65b9\u6cd5\u4e5f\u4e0d\u884c\uff1b\u53ea\u8981\u662f\u514b\u9686\u7684\uff0c\u5c31\u4f1a\u51fa\u73b0\u95ee\u9898\uff1b\u5728pfsense\u548copenwrt\u505a\u4e8c\u7ea7\u8def\u7531\u7684\u65f6\u5019\uff1b<\/p>\n\n\n\n<p>\u8fd9\u79cd\u95ee\u9898\u53ea\u4f1a\u51fa\u73b0\u5728Ubuntu\u4e0a\uff0cCentos\u5c31\u4e0d\u4f1a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-26.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">pfsense<\/figcaption><\/figure>\n\n\n\n<p>\u5728openwrt\u4e0a\u4f1a\u51fa\u73b0\u62a2\u6ce8\u7684\u60c5\u51b5\uff0cu20-1\u548cu20-2\u8c01\u91cd\u542f\u7f51\u7edc\u670d\u52a1\uff0c\u8fd9\u4e2aIP\u5c31\u6ce8\u518c\u7ed9\u8c01<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-27.png\" alt=\"\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u4e3b\u6d41\u7684\u64cd\u4f5c\u7cfb\u7edf\u5382\u5546\u90fd\u63d0\u4f9b\u4e86\u591a\u79cdCPU\u67b6\u6784\u548c\u591a\u79cd\u865a\u62df\u5316\u5e73\u53f0\u7684\u4e91\u955c\u50cf\u683c\u5f0f\uff1b<\/p>\n\n\n\n<p><a href=\"https:\/\/cloud-images.ubuntu.com\/releases\/?ref=cpci.dev\">Ubuntu Cloud Images (RELEASED)<\/a>\u3001<a href=\"https:\/\/cloud.centos.org\/centos\/?ref=cpci.dev\">Cloud CentOS<\/a><\/p>\n\n\n\n<p>PVE\u662f\u57fa\u4e8eDebian\u7684Linux\uff0c\u4f7f\u7528\u4e86QEMU\/KVM\u865a\u62df\u5316\u6280\u672f\uff1bCentOS\u9ed8\u8ba4\u63d0\u4f9bqcow2\u683c\u5f0f\uff0c\u800cUbuntu\u5219\u63d0\u4f9b\u7684KVM\u662fimg\u683c\u5f0f\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"%E5%88%9B%E5%BB%BA%E8%99%9A%E6%8B%9F%E6%9C%BA%E6%A8%A1%E6%9D%BF\">\u521b\u5efa\u865a\u62df\u673a\u6a21\u677f<\/h1>\n\n\n\n<p>\u57fa\u672c\u6d41\u7a0b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u673a<\/li>\n\n\n\n<li>\u5220\u9664\u786c\u76d8<\/li>\n\n\n\n<li>\u8f6c\u6362\u4e91\u955c\u50cf\u4e3a\u78c1\u76d8\u5e76\u6302\u8f7d<\/li>\n\n\n\n<li>\u6dfb\u52a0Cloud-Init\u5e76\u914d\u7f6e<\/li>\n\n\n\n<li>\u542f\u52a8\u64cd\u4f5c\u7cfb\u7edf\u5e76\u914d\u7f6e<\/li>\n\n\n\n<li>\u5173\u673a\u8f6c\u6362\u4e3a\u6a21\u677f\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E8%99%9A%E6%8B%9F%E6%9C%BA\">\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u673a<\/h2>\n\n\n\n<p>\u8fd9\u91cc\u7684\u540d\u79f0\uff0c\u4f1a\u81ea\u52a8\u4f5c\u4e3a\u672c\u6b21\u64cd\u4f5c\u7cfb\u7edf\u7684\u8ba1\u7b97\u673a\u540d\u79f0\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-12.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u8bbe\u7f6e\u865a\u62df\u673a\u540d\u79f0<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-13.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u4e0d\u4f7f\u7528\u4efb\u4f55\u4ecb\u8d28<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-14.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u52fe\u9009QEMU\u4ee3\u7406<\/figcaption><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u9ed8\u8ba4\u5373\u53ef\uff0c\u4e00\u4f1a\u662f\u8981\u5220\u9664\u8fd9\u4e2a\u786c\u76d8\u7684\uff1b<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-15.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u4fdd\u6301\u9ed8\u8ba4<\/figcaption><\/figure>\n\n\n\n<p>\u4e00\u8def\u8d70\u4e0b\u53bb\uff0c\u5230\u5b8c\u6210\u3002<\/p>\n\n\n\n<p>\u5148\u5206\u79bb\u786c\u76d8\uff0c\u5728\u5220\u9664<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-17.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u5206\u79bb\u786c\u76d8<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-18.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u5220\u9664\u786c\u76d8<\/figcaption><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"%E4%B8%8B%E8%BD%BD%E5%B9%B6%E8%BD%AC%E6%8D%A2%E9%95%9C%E5%83%8F\">\u4e0b\u8f7d\u5e76\u8f6c\u6362\u955c\u50cf<\/h1>\n\n\n\n<p>\u4e0b\u8f7d\u955c\u50cf\uff0c\u901a\u8fc7SSH\u767b\u5f55\u5230\u6bcd\u673a\u4e0a\uff1b\u8fdb\u5165\u955c\u50cf\u7684\u5b58\u653e\u76ee\u5f55\u6216\u8005\u4f7f\u7528Web\u9875\u9762\u7684\u4e0b\u8f7d\u955c\u50cf\u529f\u80fd\u4e5f\u53ef\u4ee5\uff1b\u4f46\u662f\u4e4b\u540e\u7684\u8f6c\u6362\u4e91\u955c\u50cf\u4e3a\u78c1\u76d8\u7684\u64cd\u4f5c\u9700\u8981\u547d\u4ee4\u884c\u6765\u5b8c\u6210\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u6ca1\u6709\u6dfb\u52a0\u8fc7\u989d\u5916\u7684\u5b58\u50a8\uff0c\u90a3\u4e48\u9ed8\u8ba4\u8def\u5f84\u5728&nbsp;<code>\/var\/lib\/vz\/template\/iso<\/code>&nbsp;\u76ee\u5f55\u4e0b\uff1b\u4ee5Ubuntu\u4e3a\u4f8b\uff1b\u4f7f\u7528&nbsp;<code>qm<\/code>&nbsp;\u547d\u4ee4\u5c06\u4e0b\u8f7d\u7684\u4e91\u955c\u50cf\u6587\u4ef6\u8f6c\u4e3a\u4e00\u4e2a\u78c1\u76d8\u6587\u4ef6\uff1b\u6211\u8fd9\u91cc\u6dfb\u52a0\u4e86&nbsp;<code>\/raid0<\/code>&nbsp;\u76ee\u5f55\u5b58\u50a8\u865a\u62df\u673a\u548c\u955c\u50cf\u6587\u4ef6\uff1b<\/p>\n\n\n\n<p><strong>bug\uff1a\u4f7f\u7528ubuntu-20.04-server-cloudimg-amd64-disk-kvm.img\u8fd9\u4e2a\u955c\u50cf\u6216\u5f00\u673a\u4f1a\u63d0\u793aattempting initrdless boot\uff1b\u6240\u4ee5\u5f97\u4e0b\u8f7d\u4e0d\u5e26KVM\u5173\u952e\u5b57\u7684\u955c\u50cf\uff1b\u81f3\u5c11\u8fd9\u4e2a\u65e5\u671f\u7248\u672c\uff0820211004\uff09\u662f\u6709\u95ee\u9898\u7684\u3002<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u4e0b\u8f7d\u955c\u50cf\nwget https:\/\/cloud-images.ubuntu.com\/releases\/focal\/release-20211004\/ubuntu-20.04-server-cloudimg-amd64.img\n\n# \u8f6c\u6362\u4e91\u955c\u50cf\u4e3a\u865a\u62df\u78c1\u76d8\nqm importdisk 104 ubuntu-20.04-server-cloudimg-amd64.img raid0 --format=qcow2\n# 104 \u4e3a\u865a\u62df\u673a\u7684ID\n# raid0 \u4e3a\u5b58\u50a8\u7684\u540d\u79f0\uff0c\u5982\u679c\u6ca1\u6709\u989d\u5916\u5b58\u50a8\uff0c\u5219\u9ed8\u8ba4\u662flocal\n# --format=qcow2 \u4e3a\u8f6c\u6362\u540e\u7684\u683c\u5f0f\n\n# \u770b\u5230Successfully\uff0c\u8f6c\u6362\u5b8c\u6210\nSuccessfully imported disk as 'unused0:raid0:104\/vm-104-disk-0.qcow2'<\/code><\/pre>\n\n\n\n<p><strong>CentOS\u7684Cloud Image\u63d0\u4f9b\u4e86qcow2\u683c\u5f0f\uff0c\u5219\u65e0\u9700\u4f7f\u7528&#8211;format\u53c2\u6570<\/strong><\/p>\n\n\n\n<p>\u56de\u5230\u865a\u62df\u673a\u201c\u786c\u4ef6\u201d\u9875\u9762\uff1b\u591a\u4e86\u4e00\u5757\u201c\u672a\u4f7f\u7528\u7684\u78c1\u76d80\u201d\uff1b\u53cc\u51fb\u540e\uff0c\u70b9\u51fb\u6dfb\u52a0\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-19.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u6dfb\u52a0\u65b0\u786c\u76d8<\/figcaption><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u521d\u59cb\u78c1\u76d8\u5bb9\u91cf\u6bd4\u8f83\u5c0f\uff0c\u53ef\u4ee5\u70b9\u51fb\u78c1\u76d8\u201c\u8c03\u6574\u78c1\u76d8\u5927\u5c0f\u201d\uff1b\u663e\u793a\u7684\u662fMB\uff0c<strong>\u589e\u91cf<\/strong>\u7684\u662fGB\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-24.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u8c03\u6574\u78c1\u76d8\u5927\u5c0f<\/figcaption><\/figure>\n\n\n\n<p>\u5728\u70b9\u51fb\u201c\u6dfb\u52a0\u201dCloud-Init\u8bbe\u5907\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-20.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u6dfb\u52a0Cloud-Init\u8bbe\u5907<\/figcaption><\/figure>\n\n\n\n<p>\u9009\u62e9\u5b58\u50a8\u548cSCSI ID\u4e3a1\uff0c\u521b\u5efa<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-21.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u6dfb\u52a0Cloud-Init\u8bbe\u5907<\/figcaption><\/figure>\n\n\n\n<p>\u7531\u4e8e\u521a\u521a\u5220\u9664\u4e86\u78c1\u76d8\uff0c\u6240\u4ee5\u542f\u52a8\u9009\u9879\u91cc\u4e3a\u7a7a\uff0c\u8fd9\u65f6\u5019\u9700\u8981\u52fe\u9009\u4e00\u4e0b\u521a\u521a\u6dfb\u52a0\u7684\u65b0\u78c1\u76d8\u4e3a\u542f\u52a8\u76d8\u3002\u52fe\u9009\u201cscsi0\u201d\u5e76\u62d6\u62fd\u5230\u7b2c\u4e00\u4e2a\uff0c\u6216\u8005\u53d6\u6d88\u5176\u4ed6\u7684\uff0c\u53ea\u4fdd\u7559scsi0\u4e5f\u53ef\u4ee5\u3002<\/p>\n\n\n\n<p>\u5149\u9a71\u9ed8\u8ba4\u662fIDE\u63a5\u53e3\uff0c\u53ef\u4ee5\u628a\u5b83\u5220\u9664\u4e86\uff0c\u91cd\u65b0\u6dfb\u52a0\u4e3aSCSI 2\uff1b\u9009\u9879\u4e3a\u201c\u4e0d\u4f7f\u7528\u4efb\u4f55\u4ecb\u8d28\u201d\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-25.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u8fd9\u4e2a\u65f6\u5019\u5c31\u53ef\u4ee5\u8bbe\u7f6eCloud-Init\u9009\u9879\u4e86\uff1b\u7531\u4e8e\u6211\u4eec\u4f7f\u7528\u7684\u662fUbuntu\uff0c\u5219\u8fd9\u91cc\u4e0d\u80fd\u8bbe\u7f6e\u7528\u6237\u4e3a\u201croot\u201d\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u8d26\u6237Ubuntu\u9ed8\u8ba4\u7981\u7528\uff1b\u5982\u679c\u6709\u9700\u8981\uff0c\u53ef\u4ee5\u5728\u4e4b\u540e\u7684\u542f\u52a8\u540e\u5f00\u542froot\uff0c\u518d\u751f\u6210\u6a21\u677f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cpci.dev\/content\/images\/2021\/10\/image-23.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5728\u7ee7\u7eed\u586b\u5199SSH\u516c\u94a5\uff08\u53ef\u4ee5\u52a0\u8f7d\u6587\u4ef6\uff09\u548cIP\u914d\u7f6e\uff0c\u8fd9\u4e2a\u65f6\u5019\u7f51\u5361\u7684Mac\u5730\u5740\u5df2\u7ecf\u751f\u6210\uff0cIP\u914d\u7f6e\u7684\u9009\u9879\u4e3aDHCP\u548cStatic\u3002\u8fd9\u4e9b\u5c31\u7eea\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u542f\u52a8\u8fd9\u4e2a\u7cfb\u7edf\u4e86\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E9%85%8D%E7%BD%AE%E6%A8%A1%E6%9D%BF%E7%B3%BB%E7%BB%9F\">\u914d\u7f6e\u6a21\u677f\u7cfb\u7edf<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u8bbe\u7f6e\u65f6\u533a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo timedatectl set-timezone Asia\/Shanghai<\/code><\/pre>\n\n\n\n<p>2. \u8bbe\u7f6eAPT\u4ed3\u5e93\u6e90<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo sed -i 's\/archive.ubuntu.com\/mirrors.aliyun.com\/g' \/etc\/apt\/sources.list<\/code><\/pre>\n\n\n\n<p>3. \u5b89\u88c5\u8f6f\u4ef6\u6216\u66f4\u65b0\u7cfb\u7edf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u66f4\u65b0\u6e90\u548c\u5b89\u88c5\u5e38\u7528\u8f6f\u4ef6\nsudo apt update &amp;&amp; sudo apt install vim bash-completion -y\n\n# \u5b89\u88c5qemu\u4ee3\u7406\nsudo apt install qemu-guest-agent -y\nsudo systemctl enable --now qemu-guest-agent\n\n# \u66f4\u65b0\u7cfb\u7edf\nsudo apt upgrade<\/code><\/pre>\n\n\n\n<p>4. \u4fee\u6539SSH\u914d\u7f6e\uff1b\uff08\u6709\u5fc5\u8981\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u5f00\u542froot\u767b\u5f55\uff08\u5982\u679c\u9700\u8981\u7684\u8bdd\uff1b\u8fd9\u91cc\u5f00\u542f\u4e86\u4e4b\u540eCloud-Init\u7528\u6237\u5c31\u53ef\u4ee5\u8bbe\u7f6eroot\uff09\nPermitRootLogin yes\n\n# \u5f00\u542f\u5bc6\u94a5\u767b\u5f55\nPubkeyAuthentication yes\n# \u5bc6\u94a5\u8def\u5f84\nAuthorizedKeysFile\n\n# \u5f00\u542f\u5bc6\u7801\u767b\u5f55\uff08\u9ed8\u8ba4\u53ea\u5141\u8bb8\u5bc6\u94a5\u767b\u5f55\uff09\nPasswordAuthentication yes\n\n# \u4e0d\u5141\u8bb8\u7a7a\u5bc6\u7801\u767b\u5f55\nPermitEmptyPasswords no\n\n# \u5173\u95ed\u8fde\u63a5\u7684DNS\u89e3\u6790\nUseDNS no<\/code><\/pre>\n\n\n\n<p>5. \u6e05\u7406\u7f13\u5b58<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt autoclean all<\/code><\/pre>\n\n\n\n<p>6. \u5176\u4ed6\u81ea\u5b9a\u4e49\u914d\u7f6e<\/p>\n\n\n\n<p>\u5173\u673a\uff0c\u8f6c\u6362\u4e3a\u6a21\u677f\uff0c\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"%E5%90%8E%E8%AE%B0\">\u540e\u8bb0<\/h1>\n\n\n\n<p>\u4f7f\u7528Cloud-Init\u7684\u65b9\u5f0f\u53ef\u4ee5\u4e0d\u7528\u67b6\u8bbePXE\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u7528\u56e0\u4e3a\u666e\u901a\u7684\u514b\u9686\u5bfc\u81f4\u65b0\u7cfb\u7edf\u7684\u5404\u79cdID\u548c\u6e90\u7cfb\u7edf\u76f8\u540c\u3002\u5bf9\u4e8e\u7ecf\u5e38\u9700\u8981\u505a\u5b9e\u9a8c\u7684\u73af\u5883\u6765\u8bf4\uff0c\u5feb\u901f\u521d\u59cb\u5316\u4e00\u4e9b\u5168\u65b0\u7684\u64cd\u4f5c\u7cfb\u7edf\u6548\u7387\u5f88\u9ad8\u3002\u53e6\u5916\uff0c\u5982\u679c\u4e0d\u662f\u96c6\u7fa4\u6a21\u5f0f\uff0c\u53c8\u6709\u591a\u53f0PVE\u7684\u8bdd\uff0c\u53ea\u9700\u8981\u505a\u597d\u4e00\u4e2a\uff0c\u4f7f\u7528PVE\u7684\u865a\u62df\u673a\u5907\u4efd\u4e0e\u6062\u590d\u529f\u80fd\uff0c\u4f20\u8f93\u5230\u5176\u4ed6\u673a\u5668\u4e0a\uff0c\u5219\u66f4\u65b9\u4fbf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528PVE\u7684Cloud-Init\u529f\u80fd\uff0c\u914d\u5408Cloud Image\u955c\u50cf\uff0c\u521b\u5efa\u4e3b\u673a\u6a21\u677f\uff0c\u5feb\u901f\u751f\u6210\u65b0\u7cfb\u7edf\u3002 \u524d\u8a00 C&hellip; <a class=\"more-link\" href=\"https:\/\/bt.079300.xyz\/index.php\/2023\/12\/08\/pve%e4%bd%bf%e7%94%a8cloud-image%e5%81%9a%e6%a8%a1%e6%9d%bf-linux%e7%af%87\/\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">PVE\u4f7f\u7528Cloud Image\u505a\u6a21\u677f-Linux\u7bc7<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/posts\/80","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=80"}],"version-history":[{"count":1,"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/posts\/80\/revisions"}],"predecessor-version":[{"id":81,"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/posts\/80\/revisions\/81"}],"wp:attachment":[{"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bt.079300.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}