参考:How to Setup Local HTTP Yum Repository on CentOS 7

实验环境

CentOS7 1804

步骤一:安装Nginx Web Server

最小化安装后替换Yum源为163源:http://mirrors.163.com/.help/centos.html

yum clean all
yum makecache

安装epel和nginx

yum install epel-release
yum install nginx

启用Nginx并设置开机自动启动

systemctl start nginx
systemctl enable nginx
systemctl status nginx

设置防火墙,允许http,https

firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd --reload

步骤二:创建本地Yum仓库

安装必要包,用于创建、配置、管理本地仓库

yum install createrepo  yum-utils

创建存储rpm包的目录

mkdir -p /var/www/html/repos/{base,centosplus,extras,updates}

同部远程yum仓库的包到本地yum仓库

reposync -g -l -d -m --repoid=base --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=centosplus --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=extras --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=updates --newest-only --download-metadata --download_path=/var/www/html/repos/
View Code

相关文章:

  • 2021-10-01
  • 2021-10-29
  • 2021-12-24
  • 2021-07-25
  • 2021-05-23
  • 2021-09-01
  • 2021-12-16
  • 2021-10-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-08-21
  • 2022-01-05
  • 2022-12-23
相关资源
相似解决方案