暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

搭建本地yum仓库

潍鲸 2020-08-14
210
YUM(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。

在yum服务器上创建yum仓库命令

    mkdir -p /nginx/html/yum
    cd /nginx/html/yum

    安装createrepo软件

      yum install createrepo -y


      初始化repodata索引文件

        createrepo -pdo /nginx/html/yum/  /nginx/html/yum/


        提供yum服务

          # 可以用Apache或nginx提供web服务,但用Python的http模块更简单,适用于内网环境。
          cd /application/nginx/html/yum/
          python -m SimpleHTTPServer 80 &>/dev/null &

          本地yum缓存

            vim etc/yum.conf


            [main]
            cachedir=/var/cache/yum/$basearch/$releasever
            keepcache=1
            debuglevel=2
            logfile=/var/log/yum.log
            exactarch=1
            obsoletes=1
            gpgcheck=1
            plugins=1
            installonly_limit=5


            # keepcache=1,开启本地缓存。省略若干行代码


            添加新的rpm包

              # 只下载软件不安装
              yumdownloader pcre-devel openssl-devel
              createrepo --update nginx/html/yum/


              # 每加入一个rpm包就要更新一下。

              客户端配置

                yum -y install yum-plugin-priorities.noarch


                cd /etc/yum.repos.d
                [root@test yum.repos.d]# cat weijing.repo
                [weijing]
                name=Server
                baseurl=http://192.168.1.10/yum/
                enable=1
                gpgcheck=0
                priority=1


                yum --enablerepo=weijing --disablerepo=base,extras,updates,epel list
                # 指定使用weijing库
                # 添加yum源的时候只需要添加一个新的repo文件即可。

                yum安装本地软件包

                  # 清除yum缓存
                  yum clean all
                  yum repolist
                  # yum仓库搭建完成!
                  文章转载自潍鲸,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

                  评论