Centos7包管理

包源替换

替换yum源

# 阿里
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 网易
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
# 清除yum缓存并加载新的缓存
yum clean all && yum makecache

配置epel源

# 下载阿里epel源
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
# 再次清除缓存并加载新的缓存
yum clean all && yum makecache

查看当前系统启用的仓库

[root@localhost ~]# yum repolist
已加载插件:fastestmirror
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
源标识                                                                                                源名称                                                                                                                              状态
base/7/x86_64                                                                                         CentOS-7 - Base - mirrors.aliyun.com                                                                                                10,072
epel/x86_64                                                                                           Extra Packages for Enterprise Linux 7 - x86_64                                                                                      13,746
extras/7/x86_64                                                                                       CentOS-7 - Extras - mirrors.aliyun.com                                                                                                 509
updates/7/x86_64                                                                                      CentOS-7 - Updates - mirrors.aliyun.com                                                                                              3,573
repolist: 27,900

查看所有仓库

yum repolist all

遇到的问题

yum update 中断

执行yum update时异常断网后产生的缓存更新失败文件的解决办法

yum install yum-utils
yum clean all
yum-complete-transaction --cleanup-only

yum-complete-transaction用于清理未完成的事务,而该组件需要yum-utils的支持

posted @ 2019-10-12 09:07  MegaloBox  阅读(837)  评论(0编辑  收藏  举报