Centos7配置网络源

Centos7配置网络源

此处选择阿里镜像源(国内源快些)

  • 阿里镜像站:https://developer.aliyun.com/mirror
  • 选择centos

Centos7配置网络源_第1张图片

  • 复制对应版本的链接,此处选择Centos7,选用wget 方式 

Centos7配置网络源_第2张图片

 

  • yum install wget
[root@localhost yum.repos.d]# yum install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================
 Package             Arch                  Version                    Repository              Size
===================================================================================================
Installing:
 wget                x86_64                1.14-18.el7                CentOS7                547 k

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

Total download size: 547 k
Installed size: 2.0 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : wget-1.14-18.el7.x86_64                                                         1/1
  Verifying  : wget-1.14-18.el7.x86_64                                                         1/1

Installed:
  wget.x86_64 0:1.14-18.el7

Complete!
  • wget  
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
--2020-05-09 17:56:09--  https://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 113.142.77.248, 113.142.38.184, 113.142.77.249, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|113.142.77.248|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

100%[=========================================================>] 2,523       --.-K/s   in 0s

2020-05-09 17:56:09 (249 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]
  • yum clean all && yum makecache
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: CentOS7 base extras updates
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Centos7                                                             | 3.6 kB  00:00:00
base                                                                | 3.6 kB  00:00:00
extras                                                              | 2.9 kB  00:00:00
updates                                                             | 2.9 kB  00:00:00
(1/14): Centos7/group_gz                                            | 166 kB  00:00:00
(2/14): Centos7/primary_db                                          | 6.0 MB  00:00:00
(3/14): Centos7/other_db                                            | 2.6 MB  00:00:00
(4/14): Centos7/filelists_db                                        | 7.1 MB  00:00:00
(5/14): base/7/x86_64/group_gz                                      | 153 kB  00:00:00
(6/14): base/7/x86_64/filelists_db                                  | 7.1 MB  00:00:01
(7/14): base/7/x86_64/primary_db                                    | 6.1 MB  00:00:01
(8/14): base/7/x86_64/other_db                                      | 2.6 MB  00:00:00
(9/14): extras/7/x86_64/primary_db                                  | 194 kB  00:00:00
(10/14): extras/7/x86_64/other_db                                   | 122 kB  00:00:00
(11/14): updates/7/x86_64/primary_db                                | 1.3 MB  00:00:01
(12/14): updates/7/x86_64/other_db                                  | 183 kB  00:00:00
(13/14): updates/7/x86_64/filelists_db                              | 980 kB  00:00:02
(14/14): extras/7/x86_64/filelists_db                               | 205 kB  00:00:05
Metadata Cache Created

之后就可以愉快的yum install * 了

-------------------------------------------------------------------------------------------------------返回目录

你可能感兴趣的:(linux)