Linux 安装YUM源优先级(Priorities)插件

运行环境:CentOS系统

准备工具:CentOS 服务器、YUM、yum-plugin-priorities插件

所需知识:对Linux基础操作命令有一些了解。

一、打开并登陆CentOS,安装yum-plugin-priorities插件。

Yum install yum-plugin-priorities -y

Linux 安装YUM源优先级(Priorities)插件插图

(1-1图一)

二、安装完成后需配置yum priorities文件启用。

cat /etc/yum/pluginconf.d/priorities.conf

#确保priorities.conf文件内有以下内容:

[main]

enabled = 1

#确认启用配置优先级功能,priority=n<(1~99),值越小,优先级越高。

Linux 安装YUM源优先级(Priorities)插件插图1

(1-2图一)

三、下载多个YUM源。

1.进入yum源存放路径

cd /etc/yum.repos.d

2.下载多个yum源(本文优先设置为阿里云、163、中科大、epel)

#CentOS6

wget -O CentOS6-aliyun.repo http://mirrors.aliyun.com/repo/Centos-6.repo

wget -O CentOS6-163.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

wget -O CentOS6-ustc.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2

yum -y install epel-release

#CentOS7

wget -O CentOS7-aliyun.repo http://mirrors.aliyun.com/repo/Centos-7.repo

wget -O CentOS7-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

wget -O CentOS7-ustc.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3

3.配置priority设置优先级

分别在对应的.repo文件中设置好优先级

#示例

echo “priority=1” >> CentOS7-aliyun.repo

Linux 安装YUM源优先级(Priorities)插件插图2

(1-3图一)

四、清除之前的yum源缓存并重新缓存。

yum clean all

yum makecache

头像

作者:

发表评论

邮箱地址不会被公开。

Demon_运维笔记