CentOS7 内网服务器yum修改

1、首先确定的内网服务器是有yum源代理服务器的

2、修改 /etc/yum.conf 配置文件,增加代理ip和端口号

proxy=http://ip.ip.ip.ip:port

3、备份源是文件

bash 复制代码
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

4、修改配置文件 vi CentOS-Base.repo,之后保存

bash 复制代码
# CentOS-Base.repo
# 替换为阿里云镜像源后的配置

[base]
name=CentOS-7 - Base - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 已禁用mirrorlist机制
# mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=$infra

[updates]
name=CentOS-7 - Updates - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 已禁用mirrorlist机制
# mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=$infra

[extras]
name=CentOS-7 - Extras - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/extras/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 已禁用mirrorlist机制
# mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=$infra

[centosplus]
name=CentOS-7 - Plus - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 已禁用mirrorlist机制
# mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=centosplus&infra=$infra

5、执行命令清理并重建缓存

bash 复制代码
sudo yum clean all
sudo yum makecache

6、验证配置

bash 复制代码
yum repolist

输出内容包含baseurl中的地址"mirrors.aliyun.com",标识成功

相关推荐
skywalk816313 分钟前
unbound dns解析出现问题,寻求解决之道
运维·服务器·dns·unbound
酉鬼女又兒15 分钟前
零基础入门Linux指南:每天一个Linux命令_pwd
linux·运维·服务器
云飞云共享云桌面17 分钟前
高性能图形工作站的资源如何共享给10个SolidWorks研发设计用
linux·运维·服务器·前端·网络·数据库·人工智能
skywalk816319 分钟前
走近科学:unbound dns域名服务器自己本地解析出现问题,寻求解决之道
运维·服务器·dns·unbound
zl_dfq19 分钟前
Linux 之 【多线程】(pthread_xxx、轻量级进程、原生线程库、线程ID、__thread、线程栈、线程与信号、线程与程序替换)
linux
choke23319 分钟前
Python 基础语法精讲:数据类型、运算符与输入输出
java·linux·服务器
袁煦丞 cpolar内网穿透实验室23 分钟前
远程调试内网 Kafka 不再求运维!cpolar 内网穿透实验室第 791 个成功挑战
运维·分布式·kafka·远程工作·内网穿透·cpolar
AZ996ZA33 分钟前
自学linux的第二十一天【DHCP 服务从入门到实战】
linux·运维·服务器·php
_OP_CHEN38 分钟前
【Linux系统编程】(二十八)深入 ELF 文件原理:从目标文件到程序加载的完整揭秘
linux·操作系统·编译·c/c++·目标文件·elf文件
Web极客码41 分钟前
WordPress博客关键词
服务器·wordpress·网站加速