使用yum update -y(慎用)升级完环境后,发现yum下载python3安装包时贼慢,接下来更换yum让下载速度重回巅峰。
update和upgrade,区别如下,
yum -y update:升级所有包同时,也升级软件和系统内核;
yum -y upgrade:只升级所有包,不升级软件和系统内核,软件和内核保持原样。
mkdir /opt/centos-yum.bak
mv /etc/yum.repos.d/* /opt/centos-yum.bak/
查看系统版本
cat /etc/redhat-release
示例:
[root@sanxingtongxue bin]# cat /etc/redhat-release
CentOS Linux release 8.5.2111
阿里云开源镜像站
网易
repo文件下载
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
这里使用阿里云开源镜像站。
Centos-8.repo对应版本下载,如CentOS 7 改为Centos-7.repo。
示例:
[root@sanxingtongxue bin]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
--2022-08-15 19:36:10-- http://mirrors.aliyun.com/repo/Centos-8.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 220.181.158.239, 220.181.158.244, 220.181.158.248, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|220.181.158.239|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2590 (2.5K) [application/octet-stream]
Saving to: '/etc/yum.repos.d/CentOS-Base.repo'
/etc/yum.repos.d/CentOS-Base.repo 100%[=================================================================================================================================================================>] 2.53K --.-KB/s in 0s
2022-08-15 19:36:10 (467 MB/s) - '/etc/yum.repos.d/CentOS-Base.repo' saved [2590/2590]
yum clean all
yum makecache
[root@sanxingtongxue bin]# yum clean all
/usr/lib/python3.6/site-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
from cryptography import x509
503 files removed
[root@sanxingtongxue bin]# yum makecache
/usr/lib/python3.6/site-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
from cryptography import x509
CentOS-8 - Base - mirrors.aliyun.com 16 MB/s | 4.6 MB 00:00
CentOS-8 - Extras - mirrors.aliyun.com 72 kB/s | 10 kB 00:00
CentOS-8 - AppStream - mirrors.aliyun.com 22 MB/s | 8.4 MB 00:00
Metadata cache created.
yum( Yellow dog Updater, Modified)是一个在 Fedora 和 RedHat 以及 SUSE 中的 Shell 前端软件包管理器。
基于 RPM 包管理,能够从指定的服务器自动下载 RPM 包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
yum 提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。
yum 语法
yum [options] [command] [package ...]
options:可选,选项包括-h(帮助),-y(当安装过程提示选择全部为 "yes"),-q(不显示安装的过程)等等。
command:要进行的操作。
package:安装的包名。
yum常用命令
1. 列出所有可更新的软件清单命令:yum check-update
2. 更新所有软件命令:yum update
3. 仅安装指定的软件命令:yum install
4. 仅更新指定的软件命令:yum update
5. 列出所有可安裝的软件清单命令:yum list
6. 删除软件包命令:yum remove
7. 查找软件包命令:yum search
8. 清除缓存命令:
yum clean packages: 清除缓存目录下的软件包
yum clean headers: 清除缓存目录下的 headers
yum clean oldheaders: 清除缓存目录下旧的 headers
yum clean, yum clean all (= yum clean packages; yum clean oldheaders) :清除缓存目录下的软件包及旧的 headers

点赞 收藏 关注