搭建centos7,8本地epel源本地使用

一.环境准备
1,vbox上准备好挂载需要的镜像比如6,7,8系统
2,挂载在centos8系统
3,需要用centos7下载epel镜像
4,制作成repodata数据源
5,从centos7远程拷贝到centos8挂载目录

https://www.cndba.cn/hbhe0316/article/4959
https://www.cndba.cn/hbhe0316/article/4959
https://www.cndba.cn/hbhe0316/article/4959

第一步,在centos7操作

https://www.cndba.cn/hbhe0316/article/4959
yum install epel-release

第二步,大概需要一个小时左右https://www.cndba.cn/hbhe0316/article/4959https://www.cndba.cn/hbhe0316/article/4959

[root@localhost ~]# reposync -r epel -p /root/

第三步,制作成repodata

[root@db01 ~]# yum -y install createrepo
[root@db01 ~]# createrepo -v /root/epel
[root@db01 ~]# ls
anaconda-ks.cfg  epel
[root@db01 ~]# cd epel/
[root@db01 epel]# ls
Packages  repodata

第四步,拷贝数据到目标服务器上

https://www.cndba.cn/hbhe0316/article/4959
[root@db01 ~]# scp -rv epel/ 172.31.0.100:/var/www/html/epel/centos7

使用机器验证

centos8下载epel源到本地操作,路径按照自己设置来

[root@db01 ~]# dnf reposync --repoid=epel --download-metadata -p /path

安装httpd并创建目录挂载

[root@db01 ~]# cd /var/www/html/
[root@db01 html]# mkdir centos/{6,7,8} -p
[root@db01 centos]# mount /dev/sr0 /var/www/html/centos/8

[root@db01 centos]# mount /dev/sr1 /var/www/html/centos/7

[root@db01 centos]# mount /dev/sr2 /var/www/html/centos/6

永久挂载https://www.cndba.cn/hbhe0316/article/4959

[root@db01 epel]# cat /etc/fstab
/dev/sr0                                /var/www/html/centos/8    iso9660 defaults        0 0
/dev/sr1                                /var/www/html/centos/7    iso9660 defaults        0 0
/dev/sr2                                /var/www/html/centos/6    iso9660 defaults        0 0

使用随便一台没有epel源的机器验证

[root@db01 ~]# cat /etc/yum.repos.d/centos7.repo
[base]
name=base
baseurl=http://192.168.56.100/centos/7/
gpgcheck=0
enabled=1

[epel]
name=epel
baseurl=http://192.168.56.100/epel/centos7/epel/
gpgcheck=0
enabled=1

路径设置成了需要域名解析,所有需要机器配置都要设置域名解析,不然不会成功,例如:https://www.cndba.cn/hbhe0316/article/4959

https://www.cndba.cn/hbhe0316/article/4959

重新yum repolist就会看到上面制作的本地epel源了

[root@db01 ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                                                                     repo name                                                                                 status
!base                                                                                       base                                                                                      0
!epel                                                                                       epel                                                                                      0
repolist: 0
[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base epel
Cleaning up list of fastest mirrors
Other repos take up 46 M of disk space (use --verbose for details)
[root@localhost ~]# yum repolist

到此本地搭建完成,不用到外网去epel源了

使用本地的epel源安装一个Nginx试试吧

[root@db01~]# yum install -y nginx

版权声明:本文为博主原创文章,未经博主允许不得转载。

linux

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值