zl程序教程

您现在的位置是:首页 >  系统

当前栏目

[转发]centos7搭建自己的yum源

centos7 搭建 自己 yum 转发
2023-09-27 14:24:15 时间

centos7搭建自己的yum源

https://www.cnblogs.com/juandx/p/6136621.html

还是需要学习呢 自己之前记得 查过 但是忘记了.

 

 
 

 http://www.wenbin.cf/post/37/

1. 安装nginx,createrepo

1
2
yum install nginx -y
yum install createrepo -y

  

2. 修改nginx配置文件,/etc/nginx/nginx.conf

1
2
3
location / {
            autoindex on;
        }

  重启nginx, systemctl restart nginx

 

3. 在nginx根目录建立文件夹

1
mkdir -p /usr/share/nginx/html/CentOS_72_1511_Yum/Aliyun/version_7.2/64bit

  

4. 准备同步阿里云的源,base,updates,extras,epel, 确保/etc/yum.repos.d/ 下只有下面这两个repo

1
2
3
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
 
wget -O /etc/yum.repos.d/CentOS-epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

  

5. 开始同步下载包

1
reposync -p /usr/share/nginx/html/CentOS_72_1511_Yum/Aliyun/version_7.2/64bit/

  

6. 建仓

1
2
3
4
createrepo -p /usr/share/nginx/html/CentOS_72_1511_Yum/Aliyun/version_7.2/64bit/base/Packages
createrepo -p /usr/share/nginx/html/CentOS_72_1511_Yum/Aliyun/version_7.2/64bit/extras/Packages
createrepo -p /usr/share/nginx/html/CentOS_72_1511_Yum/Aliyun/version_7.2/64bit/updates/Packages
createrepo -p /usr/share/nginx/html/CentOS_72_1511_Yum/Aliyun/version_7.2/64bit/epel

  

7. crontab定时同步

1
2
crontab -e
1 2 * * * /usr/bin/reposync -np /usr/share/nginx/html/CentOS_72_1511_Yum/Aliyun/version_7.2/64bit/