{"id":198820,"date":"2020-08-25T09:35:36","date_gmt":"2020-08-25T01:35:36","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=198820"},"modified":"2020-08-21T20:37:10","modified_gmt":"2020-08-21T12:37:10","slug":"centos-yum-faild","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos-yum-faild.html","title":{"rendered":"CentOS 7\u7cfb\u7edf\u4e2d\u6267\u884cyum\u547d\u4ee4\u5931\u8d25\u95ee\u9898\u7684\u6392\u67e5\u65b9\u6cd5"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u672c\u6587\u4e3b\u8981\u8bb2\u8ff0CentOS 7\u7cfb\u7edf\u4e2d\u6267\u884cyum\u547d\u4ee4\u5931\u8d25\u95ee\u9898\u7684\u6392\u67e5\u65b9\u6cd5\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u6267\u884cyum\u547d\u4ee4\u62a5404\u9519\u8bef<\/strong><\/div>\n

\u68c0\u67e5yum\u4ed3\u5e93\u662f\u5426\u914d\u7f6e\u6b63\u786e\uff0c\u53ef\u4ee5\u5230CentOS \u955c\u50cf\u4e0b\u8f7d\u963f\u91cc\u4e91repo\u914d\u7f6e\u6587\u4ef6\u3002
\n\u5982\u679c\u62a5\u9519\u4e2d\u5305\u542b$releasever\u53d8\u91cf\uff0c \u5219\u6267\u884crpm -qa | grep centos-release\u786e\u8ba4centos-release\u662f\u5426\u5b89\u88c5\u3002\u672a\u5b89\u88c5\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f7d\u5b89\u88c5\u5305\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n

wget https:\/\/mirrors.aliyun.com\/centos\/7\/os\/x86_64\/Packages\/centos-release-7-7.1908.0.el7.centos.x86_64.rpm\r\nrpm -ivh centos-release-7-7.1908.0.el7.centos.x86_64.rpm<\/pre>\n
\u6267\u884cyum install\u547d\u4ee4\u63d0\u793afailed\u9519\u8bef<\/strong><\/div>\n

\u4ece\u62a5\u9519\u53ef\u4ee5\u770b\u5230\u63d0\u793a\u4ee5\u4e0b\u4fe1\u606f\uff0c\u6b64\u5904\u4ee5\u5b89\u88c5Telnet\u4e3a\u4f8b\u3002<\/p>\n

ERROR UNpacking rpm package 1\uff1atelnet-0.17-64.e17.x86_64\r\nerror\uff1aunpacking of archive failed on file \/usr\/bin\/telnet\uff1b5e785bc7\uff1acpio\uff1aopen<\/pre>\n

\u8bf7\u60a8\u6267\u884clsattr\u547d\u4ee4\u68c0\u67e5\/usr\/bin\u76ee\u5f55\u6743\u9650\uff0c\u53d1\u73b0\u8be5\u76ee\u5f55\u6709i\u5c5e\u6027\uff0c\u5bfc\u81f4\u65e0\u6cd5\u5199\u5165\u6587\u4ef6\u3002\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u89e3\u9664\u76ee\u5f55\u7684i\u5c5e\u6027\u5373\u53ef\u3002<\/p>\n

chattr -i \/usr\/bin<\/pre>\n
\u6267\u884cyum\u547d\u4ee4\u63d0\u793aPython\u89e3\u91ca\u5668\u4e0d\u5b58\u5728<\/strong><\/div>\n

\u5728\u6267\u884cyum\u547d\u4ee4\u65f6\u63d0\u793a\u4ee5\u4e0b\u62a5\u9519\u4fe1\u606f\u3002<\/p>\n

-bash: \/usr\/bin\/yum: \/usr\/bin\/python: bad interpreter: No such file or directory<\/pre>\n

\u8bf4\u660e\uff1ayum\u662f\u4e00\u4e2apython\u811a\u672c\u3002<\/p>\n

\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770byum\u8def\u5f84\u3002<\/p>\n

cat \/usr\/bin\/yum<\/pre>\n

\u7cfb\u7edf\u4f1a\u8fd4\u56de\u4ee5\u4e0b\u8def\u5f84\u3002<\/p>\n

#!\/usr\/bin\/python<\/pre>\n

\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u4e0a\u8ff0\u67e5\u770b\u7684\u8def\u5f84\u3002<\/p>\n

ls -al \/usr\/bin\/python<\/pre>\n

\u5982\u679c\u7cfb\u7edf\u8fd4\u56de\u4ee5\u4e0b\u4fe1\u606f\uff0cPython\u53ef\u80fd\u88ab\u5378\u8f7d\u3001\u88ab\u6539\u540d\u6216\u79fb\u52a8\u8def\u5f84\u3002<\/p>\n

ls: cannot access \/usr\/bin\/python: No such file or directory<\/pre>\n

\u8bf7\u60a8\u53c2\u8003\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u6392\u67e5\u3002
\n\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u5b89\u88c5\u5305\u662f\u5426\u5b58\u5728\u3002<\/p>\n

rpm -qa | grep python<\/pre>\n

\u7cfb\u7edf\u8fd4\u56de\u4ee5\u4e0b\u4fe1\u606f\u3002<\/p>\n

python-decorator-3.4.0-3.el7.noarch\r\nlibselinux-python-2.5-14.1.el7.x86_64\r\npython-backports-1.0-8.el7.x86_64\r\npython-pyudev-0.15-9.el7.noarch\r\nrpm-python-4.11.3-35.el7.x86_64\r\npython-2.7.5-76.el7.x86_64\r\n.....<\/pre>\n

\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bPython\u76f8\u5173\u6587\u4ef6\u3002<\/p>\n

ls -al \/usr\/bin\/python*<\/pre>\n

\u7cfb\u7edf\u8fd4\u56de\u4ee5\u4e0b\u4fe1\u606f\u3002<\/p>\n

lrwxrwxrwx  1 root root   14 Feb 15  2019 \/usr\/bin\/python-config -> python2-config\r\nlrwxrwxrwx. 1 root root    7 Feb 15  2019 \/usr\/bin\/python.bak -> python2\r\nlrwxrwxrwx. 1 root root    9 Feb 15  2019 \/usr\/bin\/python2 -> python2.7\r\nlrwxrwxrwx  1 root root   16 Feb 15  2019 \/usr\/bin\/python2-config -> python2.7-config\r\n-rwxr-xr-x. 1 root root 7216 Oct 31  2018 \/usr\/bin\/python2.7\r\n-rwxr-xr-x  1 root root 1835 Oct 31  2018 \/usr\/bin\/python2.7-config<\/pre>\n

\u8bf7\u60a8\u6839\u636e\u8fd4\u56de\u7684\u4fe1\u606f\u53c2\u8003\u4ee5\u4e0b\u573a\u666f\u8fdb\u884c\u64cd\u4f5c\u3002
\n\u68c0\u67e5\/usr\/bin\/python.bak\u662f\u5426\u88ab\u6539\u540d\uff0c\u82e5\u53d1\u73b0\u88ab\u6539\u540d\u540e\u624b\u52a8\u6539\u56de\u5373\u53ef\u6062\u590d\u6b63\u5e38\u3002
\n\u5982\u679c\u672a\u53d1\u73b0Python\u76f8\u5173\u6587\u4ef6\uff0c\u5373\u5224\u5b9aPython\u88ab\u5378\u8f7d\u3002
\n\u8bf7\u60a8\u627e\u4e2a\u540c\u7cfb\u7edf\u7684\u6b63\u5e38\u5b9e\u4f8b\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u3002<\/p>\n

mkdir \/python\/\r\nyum install python --downloadonly --downloaddir=\/python\/<\/pre>\n

\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5c06\/python\/\u4e2d\u7684rpm\u5305\u4f20\u5230\u5f02\u5e38\u5b9e\u4f8b\u3002<\/p>\n

scp \/python\/* root@x.x.x.x:\/tmp\/<\/pre>\n

\u6ce8\u610f\uff1ax.x.x.x\u6307\u7684\u662f\u9700\u8981\u8bbf\u95ee\u7684\u4e3b\u673a\u5730\u5740\u3002\u524d\u63d0\u662f\u4e3b\u673a\u8fd8\u6709\u516c\u7f51\u8bbf\u95ee\u80fd\u529b\uff0c\u80fd\u590d\u5236\u6587\u4ef6\u5230\u4e3b\u673a\u4e2d\u3002
\n\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5728\u5f02\u5e38\u5b9e\u4f8b\u4e0a\u5b89\u88c5Python\u5373\u53ef\u3002<\/p>\n

cd \/tmp\r\nrpm -ivh *<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u68c0\u67e5yum\u4ed3\u5e93\u662f\u5426\u914d\u7f6e\u6b63\u786e\uff0c\u53ef\u4ee5\u5230CentOS \u955c\u50cf\u4e0b\u8f7d\u963f\u91cc\u4e91repo\u914d\u7f6e\u6587\u4ef6\u3002 \u5982\u679c\u62a5\u9519\u4e2d\u5305\u542b$releas […]<\/p>\n","protected":false},"author":1469,"featured_media":198826,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-198820","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/198820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=198820"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/198820\/revisions"}],"predecessor-version":[{"id":198829,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/198820\/revisions\/198829"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/198826"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=198820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=198820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=198820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}