{"id":1306,"date":"2026-01-10T10:30:31","date_gmt":"2026-01-10T02:30:31","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=1306"},"modified":"2026-01-10T10:30:31","modified_gmt":"2026-01-10T02:30:31","slug":"yum%e6%ba%90%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6centos-base-repo%e5%ae%8c%e6%95%b4%e6%ad%a5%e9%aa%a4","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2026\/01\/10\/yum%e6%ba%90%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6centos-base-repo%e5%ae%8c%e6%95%b4%e6%ad%a5%e9%aa%a4\/","title":{"rendered":"yum\u6e90\u914d\u7f6e\u6587\u4ef6CentOS-Base.repo\u5b8c\u6574\u6b65\u9aa4"},"content":{"rendered":"\n<p>\u597d\u7684\uff0c\u6211\u7ed9\u4f60\u6574\u7406\u4e00\u4efd <strong>CentOS \u7cfb\u7edf yum \u6e90\u914d\u7f6e\u6587\u4ef6 CentOS-Base.repo \u7684\u5b8c\u6574\u914d\u7f6e\u6b65\u9aa4<\/strong>\uff0c\u5305\u62ec<strong>\u5907\u4efd\u3001\u66ff\u6362\u3001\u9a8c\u8bc1<\/strong>\u5168\u8fc7\u7a0b\uff0c\u9002\u5408\u751f\u4ea7\u6216\u6d4b\u8bd5\u73af\u5883\u4f7f\u7528\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e00\u3001\u524d\u671f\u51c6\u5907<\/h1>\n\n\n\n<p>1\ufe0f\u20e3 \u786e\u8ba4\u7cfb\u7edf\u7248\u672c<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncat \/etc\/centos-release\n# \u8f93\u51fa\u793a\u4f8b\uff1aCentOS Linux release 7.9.2009 (Core)\n\n<\/pre><\/div>\n\n\n<p>2\ufe0f\u20e3 \u5b89\u88c5\u5fc5\u8981\u5de5\u5177\uff08\u4e00\u822c\u7cfb\u7edf\u81ea\u5e26\uff09<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum install -y wget vim\n\n<\/pre><\/div>\n\n\n<p>3\ufe0f\u20e3 \u5907\u4efd\u539f\u6709 yum \u6e90<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncd \/etc\/yum.repos.d\/\nmkdir backup\nmv *.repo backup\/\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e8c\u3001\u83b7\u53d6\u5b98\u65b9 CentOS-Base.repo \u6587\u4ef6<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">1\ufe0f\u20e3 \u5b98\u65b9\u6e90 CentOS-Base.repo\uff08\u4ee5 CentOS 7 \u4e3a\u4f8b\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;base]\nname=CentOS-$releasever - Base\nbaseurl=http:\/\/mirror.centos.org\/centos\/$releasever\/os\/$basearch\/\ngpgcheck=1\ngpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-CentOS-7\nenabled=1\n<\/pre><\/div>\n\n<p>[updates]<\/p>\n\n\n\n<p>name=CentOS-$releasever &#8211; Updates baseurl=http:\/\/mirror.centos.org\/centos\/$releasever\/updates\/$basearch\/ gpgcheck=1 gpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-CentOS-7 enabled=1<\/p>\n\n\n<p>[extras]<\/p>\n\n\n\n<p>name=CentOS-$releasever &#8211; Extras baseurl=http:\/\/mirror.centos.org\/centos\/$releasever\/extras\/$basearch\/ gpgcheck=1 gpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-CentOS-7 enabled=1<\/p>\n\n\n<p>[centosplus]<\/p>\n\n\n\n<p>name=CentOS-$releasever &#8211; Plus baseurl=http:\/\/mirror.centos.org\/centos\/$releasever\/centosplus\/$basearch\/ gpgcheck=1 gpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-CentOS-7 enabled=0<\/p>\n\n\n\n<p>\ud83d\udccc \u8bf4\u660e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>$releasever<\/code> \u2192 \u7cfb\u7edf\u7248\u672c\uff08\u5982 7\uff09<\/li>\n\n\n\n<li><code>$basearch<\/code> \u2192 \u7cfb\u7edf\u67b6\u6784\uff08x86_64 \u6216 i386\uff09<\/li>\n\n\n\n<li><code>enabled=1<\/code> \u2192 \u542f\u7528\u6b64\u6e90\uff0c<code>0<\/code> \u2192 \u7981\u7528<\/li>\n\n\n\n<li><code>gpgcheck=1<\/code> \u2192 \u5f00\u542f GPG \u7b7e\u540d\u9a8c\u8bc1<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2\ufe0f\u20e3 \u4f7f\u7528\u56fd\u5185\u955c\u50cf\uff08\u52a0\u901f\u66f4\u65b0\uff09<\/h2>\n\n\n\n<p>\u4ee5 <strong>\u963f\u91cc\u4e91 CentOS \u955c\u50cf<\/strong>\u4e3a\u4f8b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;base]\nname=CentOS-$releasever - Base - Aliyun\nbaseurl=http:\/\/mirrors.aliyun.com\/centos\/$releasever\/os\/$basearch\/\ngpgcheck=1\ngpgkey=http:\/\/mirrors.aliyun.com\/centos\/RPM-GPG-KEY-CentOS-7\nenabled=1\n<\/pre><\/div>\n\n<p>[updates]<\/p>\n\n\n\n<p>name=CentOS-$releasever &#8211; Updates &#8211; Aliyun baseurl=http:\/\/mirrors.aliyun.com\/centos\/$releasever\/updates\/$basearch\/ gpgcheck=1 gpgkey=http:\/\/mirrors.aliyun.com\/centos\/RPM-GPG-KEY-CentOS-7 enabled=1<\/p>\n\n\n<p>[extras]<\/p>\n\n\n\n<p>name=CentOS-$releasever &#8211; Extras &#8211; Aliyun baseurl=http:\/\/mirrors.aliyun.com\/centos\/$releasever\/extras\/$basearch\/ gpgcheck=1 gpgkey=http:\/\/mirrors.aliyun.com\/centos\/RPM-GPG-KEY-CentOS-7 enabled=1<\/p>\n\n\n<p>[centosplus]<\/p>\n\n\n\n<p>name=CentOS-$releasever &#8211; Plus &#8211; Aliyun baseurl=http:\/\/mirrors.aliyun.com\/centos\/$releasever\/centosplus\/$basearch\/ gpgcheck=1 gpgkey=http:\/\/mirrors.aliyun.com\/centos\/RPM-GPG-KEY-CentOS-7 enabled=0<\/p>\n\n\n\n<p>\ud83d\udccc \u56fd\u5185\u955c\u50cf\u5e38\u7528\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u963f\u91cc\u4e91\uff1a<a href=\"http:\/\/mirrors.aliyun.com\/centos\/\">http:\/\/mirrors.aliyun.com\/centos\/<\/a><\/li>\n\n\n\n<li>\u7f51\u6613\uff1a<a href=\"http:\/\/mirrors.163.com\/centos\/\">http:\/\/mirrors.163.com\/centos\/<\/a><\/li>\n\n\n\n<li>\u6e05\u534e\uff1a<a href=\"https:\/\/mirrors.tuna.tsinghua.edu.cn\/centos\/\">https:\/\/mirrors.tuna.tsinghua.edu.cn\/centos\/<\/a><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e09\u3001\u66ff\u6362 CentOS-Base.repo \u6587\u4ef6<\/h1>\n\n\n\n<p>1\ufe0f\u20e3 \u4e0b\u8f7d\u963f\u91cc\u4e91 repo \u6587\u4ef6<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncd \/etc\/yum.repos.d\/\nwget -O CentOS-Base.repo http:\/\/mirrors.aliyun.com\/repo\/Centos-7.repo\n\n<\/pre><\/div>\n\n\n<p>2\ufe0f\u20e3 \u6216\u624b\u52a8\u521b\u5efa\u6587\u4ef6<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nvim \/etc\/yum.repos.d\/CentOS-Base.repo\n# \u7c98\u8d34\u4e0a\u9762\u56fd\u5185\u955c\u50cf\u5185\u5bb9\uff0c\u4fdd\u5b58\u9000\u51fa\n\n<\/pre><\/div>\n\n\n<p>3\ufe0f\u20e3 \u6e05\u7406\u65e7\u7f13\u5b58<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum clean all\nrm -rf \/var\/cache\/yum\/*\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u56db\u3001\u66f4\u65b0 yum \u7f13\u5b58<\/h1>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum makecache\n\n<\/pre><\/div>\n\n\n<p>\u68c0\u67e5\u662f\u5426\u6210\u529f\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum repolist\n\n<\/pre><\/div>\n\n\n<p>\u2705 \u8f93\u51fa\u7c7b\u4f3c\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nrepo id               repo name                               status\nbase\/7\/x86_64         CentOS-7 - Base - mirrors.aliyun.com      10,000\nupdates\/7\/x86_64      CentOS-7 - Updates - mirrors.aliyun.com   3,000\nextras\/7\/x86_64       CentOS-7 - Extras - mirrors.aliyun.com      500\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e94\u3001\u6d4b\u8bd5\u5b89\u88c5\u8f6f\u4ef6\u5305<\/h1>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum install -y wget vim git\n\n<\/pre><\/div>\n\n\n<p>\u5982\u679c\u80fd\u6b63\u5e38\u4e0b\u8f7d\u548c\u5b89\u88c5\uff0c\u8bf4\u660e yum \u6e90\u914d\u7f6e\u6210\u529f\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u516d\u3001\u5e38\u89c1\u95ee\u9898\u6392\u67e5<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u95ee\u9898<\/th><th>\u89e3\u51b3\u65b9\u6cd5<\/th><\/tr><\/thead><tbody><tr><td><code>Could not retrieve mirrorlist<\/code><\/td><td>\u68c0\u67e5\u7f51\u7edc\u6216\u6362\u56fd\u5185\u955c\u50cf<\/td><\/tr><tr><td>GPG key \u9519\u8bef<\/td><td>\u786e\u8ba4 gpgkey \u5730\u5740\u6b63\u786e\uff0c\u6267\u884c <code>rpm --import &lt;gpgkey&gt;<\/code><\/td><\/tr><tr><td>yum \u7f13\u5b58\u4e0d\u5237\u65b0<\/td><td>\u6267\u884c <code>yum clean all &amp;&amp; yum makecache<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e03\u3001\u4e00\u53e5\u8bdd\u603b\u7ed3\uff08\u5fc5\u80cc\uff09<\/h1>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>CentOS yum \u6e90\u914d\u7f6e\u6b65\u9aa4\uff1a\u5907\u4efd\u65e7 repo \u2192 \u4e0b\u8f7d\u6216\u521b\u5efa\u65b0 repo\uff08\u5b98\u65b9\u6216\u56fd\u5185\u955c\u50cf\uff09 \u2192 \u6e05\u7406\u7f13\u5b58 \u2192 \u66f4\u65b0\u7f13\u5b58 \u2192 \u9a8c\u8bc1\u5b89\u88c5\u3002<\/strong><\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u597d\u7684\uff0c\u6211\u7ed9\u4f60\u6574\u7406\u4e00\u4efd CentOS \u7cfb\u7edf yum \u6e90\u914d\u7f6e\u6587\u4ef6 CentOS-Ba&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2026\/01\/10\/yum%e6%ba%90%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6centos-base-repo%e5%ae%8c%e6%95%b4%e6%ad%a5%e9%aa%a4\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-1306","post","type-post","status-publish","format-standard","hentry","category-55"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/1306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=1306"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/1306\/revisions"}],"predecessor-version":[{"id":1307,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/1306\/revisions\/1307"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=1306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=1306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=1306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}