{"id":420,"date":"2024-03-24T22:43:34","date_gmt":"2024-03-24T14:43:34","guid":{"rendered":"https:\/\/blog.messyghost.net\/?p=420"},"modified":"2026-02-10T18:21:13","modified_gmt":"2026-02-10T10:21:13","slug":"%e5%b0%b1%e7%ae%97%e4%b8%8d%e4%bd%bf%e7%94%a8debootstrap%e4%b9%9f%e8%a6%81%e5%ae%89%e8%a3%85debian","status":"publish","type":"post","link":"https:\/\/blog.messyghost.net\/?p=420","title":{"rendered":"\u5c31\u7b97\u4e0d\u4f7f\u7528debootstrap\u4e5f\u8981\u5b89\u88c5Debian"},"content":{"rendered":"\n<p>\u4f17\u6240\u5468\u77e5\uff0c<strong>debootstrap<\/strong>\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b89\u88c5\u4e00\u4e2a\u65e0\u6bd4\u7cbe\u7b80\u7684Debian\u7cfb\u7edf\u3002\u4f46\u662f\uff0c\u5728\u4f7f\u7528\u4e86<strong>dnf<\/strong>\u76f4\u63a5\u5b89\u88c5\u7cbe\u7b80\u7248Fedora\u540e\uff0c\u6211\u4e0d\u7981\u601d\u8003\uff1a\u4e3a\u4ec0\u4e48\u6211\u4e0d\u80fd\u7528Debian\u81ea\u5e26\u7684\u5305\u7ba1\u7406\u5668(?)\u6765\u90e8\u7f72\u4e00\u4e2a\u7cfb\u7edf\uff0c\u53cd\u800c\u8981\u7528\u989d\u5916\u7684\u7a0b\u5e8f\u5462\uff1f\u4e8e\u662f\u6211\u5f00\u59cb\u4e86\u5c1d\u8bd5\u3002<\/p>\n\n\n\n<p><strong>apt-get<\/strong>\u4f3c\u4e4e\u5e76\u672a\u63d0\u4f9b\u5f88\u65b9\u4fbf\u5730\u5728\u5176\u4ed6\u76ee\u5f55\u5b89\u88c5\u8f6f\u4ef6\u5305\u7684\u529f\u80fd\u3002\u6240\u4ee5\uff0c\u6700\u540e\u7684\u65b9\u6848\u662f\u7528<strong>apt-get<\/strong>\u83b7\u53d6\u8f6f\u4ef6\u5305\uff0c\u7528<strong>apt-cache<\/strong>\u5206\u6790\u4f9d\u8d56\u4ee5\u53ca\u7528<strong>dpkg<\/strong>\u5b89\u88c5\u8f6f\u4ef6\u5305\u3002<\/p>\n\n\n\n<p>\u9996\u5148\u8981\u5b89\u88c5\u6240\u6709\u6807\u8bb0\u4e3a<em>essential<\/em>\u7684\u5305\uff0c\u8fd9\u4e9b\u662f\u4e00\u4e2aDebian\u7cfb\u7edf\u5fc5\u987b\u7684\u5305\u3002\u8fd9\u53ef\u4ee5\u7528<strong>apt-cache<\/strong>\u547d\u4ee4\u5217\u51fa\u6765\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>% apt-cache show \"~E\" | grep -oP \"(?&lt;=Package: ).*+\" &gt; essential-packages<\/code><\/pre>\n\n\n\n<p>\u5b83\u4eec\u7684\u4f9d\u8d56\u4e5f\u540c\u6837\u91cd\u8981\uff08\u987a\u4fbf\u6392\u5e8f\u53bb\u91cd\uff09\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>% cat essential-packages| xargs -i apt-cache --recurse --no-suggests --no-recommends --no-enhances --no-replaces --no-conflicts --no-breaks depends {} | grep \"^\\w\" | sort | uniq &gt; pkgs-to-install<\/code><\/pre>\n\n\n\n<p>\u4e0d\u8fc7\uff0c\u8fd9\u547d\u4ee4\u4e5f\u4f1a\u52a0\u5165\u4e00\u4e9b\u672c\u53ef\u4ee5\u591a\u9009\u4e00\u7684\u4f9d\u8d56\uff0c\u5b83\u4eec\u6709\u65f6\u751a\u81f3\u662f\u51b2\u7a81\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u5e94\u8be5\u5220\u9664\u4e00\u70b9\u3002\u6bd4\u5982<strong>libelogind0<\/strong>\uff08\u548c<strong>libsystemd0<\/strong>\u51b2\u7a81\uff09\uff0c\u8fd8\u63a8\u8350\u5220\u9664<strong>gpgv1<\/strong>\uff08\u5df2\u8fc7\u65f6\uff09\u3002<\/p>\n\n\n\n<p>\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u5f00\u59cb\u4e0b\u8f7d\uff0c\u7136\u540e\u5b89\u88c5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>% apt-get download $(cat pkgs-to-install)\n# ls *.deb | xargs -i dpkg -x {} &lt;fakeroot&gt;\n# dpkg --root=&lt;fakeroot&gt; -i --force-depends *.deb<\/code><\/pre>\n\n\n\n<p>\u5176\u4e2d\u7b2c\u4e8c\u6761\u547d\u4ee4\u662f\u628a\u6240\u6709\u7684\u5305\u89e3\u538b\u5230<em>fakeroot<\/em>\uff0c\u4f46\u5e76\u6ca1\u6709\u66f4\u65b0\u6570\u636e\u5e93\uff0c\u8fd9\u662f\u4e3a\u4e86\u9632\u6b62\u90e8\u5206\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9700\u8981\u7684\u7a0b\u5e8f\u8dd1\u4e0d\u8d77\u6765\u3002\u7b2c\u4e8c\u904d\u5219\u662f\u771f\u6b63\u5730\u8f6f\u4ef6\u5b89\u88c5\u5305\uff08\u9632\u6b62\u56e0\u4e3a\u5b89\u88c5\u987a\u5e8f\u95ee\u9898\u51fa\u9519\uff0c\u6240\u4ee5\u5f3a\u5236\u8981\u6c42\u65e0\u89c6\u4f9d\u8d56\uff0c\u6bd5\u7adf\u6211\u4eec\u4f9d\u8d56\u5fc5\u5b9a\u662f\u9f50\u5168\u7684\uff09\u3002<\/p>\n\n\n\n<p>\u5c31\u597d\u4e86\u3002\uff08\u867d\u7136usrmerge\u8fd9\u4e00\u6b65\u5e76\u6ca1\u6709\u5b8c\u6210\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f17\u6240\u5468\u77e5\uff0cdebootstrap\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b89\u88c5\u4e00&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/blog.messyghost.net\/?p=420\">Continue reading<span class=\"screen-reader-text\">\u5c31\u7b97\u4e0d\u4f7f\u7528debootstrap\u4e5f\u8981\u5b89\u88c5Debian<\/span><\/a><\/div>\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-420","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=\/wp\/v2\/posts\/420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=420"}],"version-history":[{"count":8,"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=\/wp\/v2\/posts\/420\/revisions"}],"predecessor-version":[{"id":449,"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=\/wp\/v2\/posts\/420\/revisions\/449"}],"wp:attachment":[{"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.messyghost.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}