签到成功

知道了

CNDBA社区CNDBA社区

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

2021-10-20 08:36 3619 0 原创 Linux
作者: hbhe0316

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

第一步,在centos7操作http://www.cndba.cn/hbhe0316/article/4959

yum install epel-release

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

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

第三步,制作成repodata

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

[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

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

[root@db01 ~]# scp -rv epel/ 172.31.0.100:/var/www/html/epel/centos7

使用机器验证http://www.cndba.cn/hbhe0316/article/4959

centos8下载epel源到本地操作,路径按照自己设置来http://www.cndba.cn/hbhe0316/article/4959

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

安装httpd并创建目录挂载http://www.cndba.cn/hbhe0316/article/4959

[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

永久挂载

[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

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

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

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

[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源了http://www.cndba.cn/hbhe0316/article/4959

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

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

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

linux

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
hbhe0316

hbhe0316

关注

1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。

  • 889
    原创
  • 1
    翻译
  • 13
    转载
  • 24
    评论
  • 访问:2768049次
  • 积分:1523
  • 等级:核心会员
  • 排名:第6名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ