{"id":2466,"date":"2015-08-02T13:55:18","date_gmt":"2015-08-02T05:55:18","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=2466"},"modified":"2015-08-02T13:55:18","modified_gmt":"2015-08-02T05:55:18","slug":"archlinux%e7%9a%84pacman%e5%91%bd%e4%bb%a4%e4%bd%bf%e7%94%a8%e5%ad%a6%e4%b9%a0","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/2466.html","title":{"rendered":"ArchLinux\u7684pacman\u547d\u4ee4\u4f7f\u7528\u5b66\u4e60"},"content":{"rendered":"<p>Pacman\u5305\u7ba1\u7406\u5668\u662fArchLinux\u7684\u4e00\u5927\u4eae\u70b9\u3002\u5b83\u6c72\u53d6\u4e86\u5176\u4ed6Linux\u7248\u672c\u8f6f\u4ef6\u7ba1\u7406\u7684\u4f18\u70b9\uff0c\u8b6c\u5982Debian\u7684APT\u673a\u5236\u3001Redhat\u7684Yum\u673a\u5236\u3001Suse\u7684Yast\u7b49\uff0c\u7ed9\u8f6f\u4ef6\u7684\u5b89\u88c5\u63d0\u4f9b\u4e86\u65e0\u4e0e\u4f26\u6bd4\u7684\u65b9\u4fbf\u3002\u53e6\u5916\u7531\u4e8eArchLinux\u662f\u4e00\u4e2a\u9488\u5bf9i686\u67b6\u6784\u4f18\u5316\u7684\u53d1\u884c\u7248\uff0c\u56e0\u6b64\u5bf9\u4e8e\u8f6f\u4ef6\u7684\u6548\u7387\u63d0\u9ad8\u4e5f\u6709\u4e00\u5b9a\u7684\u5e2e\u52a9\u3002Pacman\u53ef\u4ee5\u8bf4\u662fArchLinux\u7684\u57fa\u7840\uff0c\u56e0\u4e3aArchLinux\u9ed8\u8ba4\u5b89\u88c5\u975e\u5e38\u5c11\u7684\u8f6f\u4ef6\uff0c\u5176\u4ed6\u8f6f\u4ef6\u90fd\u662f\u4f7f\u7528Pacman\u901a\u8fc7\u7f51\u7edc\u6765\u5b89\u88c5\u7684\u3002\u5b83\u5c06\u4e00\u4e2a\u7b80\u5355\u7684\u4e8c\u8fdb\u5236\u5305\u683c\u5f0f\u548c\u6613\u7528\u7684\u6784\u5efa\u7cfb\u7edf\u7ed3\u5408\u4e86\u8d77\u6765\u3002Pacman\u4f7f\u5f97\u7b80\u5355\u7684\u7ba1\u7406\u4e0e\u81ea\u5b9a\u4e49\u8f6f\u4ef6\u5305\u6210\u4e3a\u4e86\u53ef\u80fd\uff0c\u800c\u4e0d\u8bba\u4ed6\u4eec\u6765\u81ea\u4e8e\u5b98\u65b9\u7684Arch\u8f6f\u4ef6\u5e93\u6216\u662f\u7528\u6237\u81ea\u5df1\u521b\u5efa\u7684\u3002Pacman\u53ef\u4ee5\u901a\u8fc7\u548c\u4e3b\u670d\u52a1\u5668\u540c\u6b65\u5305\u5217\u8868\u6765\u8fdb\u884c\u7cfb\u7edf\u66f4\u65b0\uff0c\u8fd9\u4f7f\u5f97\u6ce8\u91cd\u5b89\u5168\u7684\u7cfb\u7edf\u7ba1\u7406\u5458\u7684\u7ef4\u62a4\u5de5\u4f5c\u6210\u4e3a\u8f7b\u800c\u6613\u4e3e\u7684\u4e8b\u60c5\u3002<\/p>\n<p>\u6211\u7b2c\u4e00\u6b21\u4f7f\u7528ArchLinux\u7684\u65f6\u5019\u8fd8\u4e0d\u592a\u9002\u5e94pacman\u8fd9\u4e2a\u5305\u7ba1\u7406\u5668\uff0c\u56e0\u4e3a\u5df2\u7ecf\u4e60\u60ef\u4e86Ubuntu\u7cfb\u5217\u7684apt-get\u6a21\u5f0f\u548cRedhat\/CentOS\u7cfb\u5217\u7684yum\u6a21\u5f0f\uff0c\u4f46\u662f\u540e\u6765\u8d8a\u7528\u8d8a\u559c\u6b22\uff0c\u786e\u5b9e\u633a\u4e0d\u9519\u7684\u4e00\u6b3e\u5305\u7ba1\u7406\u5668\uff0c\u503c\u5f97\u8be6\u7ec6\u4e86\u89e3\u548c\u4f7f\u7528\u3002<\/p>\n<h5>\u53c2\u8003\u94fe\u63a5\uff1a<\/h5>\n<ul>\n<li><a href=\"http:\/\/www.ha97.com\/3459.html\" target=\"_blank\">http:\/\/www.ha97.com\/3459.html<\/a><\/li>\n<li><a href=\"https:\/\/wiki.archlinux.org\/index.php\/Pacman\" target=\"_blank\">https:\/\/wiki.archlinux.org\/index.php\/Pacman<\/a><\/li>\n<li><a href=\"https:\/\/wiki.archlinux.org\/index.php\/Pacman_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29\" target=\"_blank\">https:\/\/wiki.archlinux.org\/index.php\/Pacman_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29<\/a><\/li>\n<li><a href=\"https:\/\/wiki.archlinux.org\/index.php\/Pacman_tips\" target=\"_blank\">https:\/\/wiki.archlinux.org\/index.php\/Pacman_tips<\/a><\/li>\n<li><a href=\"https:\/\/www.archlinux.org\/pacman\/pacman.8.html\" target=\"_blank\">https:\/\/www.archlinux.org\/pacman\/pacman.8.html<\/a><\/li>\n<li>=<\/li>\n<li><a href=\"http:\/\/blog.51yip.com\/linux\/1037.html\" target=\"_blank\">http:\/\/blog.51yip.com\/linux\/1037.html<\/a><\/li>\n<li><a href=\"http:\/\/i.linuxtoy.org\/docs\/guide\/ch31s09.html\" target=\"_blank\">http:\/\/i.linuxtoy.org\/docs\/guide\/ch31s09.html<\/a><\/li>\n<\/ul>\n<h5>\u53c2\u8003\u89e3\u7b54\uff1a<\/h5>\n<p>#<span style=\"color: #0000ff;\"><strong>\u5b89\u88c5<\/strong><\/span>\u8f6f\u4ef6\u5305{\u5b89\u88c5\u6216\u8005\u5347\u7ea7\u5355\u4e2a\u8f6f\u4ef6\u5305\uff0c\u6216\u8005\u4e00\u5217\u8f6f\u4ef6\u5305\uff08\u5305\u542b\u4f9d\u8d56\u5305\uff09}\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>pacman -S package_name1 package_name2<\/p>\n<p>#<span style=\"color: #0000ff;\"><strong>\u5220\u9664<\/strong><\/span>\u8f6f\u4ef6\u5305<\/p>\n<p>\u5220\u9664\u5355\u4e2a<span style=\"color: #ff0000;\"><strong>\u8f6f\u4ef6\u5305<\/strong><\/span>\uff0c\u4fdd\u7559\u5176\u5168\u90e8\u5df2\u7ecf\u5b89\u88c5\u7684\u4f9d\u8d56\u5173\u7cfb\uff1a<\/p>\n<p>pacman -R package_name<\/p>\n<p>\u5220\u9664\u6307\u5b9a\u8f6f\u4ef6\u5305\uff0c\u53ca\u5176\u6240\u6709\u6ca1\u6709\u88ab\u5176\u4ed6\u5df2\u5b89\u88c5\u8f6f\u4ef6\u5305\u4f7f\u7528\u7684<strong><span style=\"color: #ff0000;\">\u4f9d\u8d56\u5173\u7cfb<\/span><\/strong>\uff1a<\/p>\n<p>pacman -Rs package_name<\/p>\n<p>\u7f3a\u7701\u7684\uff0cpacman\u4f1a\u5907\u4efd\u88ab\u5220\u9664\u7a0b\u5e8f\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\u5b83\u4eec\u52a0\u4e0a*.pacsave\u6269\u5c55\u540d\u3002\u5982\u679c\u4f60\u5728\u5220\u9664\u8f6f\u4ef6\u5305\u65f6\u8981<span style=\"color: #ff0000;\"><strong>\u540c\u65f6\u5220\u9664\u76f8\u5e94\u7684\u914d\u7f6e\u6587\u4ef6<\/strong><\/span>\uff08\u8fd9\u79cd\u884c\u4e3a\u5728\u57fa\u4e8eDebian\u7684\u7cfb\u7edf\u4e2d\u79f0\u4e3a\u6e05\u9664purging\uff09\uff0c\u4f60\u53ef\u662f\u4f7f\u7528\u547d\u4ee4\uff1a<\/p>\n<p>pacman -Rn package_name<\/p>\n<p>\u5f53\u7136\uff0c\u5b83\u4e5f\u53ef\u4ee5\u52a0\u4e0a-s\u53c2\u6570\u6765\u5220\u9664\u5f53\u524d\u65e0\u7528\u7684\u4f9d\u8d56\u3002\u8fd9\u6837\u7684\u8bdd\uff0c\u771f\u6b63\u5220\u9664\u4e00\u4e2a\u8f6f\u4ef6\u5305\u3001\u5b83\u7684\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u6240\u6709\u4e0d\u518d\u9700\u8981\u7684\u4f9d\u8d56\u7684\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<p>pacman -Rsn package_name<\/p>\n<p>\u6ce8\u610f\uff01Pacman\u4e0d\u4f1a\u5220\u9664\u8f6f\u4ef6\u5305\u5b89\u88c5\u540e\u624d\u521b\u5efa\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u4f60\u9700\u8981\u624b\u52a8\u5220\u9664\u5b83\u4eec\u3002<\/p>\n<p>#\u5347\u7ea7\u7cfb\u7edf<\/p>\n<p>Pacman\u80fd\u591f\u53ea\u7528\u4e00\u4e2a\u6307\u4ee4\u6765\u5347\u7ea7\u7cfb\u7edf\u4e2d\u6240\u6709\u5df2\u5b89\u88c5\u7684\u5305\u3002\u5347\u7ea7\u7684\u65f6\u95f4\u53d6\u51b3\u4e8e\u4f60\u7684\u7cfb\u7edf\u6709\u591a\u65b0\u4ee5\u53ca\u7f51\u901f\u6709\u591a\u5feb\uff1a<\/p>\n<p>pacman -Su<\/p>\n<p>\u5f53\u7136\uff0c\u6700\u597d\u505a\u6cd5\u7684\u662f\u5c06<strong><span style=\"color: #0000ff;\">\u5347\u7ea7\u7cfb\u7edf\u548c\u540c\u6b65\u4ed3\u5e93\u6570\u636e<\/span><\/strong>\u5408\u6210\u4e3a\u4e00\u6761\u6307\u4ee4\uff1a<\/p>\n<p>pacman -Syu<\/p>\n<p>#<span style=\"color: #0000ff;\"><strong>\u67e5\u8be2\u5305\u6570\u636e\u5e93<\/strong><\/span><\/p>\n<p>Pacman\u53ef\u4ee5\u5728\u5305\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u8f6f\u4ef6\u5305\uff0c\u67e5\u8be2\u4f4d\u7f6e\u5305\u542b\u4e86\u5305\u7684\u540d\u5b57\u548c\u63cf\u8ff0\uff1a<\/p>\n<p>pacman -Ss package<\/p>\n<p>\u8981<span style=\"color: #0000ff;\"><strong>\u67e5\u8be2\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305<\/strong><\/span>\uff1a<\/p>\n<p>pacman -Qs package<\/p>\n<p>\u4e00\u65e6\u4f60\u5f97\u5230\u4e86\u8f6f\u4ef6\u5305\u7684\u5b8c\u6574\u540d\u5b57\uff0c\u4f60\u53ef\u4ee5\u83b7\u53d6\u5173\u4e8e\u5b83\u7684<span style=\"color: #ff0000;\"><strong>\u66f4\u4e3a\u8be6\u5c3d\u7684\u4fe1\u606f<\/strong><\/span>\uff1a<\/p>\n<p>pacman -Si package<\/p>\n<p>pacman -Qi package<\/p>\n<p>\u8981\u83b7\u53d6\u5df2\u5b89\u88c5\u8f6f\u4ef6\u5305\u6240\u5305\u542b\u6587\u4ef6\u7684\u5217\u8868\uff1a<\/p>\n<p>pacman -Ql package<\/p>\n<p>\u4f60\u4e5f\u53ef\u4ee5<span style=\"color: #ff0000;\"><strong>\u901a\u8fc7\u67e5\u8be2\u6570\u636e\u5e93\u83b7\u77e5\u76ee\u524d\u4f60\u7684\u6587\u4ef6\u7cfb\u7edf\u4e2d\u67d0\u4e2a\u6587\u4ef6\u662f\u5c5e\u4e8e\u54ea\u4e2a\u8f6f\u4ef6\u5305<\/strong><\/span>\uff1a<\/p>\n<p>pacman -Qo \/path\/to\/a\/file<\/p>\n<p>\u8981\u7f57\u5217\u6240\u6709\u4e0d\u518d\u4f5c\u4e3a\u4f9d\u8d56\u7684\u8f6f\u4ef6\u5305(\u5b64\u7acborphans)\uff1a<\/p>\n<p>pacman -Qdt<\/p>\n<p>Pacman\u4f7f\u7528-Q\u53c2\u6570\u6765\u67e5\u8be2\u672c\u5730\u8f6f\u4ef6\u5305\u6570\u636e\u5e93\uff0c\u53c2\u89c1\uff1a<\/p>\n<pre class=\"lang:default decode:true\">pacman -Q --help<\/pre>\n<p><span style=\"line-height: 1.5;\">\u800c\u4f7f\u7528-S\u53c2\u6570\u6765\u67e5\u8be2\u8fdc\u7a0b\u540c\u6b65\u7684\u6570\u636e\u5e93\u3002\u53c2\u89c1\uff1a<\/span><\/p>\n<pre class=\"lang:default decode:true\">pacman -S --help<\/pre>\n<p><span style=\"line-height: 1.5;\">#\u5176\u5b83\u7528\u6cd5<\/span><\/p>\n<p>Pacman\u662f\u4e2a\u975e\u5e38\u5e7f\u6cdb\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u8fd9\u91cc\u53ea\u662f\u5b83\u7684\u4e00\u4e9b\u5176\u5b83\u4e3b\u8981\u7279\u6027\u3002<\/p>\n<p><span style=\"color: #0000ff;\"><strong>\u4e0b\u8f7d\u5305\u800c\u4e0d\u5b89\u88c5\u5b83<\/strong><\/span>\uff1a<\/p>\n<p>pacman -Sw package_name<\/p>\n<p><span style=\"color: #0000ff;\"><strong>\u5b89\u88c5\u4e00\u4e2a&#8221;\u672c\u5730&#8221;\u5305<\/strong><\/span>\uff08\u4e0d\u4ece\u6e90\u91cc\uff09\uff1a<\/p>\n<p>pacman -U \/path\/to\/package\/package_name-version.pkg.tar.gz<\/p>\n<p>\u5b89\u88c5\u4e00\u4e2a&#8221;\u8fdc\u7a0b&#8221;\u5305\uff08\u4e0d\u4ece\u6e90\u91cc\uff09\uff1a<\/p>\n<p>pacman -U\u00a0<a href=\"http:\/\/url\/package_name-version.pkg.tar.gz\">http:\/\/url\/package_name-version.pkg.tar.gz<\/a><\/p>\n<p>\u6e05\u7406\u5f53\u524d\u672a\u88ab\u5b89\u88c5\u8f6f\u4ef6\u5305\u7684\u7f13\u5b58(\/var\/cache\/pacman\/pkg):<\/p>\n<p>pacman -Sc<\/p>\n<p>\u5b8c\u5168\u6e05\u7406\u5305\u7f13\u5b58\uff08\u5173\u4e8epacman -Scc\uff0c\u4ec5\u5728\u4f60\u786e\u5b9a\u4e0d\u9700\u8981\u505a\u4efb\u4f55\u8f6f\u4ef6\u5305\u964d\u7ea7\u5de5\u4f5c\u65f6\u624d\u8fd9\u6837\u505a\u3002pacman -Scc\u4f1a\u4ece\u7f13\u5b58\u4e2d\u5220\u9664\u6240\u6709\u8f6f\u4ef6\u5305\u3002\uff09\uff1a<\/p>\n<p>pacman -Scc<\/p>\n<p>\u8981\u5220\u9664\u5b64\u7acb\u8f6f\u4ef6\u5305\uff08\u9012\u5f52\u7684\uff0c\u8981\u5c0f\u5fc3)\uff1a<\/p>\n<p>pacman -Rs $(pacman -Qtdq)<\/p>\n<p>\u91cd\u65b0\u5b89\u88c5\u4f60\u7cfb\u7edf\u4e2d\u6240\u6709\u7684\u8f6f\u4ef6\u5305\uff08\u4ed3\u5e93\u4e2d\u5df2\u6709\u7684\uff09\uff1a<\/p>\n<p>pacman -S $(pacman -Qq | grep -v &#8220;$(pacman -Qmq)&#8221;)<\/p>\n<p><span style=\"color: #0000ff;\"><strong>\u83b7\u53d6\u672c\u5730\u8f6f\u4ef6\u5305\u548c\u5b83\u4eec\u5927\u5c0f\u7684\u4e00\u4e2a\u5df2\u6392\u5e8f\u6e05\u5355\u5217\u8868<\/strong><\/span>\uff1a<\/p>\n<pre class=\"lang:default decode:true\" style=\"padding-left: 30px;\">LANG=C pacman -Qi | sed -n '\/^Name[^:]*: (.*)\/{s\/\/1 \/;x};\/^Installed[^:]*: (.*)\/{s\/\/1\/;H;x;s\/n\/\/;p}' | sort -nk2<\/pre>\n<p>\u8981\u4e86\u89e3\u66f4\u8be6\u7ec6\u7684\u53c2\u6570\u5f00\u5173\u53ef\u4ee5&#8217;pacman &#8211;help&#8217; \u6216\u8005 &#8216;man pacman&#8217;\u3002<\/p>\n<p>=EOF=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pacman\u5305\u7ba1\u7406\u5668\u662fArchLinux\u7684\u4e00\u5927\u4eae\u70b9\u3002\u5b83\u6c72\u53d6\u4e86\u5176\u4ed6Linux\u7248\u672c\u8f6f\u4ef6\u7ba1\u7406\u7684\u4f18\u70b9\uff0c\u8b6c\u5982Debian [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,11,12],"tags":[533,534],"class_list":["post-2466","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-linux","category-tools","tag-archlinux","tag-pacman"],"views":2093,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=2466"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2466\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=2466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=2466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=2466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}