centos6&7&8搭建私有仓库

无论6跟7都要先准备两个文件,一个CentOS-Base.repo,另一个是epel.repo。8版本是三个文件

首先,制作私有仓库的目的就是为那些在内 的机器提供标准版本的yum源,所以我们可以先找一台可以访问外 的机器,将仓库制作下来,之后导入到内 机器,并设置从指定目录yum的repo即可使用。

一、centos7

准备两个文件:

yum clean all

yum makecache

之后创建一个目录,或者直接拿家目录搞,比如/root

cd /yum

执行以下四个命令:

[root@xxx ~]# reposync -r base  #reposync将根据刚下载的repo下载rpm包到指定文件夹
[root@xxx ~]# reposync -r extras
[root@xxx ~]# reposync -r updates
[root@xxx ~]# reposync -r epel
包很多,要等待很久下载完成,可以放在后台上跑。命令如下:

nohup reposync  –repoid=base –repoid=extras –repoid=updates –repoid=epel >output 2>&1 &

[root@xxx ~]# cd /root/base
[root@xxx ~]# createrepo ./
[root@xxx ~]# cd /root/extras
[root@xxx ~]# createrepo ./
[root@xxx ~]# cd /root/updates
[root@xxx ~]# createrepo ./
[root@xxx ~]# cd /root/epel
[root@xxx ~]# createrepo ./
 

到此就完成了,7版本现在大概50G,可以将整个root目录拷贝到移动硬盘上,再导入到内 机器

并设置base.repo,如下:

之后机器即可本地使用Yum安装rpm包,或者将所有包的目录打包放到移动硬盘里,哪个机器需要就上传上去,写一个指定路径安装的repo文件即可使用。

二、centos6

还是准备两个文件,6版本现在跟7的 址已经不同,已经不维护了,所以准备的文件需要修改。如下:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2022年8月24日
下一篇 2022年8月24日

相关推荐