centos7配置yum源、epel源為國內鏡像


缺省yum源的服務器通常在國外,安裝時速度比較慢。為了提高安裝rpm包的速度,可以將yum源配置為國內的阿里repo。

1、先備份系統原有的repo

   [root@localhost ~]#cd /etc/yum.repos.d/

   [root@localhost yum.repos.d]#ls

   CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo  webtatic-archive.repo  webtatic-testing.repo   
   CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo  epel.repo

   [root@localhost yum.repos.d]#mkdir backup

   [root@localhost yum.repos.d]# mv * ./backup/

 

2、獲取阿里centos7的base-repo

   [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

   [root@localhost yum.repos.d]# ls
   backup  CentOS-Base.repo

 

3、清除並重新生成yum cache

   [root@localhost yum.repos.d]# yum clean all

   [root@localhost yum.repos.d]# yum makecache

 

4、測試一下新的yum源是否可用

[root@localhost yum.repos.d]# yum install -y screen
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package screen.x86_64 0:4.1.0-0.25.20120314git3c2946.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================
 Package                     Arch                        Version                                                  Repository                 Size
==================================================================================================================================================
Installing:
 screen                      x86_64                      4.1.0-0.25.20120314git3c2946.el7                         base                      552 k

Transaction Summary
==================================================================================================================================================
Install  1 Package

Total download size: 552 k
Installed size: 914 k
Downloading packages:
screen-4.1.0-0.25.20120314git3c2946.el7.x86_64.rpm                                                                         | 552 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : screen-4.1.0-0.25.20120314git3c2946.el7.x86_64                                                                                 1/1
  Verifying  : screen-4.1.0-0.25.20120314git3c2946.el7.x86_64                                                                                 1/1

Installed:
  screen.x86_64 0:4.1.0-0.25.20120314git3c2946.el7                                                                                                

Complete!

 

5、獲取阿里centos7的epel-repo

[root@localhost yum.repos.d]# wget https://mirrors.aliyun.com/repo/epel-7.repo

 

6、清除並創建cache

[root@localhost yum.repos.d]# ls
backup  CentOS-Base.repo  epel-7.repo
[root@localhost yum.repos.d]# yum clean all

[root@localhost yum.repos.d]# yum makecache

至此,大功告成!!!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM