{"id":8546,"date":"2013-12-19T06:07:12","date_gmt":"2013-12-18T22:07:12","guid":{"rendered":"http:\/\/bohu.net\/blog\/?p=8546"},"modified":"2013-12-19T06:07:12","modified_gmt":"2013-12-18T22:07:12","slug":"linux-%e4%b8%8b%e8%8e%b7%e5%8f%96%e5%b7%b2%e5%ae%89%e8%a3%85%e7%9a%84%e8%bd%af%e4%bb%b6%e5%88%97%e8%a1%a8-%e9%87%8d%e6%96%b0%e5%ae%89%e8%a3%85%e6%81%a2%e5%a4%8d%e6%89%80%e6%9c%89%e8%bd%af%e4%bb%b6%e7","status":"publish","type":"post","link":"https:\/\/www.bohu.net\/blog\/8546\/","title":{"rendered":"Linux \u4e0b\u83b7\u53d6\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5217\u8868 &#038; \u91cd\u65b0\u5b89\u88c5\/\u6062\u590d\u6240\u6709\u8f6f\u4ef6\u7a0b\u5e8f"},"content":{"rendered":"<div>\n<div dir=\"ltr\" id=\"TranslationOutput\">\n<h5>\u67e5\u770b\u4e0a\u4e00\u6587\u7ae0: <a title=\"\u5728 Linux\u3001 FreeBSD\u3001 OpenBSD \u4e2d\u663e\u793a\u6240\u6709\u5b89\u88c5\u7684\u8f6f\u4ef6\u6216\u5305\" href=\"http:\/\/bohu.net\/blog\/8543\" target=\"_blank\">(<strong>\u5728 Linux\u3001 FreeBSD\u3001 OpenBSD \u4e2d\u663e\u793a\u6240\u6709\u5b89\u88c5\u7684\u8f6f\u4ef6\u6216\u5305) &#8211; <\/strong>http:\/\/bohu.net\/blog\/8543\u00a0<\/a><\/h5>\n<\/div>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>\u8981\u91cd\u65b0\u5b89\u88c5\u6216\u6062\u590d\u60a8\u9700\u8981\u6709\u4e00\u4e2a\u5217\u8868\u7684\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5b89\u88c5\u8f6f\u4ef6\u3002<\/p>\n<h3 lang=\"zh-CHS\">\u5982\u4f55\uff1a \u521b\u5efa\u7684 Debian \u4e0b\u7684\u6240\u6709\u5df2\u5b89\u88c5\u8f6f\u4ef6\u5907\u4efd\u5217\u8868 \/ Ubuntu Linux<\/h3>\n<p>\u5982\u679c\u60a8\u4f7f\u7528 Debian \u6216 Ubuntu Linux\uff0c\u4f7f\u7528 dpkg \u547d\u4ee4\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\uff1a<br \/>\n<code>$ dpkg --get-selections<\/code><br \/>\n\u60a8\u53ef\u4ee5\u5b58\u50a8\u5230\u4e00\u4e2a\u540d\u4e3a \/backup\/installed-software.log \u6587\u4ef6\u7684\u5df2\u5b89\u88c5\u8f6f\u4ef6\u7684\u5217\u8868\uff0c\u8bf7\u8f93\u5165\uff1a<br \/>\n<code>$ dpkg --get-selections &gt; \/backup\/installed-software.log<\/code><br \/>\n<strong>\u57fa\u4e8e RPM<\/strong>\u5206\u5e03 (RHEL\u3001 \u8f6f\u5462\u5e3d\uff0cRedhat\uff0cCentOS\uff0cSuse Linux\uff09 \u7528\u6237\u5c1d\u8bd5 rpm \u547d\u4ee4\u6765\u83b7\u53d6\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u7684\u5217\u8868\uff0c\u8bf7\u8f93\u5165\uff1a<br \/>\n<code>$ rpm -qa <\/code><br \/>\n\u6216<br \/>\n<code>$ rpm -qa &gt; \/backup\/installed-software.log<\/code><\/p>\n<h2 lang=\"zh-CHS\"><strong>\u5982\u4f55\u4ece\u5907\u4efd\u5217\u8868\u6062\u590d\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\uff1f<\/strong><\/h2>\n<p>Debian\/Ubuntu Linux \u4e0b\u952e\u5165\u4e0b\u5217\u4e24\u4e2a\u547d\u4ee4\u6765\u91cd\u65b0\u5b89\u88c5\u6240\u6709\u7684\u7a0b\u5e8f\uff1a<br \/>\n<code># dpkg --set-selections &lt; \/backup\/installed-software.log<\/code><br \/>\n\u4e00\u65e6\u5bfc\u5165\u5217\u8868\uff0c\u8bf7\u4f7f\u7528 dselect \u547d\u4ee4\u6216\u5176\u4ed6\u5de5\u5177\u8981\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\uff0c\u8bf7\u8f93\u5165\uff1a<br \/>\n<code># dselect<\/code><br \/>\n\u8bf7\u9009\u62e9&#8217;<strong>i<\/strong>&#8216; \u4e3a\u5b89\u88c5\u9009\u62e9\u7684\u8f6f\u4ef6\u3002<\/p>\n<p>\u636e\u6211\u6240\u77e5\u57fa\u4e8e RPM \u7684\u53d1\u884c\u7248\u4e0d\u63d0\u4f9b dpkg \u79cd\u7684\u8bbe\u65bd\u3002\u4f46\u4e0e\u5c0f\u5c0f\u7684\u5916\u58f3\u811a\u672c\u7f16\u5199\u6280\u672f\u60a8\u53ef\u4ee5\u8f7b\u677e\u5730\u5b89\u88c5\u7684\u6240\u6709\u8f6f\u4ef6\u7a0b\u5e8f\uff1a<br \/>\n<code># LIST=\"$( cat \/backup\/installed-software.log )\"<\/code><br \/>\n\u5982\u679c\u60a8\u6b63\u5728\u4f7f\u7528\u767e\u80dc comamnd\uff0c\u952e\u5165 for \u5faa\u73af\u6765\u5b89\u88c5\u6240\u6709\u7684\u8f6f\u4ef6\u4ee5\u4e0b\u5185\u5bb9\uff1a<br \/>\n<code># for s in $LIST; do yum -y install $s; done <\/code><br \/>\n<em><strong>\u66f4\u65b0<\/strong><\/em>\u8bd5\u8bd5\u4e0b\u9762\u7684\u547d\u4ee4 \uff08\u7531\u4e8e gt)\uff1a<br \/>\n<code># yum -y install $(cat \/backup\/installed-software.log) <\/code><\/p>\n<h3 lang=\"zh-CHS\">RHEL \u6ce8\u610f\u6709\u5173\u7248\u672c 4<\/h3>\n<p>\u5982\u679c\u60a8\u4f7f\u7528\u7684 RHEL 4 \u6216\u66f4\u65e7\uff0c\u8bf7\u8f93\u5165\uff1a<br \/>\n<code># for s in $LIST; do up2date -i $s; done <\/code><\/p>\n<p>\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<br \/>\n<code># up2date -i $(cat \/backup\/installed-software.log) <\/code><\/p>\n<p>&nbsp;<\/p>\n<p>http:\/\/www.cyberciti.biz\/tips\/linux-get-list-installed-software-reinstallation-restore.html<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770b\u4e0a\u4e00\u6587\u7ae0: (\u5728 Linux\u3001 FreeBSD\u3001 OpenBSD \u4e2d\u663e\u793a\u6240\u6709\u5b89\u88c5\u7684\u8f6f\u4ef6\u6216\u5305) &#038;#8211 &hellip; <a href=\"https:\/\/www.bohu.net\/blog\/8546\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cLinux \u4e0b\u83b7\u53d6\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6\u5217\u8868 &#038; \u91cd\u65b0\u5b89\u88c5\/\u6062\u590d\u6240\u6709\u8f6f\u4ef6\u7a0b\u5e8f\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[117,229,277,323,329,385,386,509,521,614],"class_list":["post-8546","post","type-post","status-publish","format-standard","hentry","category-linux","tag-debian","tag-linux","tag-openbsd","tag-rhel","tag-rpm","tag-ubuntu","tag-ubuntu-linux","tag-509","tag-521","tag-614"],"_links":{"self":[{"href":"https:\/\/www.bohu.net\/blog\/wp-json\/wp\/v2\/posts\/8546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bohu.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bohu.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bohu.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bohu.net\/blog\/wp-json\/wp\/v2\/comments?post=8546"}],"version-history":[{"count":0,"href":"https:\/\/www.bohu.net\/blog\/wp-json\/wp\/v2\/posts\/8546\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bohu.net\/blog\/wp-json\/wp\/v2\/media?parent=8546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bohu.net\/blog\/wp-json\/wp\/v2\/categories?post=8546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bohu.net\/blog\/wp-json\/wp\/v2\/tags?post=8546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}