centos yum源配置(CentOS7 原生 yum 源修改为阿里 yum 源)

centos yum源配置

centos搭建内网yum源

您好,在CentOS系统上搭建本地内网YUM仓库的方法如下:

  1. 安装httpd和createrepo工具
yum install httpd createrepo -y
  1. 创建仓库目录并切换到该目录
mkdir -p /var/www/html/centosrepo
cd /var/www/html/centosrepo
  1. 将本地rpm包复制到该目录下,例如:
cp /path/to/rpm/*.rpm /var/www/html/centosrepo/
  1. 创建仓库元数据
createrepo .

这将扫描当前目录下的所有rpm包并生成仓库元数据。

  1. 启动httpd服务
systemctl start httpd

内网centos的yum软件源配置

内网centos7的yum软件源已搭建完成,使用下面命令即可在内网的centos7操作系统上使用:

  mkdir /etc/yum.repos.d/backup
  mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup
  wget -P /etc/yum.repos.d/ http://192.168.1.100:9090/centos/CentOS-Base.repo
  chmod +r /etc/yum.repos.d/CentOS-Base.repo
  yum clean all
  yum makecache

CentOS7 原生 yum 源修改为阿里 yum 源

阿里镜像源官网:http://mirrors.aliyun.com/repo/

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache

添加 epel 源

rpm -qa |grep epel  
rpm -e epel-release
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache

猜你喜欢

转载自blog.csdn.net/inthat/article/details/97015979