{"id":457,"date":"2025-03-17T14:55:36","date_gmt":"2025-03-17T14:55:36","guid":{"rendered":"https:\/\/linuxjk.cn\/?p=457"},"modified":"2025-03-17T14:59:23","modified_gmt":"2025-03-17T14:59:23","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e4%b8%8a%e6%a3%80%e6%9f%a5%e4%b8%80%e4%b8%aa%e8%bd%af%e4%bb%b6%e5%8c%85%e6%98%af%e5%90%a6%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/linuxjk.cn\/?p=457","title":{"rendered":"\u5982\u4f55\u5728Ubuntu\u4e0a\u68c0\u67e5\u4e00\u4e2a\u8f6f\u4ef6\u5305\u662f\u5426\u5b89\u88c5"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"457\" class=\"elementor elementor-457\">\n\t\t\t\t<div class=\"elementor-element elementor-element-077c544 e-flex e-con-boxed e-con e-parent\" data-id=\"077c544\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-d48c3dd elementor-widget elementor-widget-heading\" data-id=\"d48c3dd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxjk.cn\/?p=457\/#1dpkgapt%E5%91%BD%E4%BB%A4%E6%A3%80%E6%9F%A5%E8%BD%AF%E4%BB%B6%E5%8C%85%E6%98%AF%E5%90%A6%E5%AE%89%E8%A3%85\" >1.dpkg\/apt\u547d\u4ee4\u68c0\u67e5\u8f6f\u4ef6\u5305\u662f\u5426\u5b89\u88c5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxjk.cn\/?p=457\/#dpkg%E5%91%BD%E4%BB%A4%E8%AF%A6%E8%A7%A3\" >dpkg\u547d\u4ee4\u8be6\u89e3<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"1dpkgapt%E5%91%BD%E4%BB%A4%E6%A3%80%E6%9F%A5%E8%BD%AF%E4%BB%B6%E5%8C%85%E6%98%AF%E5%90%A6%E5%AE%89%E8%A3%85\"><\/span>1.dpkg\/apt\u547d\u4ee4\u68c0\u67e5\u8f6f\u4ef6\u5305\u662f\u5426\u5b89\u88c5<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bfc240c elementor-widget elementor-widget-text-editor\" data-id=\"bfc240c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><strong>\u5728 Ubuntu \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\u68c0\u67e5\u4e00\u4e2a\u8f6f\u4ef6\u5305\u662f\u5426\u5df2\u5b89\u88c5\uff1a<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u65b9\u6cd5 1\uff1a\u4f7f\u7528 `dpkg` \u547d\u4ee4\uff08\u76f4\u63a5\u68c0\u67e5\uff09**<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -l | grep \u8f6f\u4ef6\u5305\u540d<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u793a\u4f8b**\uff1a\u68c0\u67e5 `apache2` \u662f\u5426\u5b89\u88c5\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -l | grep apache2<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u8f93\u51fa\u7ed3\u679c**\uff1a<\/strong><br \/><strong>&#8211; \u82e5\u5df2\u5b89\u88c5\uff0c\u4f1a\u663e\u793a\u7c7b\u4f3c `ii apache2 2.4.41-4ubuntu3 amd64 Apache HTTP Server` \u7684\u4fe1\u606f\uff08`ii` \u8868\u793a\u5df2\u5b89\u88c5\uff09\u3002<\/strong><br \/><strong>&#8211; \u82e5\u65e0\u8f93\u51fa\uff0c\u5219\u8868\u793a\u672a\u5b89\u88c5\u3002<\/strong><\/p><p><strong>#### \u6269\u5c55\u7528\u6cd5\uff1a<\/strong><br \/><strong>&#8211; **\u7cbe\u786e\u5339\u914d\u5305\u540d**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -l \u8f6f\u4ef6\u5305\u540d<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>\u4f8b\u5982\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -l apache2<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u65b9\u6cd5 2\uff1a\u4f7f\u7528 `apt` \u547d\u4ee4\uff08\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u5305\uff09**<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>apt list &#8211;installed | grep \u8f6f\u4ef6\u5305\u540d<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u793a\u4f8b**\uff1a\u68c0\u67e5 `php7.0` \u662f\u5426\u5b89\u88c5\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>apt list &#8211;installed | grep php7.0<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u8f93\u51fa\u7ed3\u679c**\uff1a<\/strong><br \/><strong>&#8211; \u82e5\u5df2\u5b89\u88c5\uff0c\u4f1a\u663e\u793a\u7c7b\u4f3c `php7.0\/focal,now 7.0.33-1+ubuntu20.04.1+deb.sury.org+1 amd64 [\u5df2\u5b89\u88c5]`\u3002<\/strong><br \/><strong>&#8211; \u82e5\u65e0\u8f93\u51fa\uff0c\u5219\u8868\u793a\u672a\u5b89\u88c5\u3002<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u65b9\u6cd5 3\uff1a\u4f7f\u7528 `dpkg-query` \u547d\u4ee4\uff08\u8be6\u7ec6\u67e5\u8be2\uff09**<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg-query -W \u8f6f\u4ef6\u5305\u540d<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u793a\u4f8b**\uff1a\u68c0\u67e5 `mysql-server` \u662f\u5426\u5b89\u88c5\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg-query -W mysql-server<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u8f93\u51fa\u7ed3\u679c**\uff1a<\/strong><br \/><strong>&#8211; \u82e5\u5df2\u5b89\u88c5\uff0c\u663e\u793a\u5305\u540d\u548c\u7248\u672c\u53f7\uff08\u5982 `mysql-server 8.0.32-0ubuntu0.20.04.1`\uff09\u3002<\/strong><br \/><strong>&#8211; \u82e5\u672a\u5b89\u88c5\uff0c\u63d0\u793a `\u672a\u5b89\u88c5\u8f6f\u4ef6\u5305 mysql-server`\u3002<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u65b9\u6cd5 4\uff1a\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u5b58\u5728\uff08\u95f4\u63a5\u9a8c\u8bc1\uff09**<\/strong><br \/><strong>\u5982\u679c\u77e5\u9053\u8f6f\u4ef6\u5305\u5b89\u88c5\u540e\u751f\u6210\u7684\u5173\u952e\u6587\u4ef6\u8def\u5f84\uff0c\u53ef\u4ee5\u76f4\u63a5\u68c0\u67e5\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>ls \/path\/to\/\u5173\u952e\u6587\u4ef6<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u793a\u4f8b**\uff1a\u68c0\u67e5 Apache \u662f\u5426\u5b89\u88c5\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>ls \/usr\/sbin\/apache2 # Apache \u4e3b\u7a0b\u5e8f\u8def\u5f84<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u603b\u7ed3\u5bf9\u6bd4**<\/strong><br \/><strong>| \u65b9\u6cd5 | \u9002\u7528\u573a\u666f | \u4f18\u70b9 | \u7f3a\u70b9 |<\/strong><br \/><strong>|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-|<\/strong><br \/><strong>| `dpkg -l` | \u5feb\u901f\u68c0\u67e5\u7279\u5b9a\u5305\u662f\u5426\u5b89\u88c5 | \u76f4\u63a5\u3001\u5feb\u901f | \u9700\u8981\u7cbe\u786e\u5305\u540d |<\/strong><br \/><strong>| `apt list` | \u6a21\u7cca\u641c\u7d22\u6216\u4e0d\u786e\u5b9a\u5305\u540d\u65f6 | \u652f\u6301\u901a\u914d\u7b26\uff08\u5982 `php*`\uff09 | \u8f93\u51fa\u4fe1\u606f\u8f83\u591a |<\/strong><br \/><strong>| `dpkg-query -W` | \u9700\u8981\u660e\u786e\u5305\u72b6\u6001\u65f6 | \u7cbe\u786e\u663e\u793a\u7248\u672c\u53f7 | \u9700\u63d0\u524d\u77e5\u9053\u5305\u540d |<\/strong><br \/><strong>| \u68c0\u67e5\u6587\u4ef6 | \u5df2\u77e5\u8f6f\u4ef6\u5173\u952e\u6587\u4ef6\u8def\u5f84\u65f6 | \u76f4\u63a5\u9a8c\u8bc1\u529f\u80fd\u6027\u6587\u4ef6 | \u6587\u4ef6\u8def\u5f84\u53ef\u80fd\u56e0\u7248\u672c\u4e0d\u540c\u800c\u53d8\u5316 |<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u5e38\u89c1\u95ee\u9898**<\/strong><br \/><strong>1. **\u5305\u540d\u4e0d\u5339\u914d**\uff1a<\/strong><br \/><strong>\u67d0\u4e9b\u8f6f\u4ef6\u7684\u5b9e\u9645\u5305\u540d\u53ef\u80fd\u4e0e\u901a\u7528\u540d\u79f0\u4e0d\u540c\uff08\u4f8b\u5982\uff1aMySQL \u670d\u52a1\u5668\u5305\u540d\u4e3a `mysql-server-8.0` \u800c\u975e `mysql`\uff09\u3002\u53ef\u901a\u8fc7 [Ubuntu Packages Search](https:\/\/packages.ubuntu.com\/) \u67e5\u8be2\u5b98\u65b9\u5305\u540d\u3002<\/strong><\/p><p><strong>2. **\u901a\u914d\u7b26\u641c\u7d22**\uff1a<\/strong><br \/><strong>\u5982\u679c\u5305\u540d\u4e0d\u786e\u5b9a\uff0c\u53ef\u4f7f\u7528 `*` \u901a\u914d\u7b26\uff0c\u4f8b\u5982\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -l | grep php7*<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>3. **\u6743\u9650\u95ee\u9898**\uff1a<\/strong><br \/><strong>\u4e0a\u8ff0\u547d\u4ee4\u53ef\u80fd\u9700\u8981 `sudo` \u6743\u9650\u624d\u80fd\u8bbf\u95ee\u67d0\u4e9b\u5305\u7684\u5b89\u88c5\u4fe1\u606f\u3002<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5feb\u901f\u9a8c\u8bc1\u8f6f\u4ef6\u5305\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u5e2e\u52a9\u6392\u67e5\u73af\u5883\u914d\u7f6e\u95ee\u9898\u3002<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c95663c elementor-widget elementor-widget-heading\" data-id=\"c95663c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"dpkg%E5%91%BD%E4%BB%A4%E8%AF%A6%E8%A7%A3\"><\/span>dpkg\u547d\u4ee4\u8be6\u89e3<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-93d9f84 elementor-widget elementor-widget-text-editor\" data-id=\"93d9f84\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><strong>&#8212;<\/strong><\/p><p><strong>### **`dpkg -s` \u4e0e `dpkg -l` \u7684\u533a\u522b\u8be6\u89e3**<\/strong><\/p><p><strong>\u5728 Debian\/Ubuntu \u7cfb\u7edf\u4e2d\uff0c`dpkg` \u662f\u6838\u5fc3\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u7528\u4e8e\u76f4\u63a5\u64cd\u4f5c `.deb` \u8f6f\u4ef6\u5305\u3002`dpkg -s` \u548c `dpkg -l` \u662f\u5e38\u7528\u7684\u67e5\u8be2\u547d\u4ee4\uff0c\u4f46\u529f\u80fd\u548c\u4f7f\u7528\u573a\u666f\u6709\u663e\u8457\u5dee\u5f02\uff1a<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>#### **1. `dpkg -s`\uff08\u663e\u793a\u8f6f\u4ef6\u5305\u8be6\u7ec6\u4fe1\u606f\uff09**<\/strong><br \/><strong>&#8211; **\u529f\u80fd**\uff1a<\/strong><br \/><strong>\u67e5\u8be2 **\u7279\u5b9a\u8f6f\u4ef6\u5305** \u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u7248\u672c\u3001\u4f9d\u8d56\u3001\u72b6\u6001\u3001\u63cf\u8ff0\u7b49\u3002<\/strong><br \/><strong>&#8211; **\u8bed\u6cd5**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -s &lt;\u5305\u540d&gt;<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u8f93\u51fa\u793a\u4f8b**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>Package: apache2<\/strong><br \/><strong>Status: install ok installed<\/strong><br \/><strong>Priority: optional<\/strong><br \/><strong>Section: web<\/strong><br \/><strong>Version: 2.4.41-4ubuntu3<\/strong><br \/><strong>Depends: &#8230;<\/strong><br \/><strong>Description: Apache HTTP Server<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u7279\u70b9**\uff1a<\/strong><br \/><strong>&#8211; \u5fc5\u987b\u6307\u5b9a\u7cbe\u786e\u7684\u5305\u540d\uff08\u4e0d\u652f\u6301\u6a21\u7cca\u5339\u914d\uff09\u3002<\/strong><br \/><strong>&#8211; \u82e5\u8f6f\u4ef6\u5305\u672a\u5b89\u88c5\uff0c\u4f1a\u63d0\u793a `\u672a\u5b89\u88c5\u8f6f\u4ef6\u5305 apache2`\u3002<\/strong><br \/><strong>&#8211; **\u9002\u7528\u573a\u666f**\uff1a<\/strong><br \/><strong>&#8211; \u68c0\u67e5\u67d0\u4e2a\u8f6f\u4ef6\u5305\u662f\u5426\u5df2\u5b89\u88c5\u3002<\/strong><br \/><strong>&#8211; \u67e5\u770b\u5df2\u5b89\u88c5\u8f6f\u4ef6\u5305\u7684\u8be6\u7ec6\u5143\u6570\u636e\uff08\u5982\u7248\u672c\u3001\u4f9d\u8d56\u5173\u7cfb\uff09\u3002<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>#### **2. `dpkg -l`\uff08\u5217\u51fa\u8f6f\u4ef6\u5305\u6e05\u5355\uff09**<\/strong><br \/><strong>&#8211; **\u529f\u80fd**\uff1a<\/strong><br \/><strong>\u5217\u51fa **\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305** \u6216 **\u6a21\u7cca\u5339\u914d\u7684\u5305\u540d\u6e05\u5355**\uff0c\u663e\u793a\u7b80\u8981\u4fe1\u606f\u3002<\/strong><br \/><strong>&#8211; **\u8bed\u6cd5**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -l [\u5305\u540d\u901a\u914d\u7b26]<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u8f93\u51fa\u793a\u4f8b**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>ii apache2 2.4.41-4ubuntu3 amd64 Apache HTTP Server<\/strong><br \/><strong>ii curl 7.68.0-1ubuntu2 amd64 URL \u4f20\u8f93\u5de5\u5177<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u72b6\u6001\u7b26\u53f7\u542b\u4e49**\uff1a<\/strong><br \/><strong>&#8211; `ii`\uff1a\u5df2\u5b89\u88c5\u4e14\u914d\u7f6e\u5b8c\u6210\u3002<\/strong><br \/><strong>&#8211; `un`\uff1a\u5df2\u5378\u8f7d\u4f46\u914d\u7f6e\u6587\u4ef6\u4fdd\u7559\u3002<\/strong><br \/><strong>&#8211; **\u7279\u70b9**\uff1a<\/strong><br \/><strong>&#8211; \u4e0d\u6307\u5b9a\u5305\u540d\u65f6\uff0c\u5217\u51fa\u6240\u6709\u5df2\u5b89\u88c5\u7684\u5305\uff08\u8f93\u51fa\u53ef\u80fd\u5f88\u957f\uff09\u3002<\/strong><br \/><strong>&#8211; \u652f\u6301\u901a\u914d\u7b26\u6a21\u7cca\u5339\u914d\uff08\u5982 `dpkg -l &#8216;php*&#8217;`\uff09\u3002<\/strong><br \/><strong>&#8211; **\u9002\u7528\u573a\u666f**\uff1a<\/strong><br \/><strong>&#8211; \u5feb\u901f\u68c0\u67e5\u67d0\u4e2a\u8f6f\u4ef6\u5305\u662f\u5426\u5b89\u88c5\uff08\u914d\u5408 `grep`\uff09\u3002<\/strong><br \/><strong>&#8211; \u6279\u91cf\u67e5\u627e\u540d\u79f0\u76f8\u4f3c\u7684\u5305\uff08\u5982 `dpkg -l &#8216;nginx*&#8217;`\uff09\u3002<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u6838\u5fc3\u533a\u522b\u603b\u7ed3**<\/strong><br \/><strong>| **\u5bf9\u6bd4\u9879** | `dpkg -s` | `dpkg -l` |<\/strong><br \/><strong>|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;|<\/strong><br \/><strong>| **\u8f93\u51fa\u5185\u5bb9** | \u5355\u4e2a\u5305\u7684\u8be6\u7ec6\u4fe1\u606f\uff08\u7248\u672c\u3001\u4f9d\u8d56\u3001\u72b6\u6001\uff09 | \u7b80\u8981\u5217\u8868\uff08\u5305\u540d\u3001\u7248\u672c\u3001\u63cf\u8ff0\uff09 |<\/strong><br \/><strong>| **\u662f\u5426\u9700\u8981\u7cbe\u786e\u5305\u540d** | \u662f | \u5426\uff08\u652f\u6301\u901a\u914d\u7b26\uff09 |<\/strong><br \/><strong>| **\u672a\u5b89\u88c5\u65f6\u7684\u63d0\u793a** | \u660e\u786e\u63d0\u793a `\u672a\u5b89\u88c5` | \u65e0\u8f93\u51fa\uff08\u9700\u624b\u52a8\u8fc7\u6ee4\uff09 |<\/strong><br \/><strong>| **\u5178\u578b\u7528\u9014** | \u67e5\u770b\u5355\u4e2a\u5305\u7684\u5143\u6570\u636e | \u6279\u91cf\u68c0\u67e5\u6216\u6a21\u7cca\u641c\u7d22 |<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u5176\u4ed6\u5e38\u7528 `dpkg` \u547d\u4ee4**<\/strong><br \/><strong>1. **\u5b89\u88c5\u672c\u5730 `.deb` \u5305**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>sudo dpkg -i package.deb<\/strong><br \/><strong>&#8220;`<\/strong><br \/><strong>&#8211; **\u6ce8\u610f**\uff1a\u82e5\u7f3a\u5c11\u4f9d\u8d56\uff0c\u9700\u624b\u52a8\u8fd0\u884c `sudo apt install -f` \u4fee\u590d\u3002<\/strong><\/p><p><strong>2. **\u5378\u8f7d\u8f6f\u4ef6\u5305\uff08\u4fdd\u7559\u914d\u7f6e\u6587\u4ef6\uff09**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>sudo dpkg -r &lt;\u5305\u540d&gt;<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>3. **\u5f7b\u5e95\u5378\u8f7d\uff08\u5220\u9664\u914d\u7f6e\u6587\u4ef6\uff09**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>sudo dpkg -P &lt;\u5305\u540d&gt;<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>4. **\u5217\u51fa\u8f6f\u4ef6\u5305\u5b89\u88c5\u7684\u6587\u4ef6**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -L &lt;\u5305\u540d&gt;<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>5. **\u67e5\u8be2\u6587\u4ef6\u6240\u5c5e\u7684\u5305**\uff1a<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -S \/path\/to\/file<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u4f7f\u7528\u793a\u4f8b\u573a\u666f**<\/strong><br \/><strong>#### **\u573a\u666f 1\uff1a\u786e\u8ba4 `nginx` \u662f\u5426\u5b89\u88c5\u5e76\u67e5\u770b\u7248\u672c**<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong># \u68c0\u67e5\u662f\u5426\u5b89\u88c5<\/strong><br \/><strong>dpkg -l | grep nginx<\/strong><\/p><p><strong># \u67e5\u770b\u8be6\u7ec6\u4fe1\u606f\uff08\u82e5\u5df2\u5b89\u88c5\uff09<\/strong><br \/><strong>dpkg -s nginx<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>#### **\u573a\u666f 2\uff1a\u5b89\u88c5\u672c\u5730\u5305\u5e76\u4fee\u590d\u4f9d\u8d56**<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>sudo dpkg -i ~\/Downloads\/package.deb<\/strong><br \/><strong>sudo apt install -f # \u81ea\u52a8\u4fee\u590d\u4f9d\u8d56<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>#### **\u573a\u666f 3\uff1a\u67e5\u627e `\/usr\/bin\/curl` \u6587\u4ef6\u6240\u5c5e\u7684\u5305**<\/strong><br \/><strong>&#8220;`bash<\/strong><br \/><strong>dpkg -S \/usr\/bin\/curl<\/strong><br \/><strong># \u8f93\u51fa\uff1acurl: \/usr\/bin\/curl<\/strong><br \/><strong>&#8220;`<\/strong><\/p><p><strong>&#8212;<\/strong><\/p><p><strong>### **\u6ce8\u610f\u4e8b\u9879**<\/strong><br \/><strong>&#8211; **\u6743\u9650\u8981\u6c42**\uff1a\u5b89\u88c5\/\u5378\u8f7d\u64cd\u4f5c\u9700\u8981 `sudo` \u6743\u9650\u3002<\/strong><br \/><strong>&#8211; **\u4f9d\u8d56\u7ba1\u7406**\uff1a`dpkg` \u4e0d\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\uff0c\u63a8\u8350\u4f18\u5148\u4f7f\u7528 `apt` \u8fdb\u884c\u5b89\u88c5\u3002<\/strong><br \/><strong>&#8211; **\u5305\u540d\u7cbe\u786e\u6027**\uff1a`dpkg -s` \u5fc5\u987b\u6307\u5b9a\u5b8c\u6574\u5305\u540d\uff0c\u800c `dpkg -l` \u652f\u6301\u6a21\u7cca\u5339\u914d\u3002<\/strong><\/p><p><strong>\u638c\u63e1 `dpkg` \u7684\u6838\u5fc3\u547d\u4ee4\uff0c\u53ef\u4ee5\u66f4\u7075\u6d3b\u5730\u7ba1\u7406 Debian\/Ubuntu \u7cfb\u7edf\u4e2d\u7684\u8f6f\u4ef6\u5305\u3002<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>1.dpkg\/apt\u547d\u4ee4\u68c0\u67e5\u8f6f\u4ef6\u5305\u662f\u5426\u5b89\u88c5 \u5728 Ubuntu \u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\u68c0\u67e5\u4e00\u4e2a\u8f6f\u4ef6\u5305\u662f\u5426\u5df2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[15],"class_list":["post-457","post","type-post","status-publish","format-standard","hentry","category-vxhs888p","tag-check_error"],"_links":{"self":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=457"}],"version-history":[{"count":4,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/457\/revisions"}],"predecessor-version":[{"id":461,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/457\/revisions\/461"}],"wp:attachment":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}