{"id":2262,"date":"2025-08-05T10:27:51","date_gmt":"2025-08-05T02:27:51","guid":{"rendered":"https:\/\/www.madbull.site\/?p=2262"},"modified":"2025-08-06T15:04:08","modified_gmt":"2025-08-06T07:04:08","slug":"ubuntu%e5%a2%9e%e5%8a%a0%e4%b8%80%e4%b8%aa%e7%b3%bb%e7%bb%9f%e4%bb%93%e5%ba%93%e6%b5%81%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.madbull.site\/?p=2262","title":{"rendered":"ubuntu\u589e\u52a0\u4e00\u4e2a\u8f6f\u4ef6\u4ed3\u5e93\u6d41\u7a0b"},"content":{"rendered":"\n<p>\u5927\u90e8\u5206\u8f6f\u4ef6\u5b89\u88c5\uff0c\u53ea\u9700\u8981 apt install xxxx \u5c31\u53ef\u4ee5\u4e86\uff0c\u4f46\u662f\u6709\u4e9b\u8f6f\u4ef6\u5e76\u6ca1\u6709\u5728\u7cfb\u7edf\u5185\u7f6e\u8f6f\u4ef6\u5e93\u91cc\uff0c\u9700\u8981\u6dfb\u52a0\u8be5\u8f6f\u4ef6\u7684\u4ed3\u5e93\u5730\u5740\uff0c\u5e76\u4e14\u6dfb\u52a0\u5b98\u65b9\u63d0\u4f9b\u7684 GPG \u5bc6\u94a5\uff0c\u624d\u53ef\u4ee5\u4f7f\u7528 apt \u7684\u65b9\u5f0f\u5b89\u88c5\u8f6f\u4ef6\u3002\u6dfb\u52a0\u53ef\u4fe1\u8f6f\u4ef6\u6e90\u7684\u5177\u4f53\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u7f16\u8f91 <code>\/etc\/apt\/sources.list<\/code> \u6587\u4ef6\u6216\u6dfb\u52a0\u65b0\u7684 <code>.list<\/code> \u6587\u4ef6<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u76f4\u63a5\u7f16\u8f91 <code>\/etc\/apt\/sources.list<\/code> \u6587\u4ef6<\/strong>\uff1a\u8fd9\u4e2a\u6587\u4ef6\u5305\u542b\u4e86\u6240\u6709\u9ed8\u8ba4\u7684 APT \u8f6f\u4ef6\u6e90\u5730\u5740\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0 \u8f6f\u4ef6\u6e90\u5730\u5740\u3002\u683c\u5f0f\u901a\u5e38\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>deb http:\/\/archive.example.com\/repository distro component1 component2 component3\ndeb-src http:\/\/archive.example.com\/repository distro component1 component2 component3<\/code><\/pre>\n\n\n\n<p>\u5176\u4e2d\uff0c<code>http:\/\/archive.example.com\/repository<\/code> \u662f\u4ed3\u5e93\u7684 URL\uff0c<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-3-color\"><code>distro<\/code> \u5e94\u66ff\u6362\u4e3a Ubuntu \u7248\u672c\u4ee3\u53f7<\/mark><\/strong>\uff08\u4f8b\u5982 bionic\u3001focal \u7b49\uff09\uff0c<code>component1<\/code>, <code>component2<\/code>, <code>component3<\/code> \u5219\u662f\u8be5\u4ed3\u5e93\u7684\u4e0d\u540c\u7ec4\u4ef6\uff08\u901a\u5e38\u662f main, universe, multiverse\u7b49\uff09\u3002<\/p>\n\n\n\n<p><strong>\u521b\u5efa\u4e00\u4e2a\u5355\u72ec\u7684 <code>.list<\/code> \u6587\u4ef6<\/strong>\uff1a\u8fd9\u662f\u63a8\u8350\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3a\u5b83\u66f4\u52a0\u6574\u6d01\u4e14\u6613\u4e8e\u7ba1\u7406\u3002\u5728 <code>\/etc\/apt\/sources.list.d\/<\/code> \u76ee\u5f55\u4e0b\u4e3a\u65b0\u4ed3\u5e93\u521b\u5efa\u4e00\u4e2a\u5355\u72ec\u7684 <code>.list<\/code> \u6587\u4ef6\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u6dfb\u52a0 GPG \u5bc6\u94a5\uff08\u5982\u679c\u9700\u8981\uff09<\/h3>\n\n\n\n<p>\u4e00\u4e9b\u4ed3\u5e93\u8981\u6c42\u5148\u6dfb\u52a0\u4ed6\u4eec\u7684 GPG \u5bc6\u94a5\u4ee5\u9a8c\u8bc1\u8f6f\u4ef6\u5305\u7684\u771f\u5b9e\u6027\u3002\u9700\u8981 GPG \u5bc6\u94a5\u7684\u4ed3\u5e93\uff0c\u5b98\u65b9\u4f1a\u63d0\u4f9b GPG\u516c\u94a5\u6587\u4ef6\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b8c\u6210\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u660e\u6587\u683c\u5f0f\u7684\u5bc6\u94a5\u76f4\u63a5\u4f7f\u7528\u3002\nwget -qO - https:\/\/archive.example.com\/repository\/here_is_the_key_file.asc | apt-key add -\n\n# \u4e8c\u8fdb\u5236 GPG \u5bc6\u94a5\u9700\u8981\u505a\u4e2a\u8f6c\u6362\nwget -qO - https:\/\/archive.example.com\/repository\/here_is_the_key_file | gpg --dearmor - | apt-key add -<\/code><\/pre>\n\n\n\n<p>\u786e\u4fdd\u5c06\u4e0a\u9762\u7684 URL \u66ff\u6362\u4e3a\u5b9e\u9645\u7684\u5bc6\u94a5\u4f4d\u7f6e\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u66f4\u65b0\u8f6f\u4ef6\u5305\u5217\u8868<\/h3>\n\n\n\n<p>\u6700\u540e\u9700\u8981\u66f4\u65b0\u672c\u5730\u7684\u8f6f\u4ef6\u5305\u6570\u636e\u5e93\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6837\uff0cAPT \u5c31\u4f1a\u77e5\u9053\u65b0\u7684\u8f6f\u4ef6\u6e90\uff0c\u5e76\u53ef\u4ee5\u4ece\u90a3\u91cc\u5b89\u88c5\u8f6f\u4ef6\u5305\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u90e8\u5206\u8f6f\u4ef6\u5b89\u88c5\uff0c\u53ea\u9700\u8981 apt install xxxx \u5c31\u53ef\u4ee5\u4e86\uff0c\u4f46\u662f\u6709\u4e9b\u8f6f\u4ef6\u5e76\u6ca1\u6709\u5728\u7cfb\u7edf\u5185\u7f6e\u8f6f\u4ef6\u5e93\u91cc\uff0c\u9700\u8981 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":450,"comment_status":"open","ping_status":"open","sticky":false,"template":"wp-custom-template-my","format":"standard","meta":{"footnotes":""},"categories":[135,131],"tags":[509,237,672],"class_list":["post-2262","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-131","tag-apt","tag-linux","tag-672"],"_links":{"self":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2262"}],"version-history":[{"count":2,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2262\/revisions"}],"predecessor-version":[{"id":2270,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2262\/revisions\/2270"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/media\/450"}],"wp:attachment":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}