美文网首页
本地yum源http挂载

本地yum源http挂载

作者: 窥识 | 来源:发表于2020-08-11 09:49 被阅读0次

    参考地址https://blog.csdn.net/Chloe_Yang/article/details/88183382

    一、先本地挂载安装http服务

    1.在/mnt下创建cdrom目录

    mkdir cdrom

    2.挂载镜像文件至该目录下

    mount CentOS-7-x86_64-Everything-1804.iso /mnt/cdrom/

    3.备份/etc/yum.repos.d下文件并编辑文件CentOS-Base.repo

    vi /etc/yum.repos.d/CentOS-Base.repo

    4.更改文件内容如下:

    [dvd]

    name=dvd

    baseurl=file:///mnt/cdrom

    enable=1         # 1代表启用该yum源,0代表不启用

    gpgcheck=0     # 是否检查源的合法性,0代表不检查(不用写gpgkey的存放路径),1代表检查(要写gpgkey的存放路径)

    gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release   #gpgkey的绝对路径

    5.更改完成后执行命令

    yum clean all

    yum makecache

    6.使用yum安装http服务并启动httpd

    yum install -y httpd

    systemctl start httpd.service

    systemctl enable httpd

    二、http方式yum源的制作

    1.取消原来的本地挂载重新挂载到http服务路径下

    umount /mnt/cdrom/ ##取消本地挂载

    cd /var/www/html/ ##切换至http服务路径

    mkdir Centos ##创建挂载文件存放目录

    mount -o loop CentOS-7-x86_64-Everything-1804.iso /var/www/html/Centos/ ##挂载镜像包

    2.重启刷新httpd服务

    systemctl restart httpd

    3.更改yum源配置文件vi /etc/yum.repos.d/CentOS-Base.repo

    [dvd]

    name=dvd

    baseurl=http://10.0.4.51/Centos

    gpgcheck=0

    gpgkey=http://10.0.4.51/Centos/RPM-GPG-KEY-CenmtOS-7

    enabled=1

    4.更改完成后执行命令

    yum clean all

    yum makecache

    相关文章

      网友评论

          本文标题:本地yum源http挂载

          本文链接:https://www.haomeiwen.com/subject/lwjedktx.html