周兴彬 發表於 2024-7-27 00:00:00

Centos yum源更换为国内的阿里云镜像源的方法

<p><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">阿里云是最近新出的一个镜像源。得益于阿里云的高速发展,这么大的需求,肯定会推出自己的镜像源。&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">阿里云Linux安装镜像源地址:</span>http://mirrors.aliyun.com/<br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><strong style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">CentOS系统更换软件安装源</strong><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><strong style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">第一步:备份你的原镜像文件,以免出错后可以恢复。(字母需要区分大小写)</strong><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><br/></p><pre class="brush:bash;toolbar:false">mv&nbsp;/etc/yum.repos.d/CentOS-Base.repo&nbsp;/etc/yum.repos.d/CentOS-Base.repo.backup</pre><p><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px; background-color: rgb(221, 237, 251);"></span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><strong style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/</strong><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">CentOS 5&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"></span></p><pre class="brush:bash;toolbar:false">wget&nbsp;-O&nbsp;/etc/yum.repos.d/CentOS-Base.repo&nbsp;http://mirrors.aliyun.com/repo/Centos-5.repo</pre><p><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">CentOS 6&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"></span></p><pre class="brush:bash;toolbar:false">wget&nbsp;-O&nbsp;/etc/yum.repos.d/CentOS-Base.repo&nbsp;http://mirrors.aliyun.com/repo/Centos-6.repo</pre><p><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">更改CentOS-Media.repo使其为不生效:&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">enabled=0&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><strong style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">第三步:运行yum makecache生成缓存</strong><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">清空yum缓存&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"></span></p><pre class="brush:bash;toolbar:false">yum&nbsp;clean&nbsp;all</pre><p><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">生存缓存&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"></span></p><pre class="brush:bash;toolbar:false">yum&nbsp;makecache</pre><p><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;">开始更新系统以及内核&nbsp;</span><br style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"/><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"></span></p><pre class="brush:bash;toolbar:false">yum&nbsp;upgrade</pre><p><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"></span><br/></p><p><span style="font-family: tahoma, arial, &quot;Microsoft YaHei&quot;; font-size: 14px;"><br/></span></p>
頁: [1]
查看完整版本: Centos yum源更换为国内的阿里云镜像源的方法