Linux系统运维笔记,CentOS 7.9安装阿里(aliyun)yum

阿里巴巴开源镜像站点:http://mirrors.aliyun.com

 

yum源理解
yum源仓库的地址 在/etc/yum.repos.d/,并且只能读出第一层的repo文件,yum仓库的文件都是以.repo结尾的。
为加快yum下载,我们下载阿里云的.repo仓库文件 ,放到/etc/yum.repos.d/

下载前先备份原本的仓库文件
cd /etc/yum.repos.d/
mkdir allbak
mv ./* allbak

下载阿里云仓库文件
CentOS 7使用:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

清空原本yum缓存
yum clean all

生成新的阿里云的yum缓存,加速下载预热数据
yum makecache

 

测试

yum list                #显示软件源中所有可用的包

yum list|grep nfs   #查找软件源中某个包

 

其它。

一般内网服务器通过代理上网,内网服务器修改本地HOST解析,来实现代理上网使用阿里云的yum

内网服务器修改本地HOST解析

vi /etc/hosts 编辑HOST文件
192.18.111.1 mirrors.aliyun.com 添加阿里云yum域名解析

 

一些报错解决方法

有时会出现 nothing to do 或者 no package ntfs-3g available 提示,原因是默认源里没有ntfs3g包,可以添加aliyun的epel源来yum安装
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo      #添加epel yum源
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo     #或者这样,也是添加epel yum源
yum list|grep ntfs-3g   #查看源里有没有ntfs-3g

posted on 2022-09-14 19:10  yi-sheng  阅读(1352)  评论(0编辑  收藏  举报