Build local yum source and online yum source
1. Build a local yum source
The company's internal network builds a server, and usually cannot connect to the external network, resulting in the yum installation tool in CentOS cannot be used; installing software using the rpm package has to deal with various dependencies, which is very troublesome. We can solve this problem by building a local yum source
mount /dev/cdrom /mnt/ #把光盘挂载到/mnt目录下
cd /etc/yum.repos.d/
mkdir repos.bak #创建一个备份目录
mv *.repo repos.bak #将目录下的文件移到到备份目录中
vim local.repo
[local] #仓库类别
name=local #仓库名称
baseurl=file:///mnt #指定URL 访问路径为光盘挂载目录
enabled=1 #开启此yum源,此为默认项,可省略
gpgcheck=0 #不验证软件包的签名
yum clean all && yum makecache # 删除yum缓存并更新
Two, build online yum source
Here we need the system to be able to connect to the external network.
We choose Alibaba Cloud Mirror as the online source
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo