更新centos中yum倉庫
阿新 • • 發佈:2022-12-01
1.增加基礎源
/etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra baseurl=https://repo.huaweicloud.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra baseurl=https://repo.huaweicloud.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra baseurl=https://repo.huaweicloud.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra baseurl=https://repo.huaweicloud.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
2.增加擴充套件源
/etc/yum.repos.d/epel.repo
[epel] name=Extra Packages for Enterprise Linux 7 - $basearch baseurl=https://repo.huaweicloud.com/epel/7/$basearch #metalink=https://mirrors.fedoraproject.org/#metalink?repo=epel-7&arch=$basearch failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 [epel-debuginfo] name=Extra Packages for Enterprise Linux 7 - $basearch - Debug baseurl=https://repo.huaweicloud.com/epel/7/$basearch/debug #metalink=https://mirrors.fedoraproject.org/#metalink?repo=epel-debug-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 7 - $basearch - Source baseurl=https://repo.huaweicloud.com/epel/7/SRPMS #metalink=https://mirrors.fedoraproject.org/#metalink?repo=epel-source-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1
3.清空Yum快取
[root@10-40-9-182 shell]# yum clean all
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Cleaning repos: base docker-ce-stable epel extras treasuredata updates
Cleaning up list of fastest mirrors
4.更新yum快取
[root@10-40-9-182 shell]# yum makecache Loaded plugins: fastestmirror Determining fastest mirrors base | 3.6 kB 00:00:00 docker-ce-stable | 3.5 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 treasuredata | 3.0 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/23): base/7/x86_64/group_gz | 153 kB 00:00:00 (2/23): base/7/x86_64/primary_db | 6.1 MB 00:00:00 (3/23): base/7/x86_64/filelists_db | 7.2 MB 00:00:00 (4/23): base/7/x86_64/other_db | 2.6 MB 00:00:00 (5/23): docker-ce-stable/7/x86_64/updateinfo | 55 B 00:00:00 (6/23): docker-ce-stable/7/x86_64/filelists_db | 36 kB 00:00:00 (7/23): epel/x86_64/group_gz | 98 kB 00:00:00 (8/23): epel/x86_64/updateinfo | 1.0 MB 00:00:00 (9/23): epel/x86_64/prestodelta | 1.2 kB 00:00:00 (10/23): epel/x86_64/primary_db | 7.0 MB 00:00:00 (11/23): docker-ce-stable/7/x86_64/primary_db | 88 kB 00:00:00 (12/23): epel/x86_64/other_db | 3.4 MB 00:00:00 (13/23): docker-ce-stable/7/x86_64/other_db | 127 kB 00:00:00 (14/23): epel/x86_64/filelists_db | 12 MB 00:00:00 (15/23): extras/7/x86_64/filelists_db | 276 kB 00:00:00 (16/23): extras/7/x86_64/primary_db | 249 kB 00:00:00 (17/23): extras/7/x86_64/other_db | 149 kB 00:00:00 (18/23): treasuredata/7/x86_64/primary_db | 34 kB 00:00:00 (19/23): treasuredata/7/x86_64/other_db | 2.9 kB 00:00:00 (20/23): updates/7/x86_64/filelists_db | 10 MB 00:00:00 (21/23): updates/7/x86_64/other_db | 1.2 MB 00:00:00 (22/23): updates/7/x86_64/primary_db | 18 MB 00:00:00 (23/23): treasuredata/7/x86_64/filelists_db | 504 kB 00:00:00 Metadata Cache Created
5.安裝screen
[root@10-40-9-182 shell]# yum info screen
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
Name : screen
Arch : x86_64
Version : 4.1.0
Release : 0.27.20120314git3c2946.el7_9
Size : 553 k
Repo : updates/7/x86_64
Summary : A screen manager that supports multiple logins on one terminal
URL : http://www.gnu.org/software/screen
License : GPLv2+
Description : The screen utility allows you to have multiple logins on just one
: terminal. Screen is useful for users who telnet into a machine or are
: connected via a dumb terminal, but want to use more than just one
: login.
:
: Install the screen package if you need a screen manager that can
: support multiple logins on one terminal.
[root@10-40-9-182 shell]# yum -y install screen
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package screen.x86_64 0:4.1.0-0.27.20120314git3c2946.el7_9 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================================================================================
Installing:
screen x86_64 4.1.0-0.27.20120314git3c2946.el7_9 updates 553 k
Transaction Summary
========================================================================================================================================================================================================================================
Install 1 Package
Total download size: 553 k
Installed size: 914 k
Downloading packages:
screen-4.1.0-0.27.20120314git3c2946.el7_9.x86_64.rpm | 553 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : screen-4.1.0-0.27.20120314git3c2946.el7_9.x86_64 1/1
Verifying : screen-4.1.0-0.27.20120314git3c2946.el7_9.x86_64 1/1
Installed:
screen.x86_64 0:4.1.0-0.27.20120314git3c2946.el7_9
Complete!