CentOS7は、AlibabaCloudのミラーソースをyumソースとして設定します

1.実験環境

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

2.ネットワーク環境のテスト
サーバーはインターネットにアクセスできる必要があります。ここでは、ping www.baidu.comを使用してテストします。ドメイン名を使用すると、ネットワーク接続をテストできるだけでなく、ドメイン名解決の機能もテストできます。

[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data.
64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=1 ttl=55 time=21.0 ms

3. wget
をインストールするwgetがLinuxシステムにインストールされていない場合は、wgetをインストールする必要があります。Wgetは非対話型のダウンロードツールです。パラメータyの機能は、インストールプロセス中にユーザーがyesまたはnoを入力する必要がある場合、デフォルトはyesです。

yum -y install wget

4. AlibabaCloudリポジトリファイルをダウンロードします。
repoディレクトリに入り、システムに付属のrepoファイルを削除します。サーバーのyumウェアハウス構成ファイルとしてAlibabaCloudリポジトリファイルをダウンロードします。

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/aliyun.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2020-05-31 00:00:52--  http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 218.67.61.95, 218.67.61.32, 61.131.39.13, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|218.67.61.95|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to:/etc/yum.repos.d/aliyun.repo’

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

2020-05-31 00:00:52 (297 MB/s) -/etc/yum.repos.d/aliyun.repo’ saved [2523/2523]

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

5.yumキャッシュをクリアします。

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

6.yumキャッシュを作成します。

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

7.効果テスト。
ソフトウェアテストをインストールするだけです。ここでは、インストールhttpdテストを使用します。

[root@localhost yum.repos.d]# yum -y install httpd
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 httpd.x86_64 0:2.4.6-93.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-93.el7.centos for package: httpd-2.4.6-93.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-93.el7.centos.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-93.el7.centos.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-93.el7.centos.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-5.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-93.el7.centos will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================
 Package                       Arch                     Version                                  Repository              Size
==============================================================================================================================
Installing:
 httpd                         x86_64                   2.4.6-93.el7.centos                      base                   2.7 M
Installing for dependencies:
 apr                           x86_64                   1.4.8-5.el7                              base                   103 k
 apr-util                      x86_64                   1.5.2-6.el7                              base                    92 k
 httpd-tools                   x86_64                   2.4.6-93.el7.centos                      base                    92 k
 mailcap                       noarch                   2.1.41-2.el7                             base                    31 k

Transaction Summary
==============================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 3.0 M
Installed size: 10 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/apr-1.4.8-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for apr-1.4.8-5.el7.x86_64.rpm is not installed
(1/5): apr-1.4.8-5.el7.x86_64.rpm                                                                      | 103 kB  00:00:00     
(2/5): apr-util-1.5.2-6.el7.x86_64.rpm                                                                 |  92 kB  00:00:00     
(3/5): httpd-tools-2.4.6-93.el7.centos.x86_64.rpm                                                      |  92 kB  00:00:00     
(4/5): mailcap-2.1.41-2.el7.noarch.rpm                                                                 |  31 kB  00:00:00     
(5/5): httpd-2.4.6-93.el7.centos.x86_64.rpm                                                            | 2.7 MB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------
Total                                                                                         4.6 MB/s | 3.0 MB  00:00:00     
Retrieving key from http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 From       : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-5.el7.x86_64                                                                                     1/5 
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                                2/5 
  Installing : httpd-tools-2.4.6-93.el7.centos.x86_64                                                                     3/5 
  Installing : mailcap-2.1.41-2.el7.noarch                                                                                4/5 
  Installing : httpd-2.4.6-93.el7.centos.x86_64                                                                           5/5 
  Verifying  : apr-1.4.8-5.el7.x86_64                                                                                     1/5 
  Verifying  : httpd-tools-2.4.6-93.el7.centos.x86_64                                                                     2/5 
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                                3/5 
  Verifying  : httpd-2.4.6-93.el7.centos.x86_64                                                                           4/5 
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                5/5 

Installed:
  httpd.x86_64 0:2.4.6-93.el7.centos                                                                                          

Dependency Installed:
  apr.x86_64 0:1.4.8-5.el7              apr-util.x86_64 0:1.5.2-6.el7         httpd-tools.x86_64 0:2.4.6-93.el7.centos        
  mailcap.noarch 0:2.1.41-2.el7        

Complete!

おすすめ

転載: blog.csdn.net/weixin_44631823/article/details/106442338