{"id":83683,"date":"2024-03-28T17:39:33","date_gmt":"2024-03-28T09:39:33","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=83683"},"modified":"2024-03-28T17:39:33","modified_gmt":"2024-03-28T09:39:33","slug":"linux%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e5%b7%b2%e5%ae%89%e8%a3%85%e7%9a%84%e8%bd%af%e4%bb%b6%e5%8c%85","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/83683.html","title":{"rendered":"Linux\u5982\u4f55\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/03\/uploading_images2024-03-19_16-04-16_3695.png?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"Linux\u5982\u4f55\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\" \/><\/p>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u67e5\u770b\u5df2\u5b89\u88c5\u8f6f\u4ef6\u5305\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5e38\u7528\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528<strong>\u5305\u7ba1\u7406\u5668\u547d\u4ee4\u3001\u67e5\u8be2\u5b89\u88c5\u6570\u636e\u5e93\u3001\u5229\u7528\u56fe\u5f62\u5316\u5de5\u5177<\/strong>\u3002\u4f8b\u5982\uff0c\u5728\u57fa\u4e8eDebian\u7684\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528`dpkg -l`\u547d\u4ee4\u5217\u51fa\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\uff1b\u5728\u57fa\u4e8eRed Hat\u7684\u7cfb\u7edf\u5982CentOS\u4e2d\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7`rpm -qa`\u547d\u4ee4\u67e5\u8be2\u3002<strong>\u5bf9\u4e8e\u5177\u4f53\u7684\u5305\u7ba1\u7406\u5668\u5de5\u5177\uff0c\u5982APT\u6216YUM\uff0c\u7528\u6237\u4e5f\u53ef\u4ee5\u5229\u7528\u5176\u63d0\u4f9b\u7684\u67e5\u8be2\u529f\u80fd\u3002<\/strong><\/p>\n<p>\u4e8b\u5b9e\u4e0a\uff0c\u4e86\u89e3\u5982\u4f55\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\u5bf9\u4e8e\u7cfb\u7edf\u7ba1\u7406\u548c\u8f6f\u4ef6\u7ef4\u62a4\u81f3\u5173\u91cd\u8981\u3002\u5b83\u80fd\u591f\u5e2e\u52a9\u7528\u6237\u76d1\u63a7\u7cfb\u7edf\u7684\u72b6\u6001\uff0c\u505a\u51fa\u6070\u5f53\u7684\u7ba1\u7406\u51b3\u7b56\uff0c\u4f8b\u5982\u5347\u7ea7\u3001\u66ff\u6362\u6216\u5220\u9664\u7279\u5b9a\u8f6f\u4ef6\u5305\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u51e0\u79cd\u4e3b\u6d41\u7684\u65b9\u6cd5\u6765\u6267\u884c\u8fd9\u4e00\u64cd\u4f5c\u3002<\/p>\n<p>&#8212;<\/p>\n<h2><strong>\u4e00\u3001\u4f7f\u7528DPKG\u5de5\u5177\uff08\u9002\u7528\u4e8eDebian\u53ca\u5176\u884d\u751f\u7248\uff09<\/strong><\/h2>\n<p>DPKG\u662fDebian\u53ca\u5176\u884d\u751f\u7248\u5982Ubuntu\u7cfb\u7edf\u4e2d\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u3002\u5b83\u63d0\u4f9b\u4e86\u67e5\u8be2\u5df2\u5b89\u88c5\u8f6f\u4ef6\u5305\u7684\u529f\u80fd\u3002<\/p>\n<p><strong>1. \u5217\u51fa\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305<\/strong><\/p>\n<p>\u4f7f\u7528`dpkg -l`\u547d\u4ee4\u53ef\u4ee5\u5217\u51fa\u7cfb\u7edf\u4e0a\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u663e\u793a\u8f6f\u4ef6\u5305\u7684\u540d\u79f0\u3001\u7248\u672c\u3001\u67b6\u6784\u4ee5\u53ca\u4e00\u4e2a\u7b80\u77ed\u7684\u63cf\u8ff0\u3002<\/p>\n<p><strong>2. \u67e5\u627e\u7279\u5b9a\u8f6f\u4ef6\u5305<\/strong><\/p>\n<p>\u5982\u679c\u9700\u8981\u67e5\u627e\u67d0\u4e2a\u7279\u5b9a\u7684\u8f6f\u4ef6\u5305\u662f\u5426\u5df2\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528`dpkg -l | grep package_name`\uff0c\u8fd9\u5c06\u8fc7\u6ee4\u51fa\u5305\u542b\u7279\u5b9a\u540d\u79f0\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\n<h2><strong>\u4e8c\u3001\u4f7f\u7528RPM\u5de5\u5177\uff08\u9002\u7528\u4e8eRed Hat\u53ca\u5176\u884d\u751f\u7248\uff09<\/strong><\/h2>\n<p>RPM\uff08Red Hat Package Manager\uff09\u662fRed Hat\u53ca\u5176\u884d\u751f\u7248\u5982Fedora\u548cCentOS\u4e2d\u7684\u5305\u7ba1\u7406\u5668\u3002<\/p>\n<p><strong>1. \u67e5\u8be2\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305<\/strong><\/p>\n<p>\u901a\u8fc7\u6267\u884c`rpm -qa`\u547d\u4ee4\uff0c\u7528\u6237\u53ef\u4ee5\u83b7\u53d6\u7cfb\u7edf\u4e2d\u6240\u6709\u5df2\u5b89\u88c5\u7684RPM\u5305\u5217\u8868\u3002<\/p>\n<p><strong>2. \u67e5\u8be2\u7279\u5b9a\u8f6f\u4ef6\u5305<\/strong><\/p>\n<p>\u8981\u68c0\u67e5\u7279\u5b9a\u8f6f\u4ef6\u5305\u662f\u5426\u5df2\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528`rpm -q package_name`\u3002\u5982\u679c\u8be5\u5305\u5df2\u5b89\u88c5\uff0c\u547d\u4ee4\u4f1a\u8fd4\u56de\u5305\u7684\u540d\u79f0\u548c\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<h2><strong>\u4e09\u3001\u4f7f\u7528YUM\u5305\u7ba1\u7406\u5668<\/strong><\/h2>\n<p>YUM\uff08Yellowdog Updater Modified\uff09\u662f\u4e00\u4e2a\u5728Fedora\u3001CentOS\u7b49\u7cfb\u7edf\u4e0a\u4f7f\u7528\u7684\u9ad8\u7ea7\u5305\u7ba1\u7406\u5de5\u5177\u3002<\/p>\n<p><strong>1. \u4f7f\u7528YUM\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305<\/strong><\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7`yum list installed`\u547d\u4ee4\u5217\u51fa\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\u3002YUM\u4f1a\u663e\u793a\u5305\u7684\u540d\u79f0\u3001\u7248\u672c\u4ee5\u53ca\u6765\u6e90\u4ed3\u5e93\u3002<\/p>\n<p><strong>2. \u4f7f\u7528YUM\u67e5\u627e\u7279\u5b9a\u8f6f\u4ef6\u5305<\/strong><\/p>\n<p>\u82e5\u8981\u67e5\u8be2\u7279\u5b9a\u5305\u7684\u5b89\u88c5\u72b6\u6001\uff0c\u53ef\u4ee5\u6267\u884c`yum list installed package_name`\u3002\u5982\u679c\u8be5\u5305\u5df2\u5b89\u88c5\uff0c\u547d\u4ee4\u4f1a\u8f93\u51fa\u76f8\u5e94\u7684\u4fe1\u606f\u3002<\/p>\n<h2><strong>\u56db\u3001\u4f7f\u7528APT\u5305\u7ba1\u7406\u5668<\/strong><\/h2>\n<p>APT\uff08Advanced Package Tool\uff09\u662f\u57fa\u4e8eDebian\u7684\u7cfb\u7edf\u6240\u4f7f\u7528\u7684\u5305\u7ba1\u7406\u5de5\u5177\u3002<\/p>\n<p><strong>1. \u67e5\u770b\u5df2\u5b89\u88c5\u8f6f\u4ef6\u5305<\/strong><\/p>\n<p>\u5728Debian\u548cUbuntu\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7`apt list &#8211;installed`\u67e5\u770b\u7cfb\u7edf\u4e2d\u6240\u6709\u5df2\u5b89\u88c5\u7684\u5305\u3002<\/p>\n<p><strong>2. \u641c\u7d22\u7279\u5b9a\u7684\u5df2\u5b89\u88c5\u5305<\/strong><\/p>\n<p>\u8981\u641c\u7d22\u5df2\u5b89\u88c5\u7684\u7279\u5b9a\u8f6f\u4ef6\u5305\uff0c\u53ef\u4ee5\u8fd0\u884c`apt list &#8211;installed | grep package_name`\u3002<\/p>\n<h2><strong>\u4e94\u3001\u4f7f\u7528\u56fe\u5f62\u5316\u5305\u7ba1\u7406\u5de5\u5177<\/strong><\/h2>\n<p>\u9664\u4e86\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u5927\u591a\u6570Linux\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u4e86\u56fe\u5f62\u5316\u754c\u9762\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u5982Ubuntu\u7684\u201c\u8f6f\u4ef6\u4e2d\u5fc3\u201d\u548cFedora\u7684\u201c\u8f6f\u4ef6\u201d\u3002<\/p>\n<p><strong>1. \u4f7f\u7528Ubuntu\u8f6f\u4ef6\u4e2d\u5fc3<\/strong><\/p>\n<p>\u5728Ubuntu\u4e2d\uff0c\u6253\u5f00\u201c\u8f6f\u4ef6\u4e2d\u5fc3\u201d\uff0c\u7528\u6237\u53ef\u4ee5\u6d4f\u89c8\u3001\u5b89\u88c5\u548c\u5378\u8f7d\u8f6f\u4ef6\u5305\u3002\u901a\u8fc7\u67e5\u770b\u201c\u5df2\u5b89\u88c5\u201d\u7684\u6807\u7b7e\u9875\uff0c\u53ef\u4ee5\u770b\u5230\u6240\u6709\u5df2\u5b89\u88c5\u8f6f\u4ef6\u7684\u5217\u8868\u3002<\/p>\n<p><strong>2. \u4f7f\u7528Fedora\u8f6f\u4ef6<\/strong><\/p>\n<p>\u5728Fedora\u4e2d\uff0c\u201c\u8f6f\u4ef6\u201d\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7528\u6237\u53cb\u597d\u7684\u754c\u9762\u6765\u7ba1\u7406\u8f6f\u4ef6\u5305\u3002\u7528\u6237\u53ef\u901a\u8fc7\u70b9\u51fb\u201c\u5df2\u5b89\u88c5\u201d\u7a0b\u5e8f\u6765\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u4e2d\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u6e05\u5355\u3002<\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u51e0\u79cd\u65b9\u5f0f\uff0cLinux\u7528\u6237\u53ef\u4ee5\u8f7b\u677e\u5730\u67e5\u770b\u548c\u7ba1\u7406\u7cfb\u7edf\u4e2d\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\u3002\u638c\u63e1\u8fd9\u4e9b\u547d\u4ee4\u548c\u5de5\u5177\u4e0d\u4ec5\u80fd\u591f\u8ba9\u7528\u6237\u66f4\u597d\u5730\u4e86\u89e3\u7cfb\u7edf\u7684\u5f53\u524d\u72b6\u6001\uff0c\u800c\u4e14\u80fd\u591f\u6709\u6548\u5730\u8fdb\u884c\u7cfb\u7edf\u7ef4\u62a4\u548c\u8f6f\u4ef6\u7ba1\u7406\u3002<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\uff1f<\/strong><\/p>\n<p>\u60f3\u8981\u67e5\u770b\u5728Linux\u7cfb\u7edf\u4e2d\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\u6765\u8f7b\u677e\u5b9e\u73b0\u3002\u4e0d\u540c\u7684Linux\u53d1\u884c\u7248\u672c\u53ef\u80fd\u4f1a\u4f7f\u7528\u4e0d\u540c\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u6bd4\u5982Debian\/Ubuntu\u4f7f\u7528apt\uff0cRed Hat\/CentOS\u4f7f\u7528yum\u6216\u8005dnf\uff0c\u800cArch Linux\u4f7f\u7528pacman\u3002\u901a\u8fc7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u76f8\u5e94\u7684\u547d\u4ee4\uff0c\u6bd4\u5982apt list &#8211;installed\u3001yum list installed\u6216\u8005pacman -Q\uff0c\u5c31\u53ef\u4ee5\u5217\u51fa\u7cfb\u7edf\u4e2d\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\u5217\u8868\u3002<\/p>\n<p><strong>Linux\u7cfb\u7edf\u5982\u4f55\u5378\u8f7d\u4e0d\u9700\u8981\u7684\u8f6f\u4ef6\u5305\uff1f<\/strong><\/p>\n<p>\u8981\u5728Linux\u7cfb\u7edf\u4e2d\u5378\u8f7d\u4e0d\u9700\u8981\u7684\u8f6f\u4ef6\u5305\u4e5f\u662f\u5341\u5206\u7b80\u5355\u7684\u3002\u4f7f\u7528\u76f8\u5e94\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u6bd4\u5982\u5728Debian\/Ubuntu\u4e2d\u4f7f\u7528apt\u3001\u5728Red Hat\/CentOS\u4e2d\u4f7f\u7528yum\u6216\u8005dnf\u3001\u5728Arch Linux\u4e2d\u4f7f\u7528pacman\uff0c\u901a\u8fc7\u8f93\u5165\u5bf9\u5e94\u7684\u547d\u4ee4\uff0c\u6bd4\u5982apt remove <package_name>\u3001yum remove <package_name>\u6216\u8005pacman -R <package_name>\uff0c\u5c31\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u5c06\u4e0d\u9700\u8981\u7684\u8f6f\u4ef6\u5305\u4ece\u7cfb\u7edf\u4e2d\u5378\u8f7d\u6389\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u627e\u7279\u5b9a\u7684\u8f6f\u4ef6\u5305\uff1f<\/strong><\/p>\n<p>\u5982\u679c\u5728Linux\u7cfb\u7edf\u4e2d\u9700\u8981\u67e5\u627e\u7279\u5b9a\u7684\u8f6f\u4ef6\u5305\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5305\u7ba1\u7406\u5de5\u5177\u6765\u5b9e\u73b0\u3002\u4f7f\u7528\u5de5\u5177\u63d0\u4f9b\u7684\u641c\u7d22\u529f\u80fd\uff0c\u6bd4\u5982\u5728Debian\/Ubuntu\u4e2d\u4f7f\u7528apt search <keyword>\u3001\u5728Red Hat\/CentOS\u4e2d\u4f7f\u7528yum search <keyword>\u6216\u8005dnf search <keyword>\u3001\u5728Arch Linux\u4e2d\u4f7f\u7528pacman -Ss <keyword>\uff0c\u5c31\u53ef\u4ee5\u68c0\u7d22\u7cfb\u7edf\u4e2d\u4e0e\u5173\u952e\u8bcd\u76f8\u5173\u7684\u8f6f\u4ef6\u5305\u4fe1\u606f\u3002\u8fd9\u6837\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u627e\u5230\u4ed6\u4eec\u9700\u8981\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u67e5\u770b\u5df2\u5b89\u88c5\u8f6f\u4ef6\u5305\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5e38\u7528\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u547d\u4ee4\u3001\u67e5\u8be2\u5b89\u88c5\u6570\u636e\u5e93\u3001\u5229\u7528 [&hellip;]","protected":false},"author":1,"featured_media":83684,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[384],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/83683"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=83683"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/83683\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/83684"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=83683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=83683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=83683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}