首页 > 系统相关 >createrepo 创建本地 yum 源

createrepo 创建本地 yum 源

时间:2024-08-20 14:52:41浏览次数:5  
标签:00 x86 centos createrepo 64 本地 yum local

安装 createrepo

yum install -y yum-utils createrepo

配置华为源信息

[base]
name=CentOS-$releasever - Base - mirrors.huaweicloud.com
baseurl=https://mirrors.huaweicloud.com/centos/$releasever/os/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=https://mirrors.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.huaweicloud.com
baseurl=https://mirrors.huaweicloud.com/centos/$releasever/updates/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=https://mirrors.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.huaweicloud.com
baseurl=https://mirrors.huaweicloud.com/centos/$releasever/extras/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=https://mirrors.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.huaweicloud.com
baseurl=https://mirrors.huaweicloud.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=https://mirrors.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-7

同步源数据到本地

创建数据目录

mkdir -pv /repo/centos/7/os/x86_64

同步源信息

reposync -n --repoid=base --repoid=updates --repoid=extras --repoid=centosplus -p /repo/centos/7/os/x86_64

查看数据目录

# tree -d /repo/centos/7/os/x86_64
/repo/centos/7/os/x86_64
├── base
│   └── Packages
├── centosplus
│   └── Packages
├── extras
│   └── Packages
└── updates
    └── Packages

8 directories

创建 yum 源

base

# createrepo /repo/centos/7/os/x86_64/base
Spawning worker 0 with 5036 pkgs
Spawning worker 1 with 5036 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

updates

# createrepo /repo/centos/7/os/x86_64/updates
Spawning worker 0 with 883 pkgs
Spawning worker 1 with 883 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

extras

# createrepo /repo/centos/7/os/x86_64/extras/
Spawning worker 0 with 139 pkgs
Spawning worker 1 with 139 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

centosplus

# createrepo /repo/centos/7/os/x86_64/centosplus/
Spawning worker 0 with 8 pkgs
Spawning worker 1 with 7 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

nginx 配置

server {
    listen       5000;
    server_name  localhost;

    location / {
        autoindex on;
        root   /repo;
    }
}

访问本地 yum 源

 

本地 yum 源验证

local.repo

[local-base]
name=CentOS-$releasever - Base - mirrors.huaweicloud.com
baseurl=http://192.168.174.107:5000/centos/$releasever/os/$basearch/base/
gpgcheck=0

[local-updates]
name=CentOS-$releasever - Updates - mirrors.huaweicloud.com
baseurl=http://192.168.174.107:5000/centos/$releasever/os/$basearch/updates/
gpgcheck=0

[local-extras]
name=CentOS-$releasever - Extras - mirrors.huaweicloud.com
baseurl=http://192.168.174.107:5000/centos/$releasever/os/$basearch/extras/
gpgcheck=1

[local-centosplus]
name=CentOS-$releasever - Plus - mirrors.huaweicloud.com
baseurl=https://192.168.174.107:5000/centos/$releasever/os/$basearch/centosplus/
gpgcheck=0
enabled=0

构建 yum 缓存 

# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
local-base                                                                                                                                                                                | 2.9 kB  00:00:00     
local-extras                                                                                                                                                                              | 2.9 kB  00:00:00     
local-updates                                                                                                                                                                             | 2.9 kB  00:00:00     
(1/9): local-base/7/x86_64/filelists_db                                                                                                                                                   | 7.2 MB  00:00:00     
(2/9): local-base/7/x86_64/other_db                                                                                                                                                       | 2.6 MB  00:00:00     
(3/9): local-base/7/x86_64/primary_db                                                                                                                                                     | 6.1 MB  00:00:00     
(4/9): local-extras/7/x86_64/filelists_db                                                                                                                                                 | 190 kB  00:00:00     
(5/9): local-extras/7/x86_64/other_db                                                                                                                                                     |  94 kB  00:00:00     
(6/9): local-extras/7/x86_64/primary_db                                                                                                                                                   | 136 kB  00:00:00     
(7/9): local-updates/7/x86_64/primary_db                                                                                                                                                  | 2.1 MB  00:00:00     
(8/9): local-updates/7/x86_64/filelists_db                                                                                                                                                | 2.2 MB  00:00:00     
(9/9): local-updates/7/x86_64/other_db                                                                                                                                                    | 513 kB  00:00:00     
Metadata Cache Created

安装 createrepo

# yum  install createrepo
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package createrepo.noarch 0:0.9.9-28.el7 will be installed
--> Processing Dependency: python-deltarpm for package: createrepo-0.9.9-28.el7.noarch
--> Processing Dependency: deltarpm for package: createrepo-0.9.9-28.el7.noarch
--> Running transaction check
---> Package deltarpm.x86_64 0:3.6-3.el7 will be installed
---> Package python-deltarpm.x86_64 0:3.6-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                               Arch                                         Version                                               Repository                                        Size
=================================================================================================================================================================================================================
Installing:
 createrepo                                            noarch                                       0.9.9-28.el7                                          local-base                                        94 k
Installing for dependencies:
 deltarpm                                              x86_64                                       3.6-3.el7                                             local-base                                        82 k
 python-deltarpm                                       x86_64                                       3.6-3.el7                                             local-base                                        31 k

Transaction Summary
=================================================================================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 207 k
Installed size: 558 k
Is this ok [y/d/N]: y
Downloading packages:
(1/3): createrepo-0.9.9-28.el7.noarch.rpm                                                                                                                                                 |  94 kB  00:00:00     
(2/3): deltarpm-3.6-3.el7.x86_64.rpm                                                                                                                                                      |  82 kB  00:00:00     
(3/3): python-deltarpm-3.6-3.el7.x86_64.rpm                                                                                                                                               |  31 kB  00:00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                            2.6 MB/s | 207 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : deltarpm-3.6-3.el7.x86_64                                                                                                                                                                     1/3 
  Installing : python-deltarpm-3.6-3.el7.x86_64                                                                                                                                                              2/3 
  Installing : createrepo-0.9.9-28.el7.noarch                                                                                                                                                                3/3 
  Verifying  : createrepo-0.9.9-28.el7.noarch                                                                                                                                                                1/3 
  Verifying  : deltarpm-3.6-3.el7.x86_64                                                                                                                                                                     2/3 
  Verifying  : python-deltarpm-3.6-3.el7.x86_64                                                                                                                                                              3/3 

Installed:
  createrepo.noarch 0:0.9.9-28.el7                                                                                                                                                                               

Dependency Installed:
  deltarpm.x86_64 0:3.6-3.el7                                                                         python-deltarpm.x86_64 0:3.6-3.el7                                                                        

Complete!

更新本地 yum 源

更新软件包

reposync -n --repoid=base --repoid=updates --repoid=extras --repoid=centosplus -p /repo/centos/7/os/x86_64

更新 yum 元数据

createrepo --update /repo/centos/7/os/x86_64/base
createrepo --update /repo/centos/7/os/x86_64/updates
createrepo --update /repo/centos/7/os/x86_64/extras/
createrepo --update /repo/centos/7/os/x86_64/centosplus/

标签:00,x86,centos,createrepo,64,本地,yum,local
From: https://www.cnblogs.com/wangguishe/p/18368945

相关文章

  • uni_app中使用uQRcode生成二维码并保存到本地
    #效果#1.首先在插件市场引入uQRcode二维码生成插件,下载并导入到项目uQRCode全端二维码生成插件支持nvue支持nodejs服务端-DCloud插件市场https://ext.dcloud.net.cn/plugin?id=12872.在项目中新建vue文件,代码如下<template> <viewclass="code"> <viewclass="uqr......
  • ollama搭建本地ai大模型并应用调用
    1、下载ollama1)https://ollama.com 进入网址,点击download下载2)下载后直接安装即可。2、启动配置模型默认是启动cmd窗口直接输入1ollamarunllama3启动llama3大模型 或者启动千问大模型1ollamarunqwen2启动输入你需要输入的问题即可 3、配置UI界面安装......
  • 前端项目引用本地资源别再傻傻写相对路径../../../../了
    问题背景:记录一次codereview时同事给我的评论,顺便整理下涉及的知识点。我在项目的src/common/images文件夹中新增了一个图片资源pic_recommend.png,在多个文件中都引用了这个图片资源。我使用了相对路径的写法,看起来代码很冗余,且多层…/写着麻烦,不易维护。其实我......
  • 开源最强Llama3.1 部署本地知识库应用
    一.环境介绍高性能应用服务HAI拥有丰富的预装应用,可以将开源社区的前沿模型快速转化为您专有的部署实践,一键拉起,即开即用。现已支持在HAI购买页的社区应用中,找到Llama3.1等应用的入口,简单选型后,即可一键启动推理服务。Chatchat项目介绍该项目利用langchain思想,实现......
  • Win7/Win10/Win11开启本地内核调试的方法
    具体内容微软官方文档上都有:https://learn.microsoft.com/zh-cn/windows-hardware/drivers/debugger/performing-local-kernel-debugginghttps://learn.microsoft.com/zh-cn/windows-hardware/drivers/debugger/setting-up-local-kernel-debugging-of-a-single-computer-manually......
  • 7.ACS5.2 R1设备登录管理(本地)
    r1设备登陆管理(acs本地数据库)配置步骤r1上配置设备登陆管理(acs本地数据库):步骤一:基本登陆认证(用户:acsuser1属于组:acsgroup1)步骤二:exec级别授权(acsgroup1授权5级)步骤三:privilege本地命令授权(授权5级用户动态路由协议相关配置)步骤四:tacacs+命令授权(授权acsg......
  • yum源仓库更换脚本
    一、需求:一键式脚本更换国内的阿里源二、脚本#!/bin/bash#数据迁移备份yum_bak='mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup'#查看当前仓库yum_repo="yumrepolist|grep'*'|awk-F"[:.]"'NR==1{print$3}'......
  • pycharmt安装PyUML
    在PyCharm中安装PyUML可以通过Python的包管理工具pip来完成。以下是安装PyUML的步骤:打开PyCharm。选择File>Settings(或者使用快捷键Ctrl+Alt+S)打开Settings对话框。在Settings中选择Project:YourProjectName>ProjectInterpreter。点击右侧的加号按钮,......
  • 解决麒麟 V10 SP1 升级 Python 后 Yum 不可用问题
    目录一、前提概要二、解决办法1、卸载原有的python2、安装Python3.7.9rpm3、安装一系列 yum相关rpm4、rpm包下载一、前提概要    在部署gaussDB的时候,安装代理时要求python版本满足3.7.9,但已安装的麒麟V10内集成的python版本是3.7.4,且安......
  • 【本地+在线】Comfyui的基本工作流的搭建----文生图+图生图
    一.(本地使用comfyui)基本模块的了解1.1这是初始界面1.2搭建一个基本的工作流(如果使用的是秋叶大佬的包,每次进入会自动出现该工作流)1.2.1加载器和取样器:加载器,鼠标右键,点击新建节点,按下图操作,出现加载器取样器,鼠标右键,然后按下图操作可以看到如图结果:我们将“模型“连接......