首页 > 系统相关 >centos7.9制作rpm离线源

centos7.9制作rpm离线源

时间:2023-06-15 12:56:30浏览次数:55  
标签:Downloading x86 离线 noarch centos7.9 64 rpm el7

@

目录
在centos7.9的环境联网环境下,制作一个软件包的离线源,使用yumdownloader命令制作一些特殊软件包需要逐个拉去依赖,而使用repotrack则一键拉取,并下载所需依赖,以下进行测试

制作vsftpd离线源

下载制作工具

[root@localhost ~]# yum install createrepo -y
[root@localhost ~]# yum install yum-utils -y

创建测试目录

[root@localhost ~]# mkdir vsftpd
[root@localhost ~]# cd vsftpd/
[root@localhost vsftpd]#

下载vsftpd rpm包

[root@localhost vsftpd]# yumdownloader --resolve vsftpd

创建离线源元数据

[root@localhost vsftpd]# createrepo .
[root@localhost vsftpd]# ls
repodata  vsftpd-3.0.2-29.el7_9.x86_64.rpm

测试

[root@localhost vsftpd]# mv /etc/yum.repos.d/* /home/
[root@localhost vsftpd]# cat /etc/yum.repos.d/test.repo
[ftp]
name=ftp
baseurl=file:///root/vsftpd
ggpcheck=0
enabled=1
[root@localhost vsftpd]# yum clean all;yum repolist
Loaded plugins: fastestmirror
Cleaning repos: ftp
Cleaning up list of fastest mirrors
Other repos take up 176 M of disk space (use --verbose for details)
Loaded plugins: fastestmirror
Determining fastest mirrors
ftp                                                                                              | 2.9 kB  00:00:00
ftp/primary_db                                                                                   | 2.4 kB  00:00:00
repo id                                                    repo name                                              status
ftp                                                        ftp                                                    1
repolist: 1
[root@localhost vsftpd]# yum install -y vsftpd

特殊情况

需要提供安装公钥,数字前面

Downloading packages:
warning: /var/cache/yum/x86_64/7/ftp/packages/ceph-deploy-2.0.1-0.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 460f3994: NOKEY
Public key for ceph-deploy-2.0.1-0.noarch.rpm is not installed
ceph-deploy-2.0.1-0.noarch.rpm                                                                   | 286 kB  00:00:00


Public key for ceph-deploy-2.0.1-0.noarch.rpm is not installed

需要修改打开 /etc/yum.conf 文件,找到 gpgcheck 选项,并将其设置为 0。这将禁用所有仓库的GPG检查。

[root@localhost ~]# sed -i 's/gpgcheck=1/gpgcheck=0/'g /etc/yum.conf

当制作需要依赖的离线源时

[root@localhost ~]# yum install python2-pip.noarch -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package python2-pip.noarch 0:8.1.2-14.el7 will be installed
--> Processing Dependency: python-setuptools for package: python2-pip-8.1.2-14.el7.noarch
--> Finished Dependency Resolution
Error: Package: python2-pip-8.1.2-14.el7.noarch (ftp)
           Requires: python-setuptools
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

则需要把差的依赖拉取到离线源文件中,此处我使用一台机器制作离线源,开启vsftp给另一台机器做测试

[root@storage01 repo-test]# yumdownloader --resolve python-setuptools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
--> Running transaction check
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be reinstalled
--> Finished Dependency Resolution
python-setuptools-0.9.8-7.el7.noarch.rpm                                                         | 397 kB  00:00:00
[root@storage01 repo-test]# ls
ceph-14.2.22-0.el7.x86_64.rpm         ceph-radosgw-14.2.22-0.el7.x86_64.rpm     repodata
ceph-common-14.2.22-0.el7.x86_64.rpm  python2-pip-8.1.2-14.el7.noarch.rpm
ceph-deploy-2.0.1-0.noarch.rpm        python-setuptools-0.9.8-7.el7.noarch.rpm
[root@storage01 repo-test]# createrepo .
Spawning worker 0 with 2 pkgs
Spawning worker 1 with 2 pkgs
Spawning worker 2 with 1 pkgs
Spawning worker 3 with 1 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
#每次打入新的离线源都需要重新生成repodata元数据
[root@localhost ~]# cat /etc/yum.repos.d/test.repo
[ftp]
name=ftp
baseurl=ftp://192.168.200.30/repo-test
ggpcheck=0
enabled=1

需要将下载所需的所有依赖打入即可安装

Dependency Installed:
  python-backports.x86_64 0:1.0-8.el7              python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7
  python-ipaddress.noarch 0:1.0.16-2.el7           python-setuptools.noarch 0:0.9.8-7.el7

Complete!
[root@localhost ~]# yum install python2-pip.noarch -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package python2-pip-8.1.2-14.el7.noarch already installed and latest version
Nothing to do
[root@localhost ~]#
[root@storage01 repo-test]# ls
ceph-14.2.22-0.el7.x86_64.rpm          python-backports-1.0-8.el7.x86_64.rpm
ceph-common-14.2.22-0.el7.x86_64.rpm   python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
ceph-deploy-2.0.1-0.noarch.rpm         python-ipaddress-1.0.16-2.el7.noarch.rpm
ceph-radosgw-14.2.22-0.el7.x86_64.rpm  python-setuptools-0.9.8-7.el7.noarch.rpm
python2-pip-8.1.2-14.el7.noarch.rpm    repodata

repotrack命令

该命令会把下载的rpm包以及所涉及的所有依赖进行拉取,可能会下载多一些

[root@storage01 repo-test]# cd ..
[root@storage01 opt]# mkdir repo-test2
[root@storage01 opt]# cd repo-test2
[root@storage01 repo-test2]# repotrack python2-pip.noarch
Downloading basesystem-10.0-7.el7.centos.noarch.rpm
Downloading bash-4.2.46-34.el7.x86_64.rpm
Downloading bzip2-libs-1.0.6-13.el7.x86_64.rpm
Downloading ca-certificates-2020.2.41-70.0.el7_8.noarch.rpm
Downloading centos-release-7-9.2009.0.el7.centos.x86_64.rpm
Downloading chkconfig-1.7.6-1.el7.x86_64.rpm
Downloading coreutils-8.22-24.el7.x86_64.rpm
Downloading expat-2.1.0-12.el7.x86_64.rpm
Downloading filesystem-3.2-25.el7.x86_64.rpm
Downloading gawk-4.0.2-4.el7_3.1.x86_64.rpm
Downloading gdbm-1.10-8.el7.x86_64.rpm
Downloading glibc-2.17-317.el7.x86_64.rpm
Downloading glibc-common-2.17-317.el7.x86_64.rpm
Downloading gmp-6.0.0-15.el7.x86_64.rpm
Downloading grep-2.20-3.el7.x86_64.rpm
Downloading info-5.1-5.el7.x86_64.rpm
Downloading keyutils-libs-1.5.8-3.el7.x86_64.rpm
Downloading krb5-libs-1.15.1-50.el7.x86_64.rpm
Downloading libacl-2.2.51-15.el7.x86_64.rpm
Downloading libattr-2.4.46-13.el7.x86_64.rpm
Downloading libcap-2.22-11.el7.x86_64.rpm
Downloading libcom_err-1.42.9-19.el7.x86_64.rpm
Downloading libdb-5.3.21-25.el7.x86_64.rpm
Downloading libffi-3.0.13-19.el7.x86_64.rpm
Downloading libgcc-4.8.5-44.el7.x86_64.rpm
Downloading libselinux-2.5-15.el7.x86_64.rpm
Downloading libsepol-2.5-10.el7.x86_64.rpm
Downloading libstdc++-4.8.5-44.el7.x86_64.rpm
Downloading libtasn1-4.10-1.el7.x86_64.rpm
Downloading libverto-0.2.5-4.el7.x86_64.rpm
Downloading ncurses-5.9-14.20130511.el7_4.x86_64.rpm
Downloading ncurses-base-5.9-14.20130511.el7_4.noarch.rpm
Downloading ncurses-libs-5.9-14.20130511.el7_4.x86_64.rpm
Downloading nspr-4.21.0-1.el7.x86_64.rpm
Downloading nss-softokn-freebl-3.44.0-8.el7_7.x86_64.rpm
Downloading nss-util-3.44.0-4.el7_7.x86_64.rpm
Downloading openssl-libs-1.0.2k-19.el7.x86_64.rpm
Downloading p11-kit-0.23.5-3.el7.x86_64.rpm
Downloading p11-kit-trust-0.23.5-3.el7.x86_64.rpm
Downloading pcre-8.32-17.el7.x86_64.rpm
Downloading popt-1.13-16.el7.x86_64.rpm
Downloading python-2.7.5-89.el7.x86_64.rpm
Downloading python-backports-1.0-8.el7.x86_64.rpm
Downloading python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
Downloading python-ipaddress-1.0.16-2.el7.noarch.rpm
Downloading python-libs-2.7.5-89.el7.x86_64.rpm
Downloading python-setuptools-0.9.8-7.el7.noarch.rpm
Downloading python2-pip-8.1.2-14.el7.noarch.rpm
Downloading readline-6.2-11.el7.x86_64.rpm
Downloading sed-4.2.2-7.el7.x86_64.rpm
Downloading setup-2.8.71-11.el7.noarch.rpm
Downloading sqlite-3.7.17-8.el7_7.1.x86_64.rpm
Downloading tzdata-2020a-1.el7.noarch.rpm
Downloading zlib-1.2.7-18.el7.x86_64.rpm
[root@storage01 repo-test2]# createrepo .
Spawning worker 0 with 14 pkgs
Spawning worker 1 with 14 pkgs
Spawning worker 2 with 13 pkgs
Spawning worker 3 with 13 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@storage01 repo-test2]# ls
basesystem-10.0-7.el7.centos.noarch.rpm          libtasn1-4.10-1.el7.x86_64.rpm
bash-4.2.46-34.el7.x86_64.rpm                    libverto-0.2.5-4.el7.x86_64.rpm
bzip2-libs-1.0.6-13.el7.x86_64.rpm               ncurses-5.9-14.20130511.el7_4.x86_64.rpm
ca-certificates-2020.2.41-70.0.el7_8.noarch.rpm  ncurses-base-5.9-14.20130511.el7_4.noarch.rpm
centos-release-7-9.2009.0.el7.centos.x86_64.rpm  ncurses-libs-5.9-14.20130511.el7_4.x86_64.rpm
chkconfig-1.7.6-1.el7.x86_64.rpm                 nspr-4.21.0-1.el7.x86_64.rpm
coreutils-8.22-24.el7.x86_64.rpm                 nss-softokn-freebl-3.44.0-8.el7_7.x86_64.rpm
expat-2.1.0-12.el7.x86_64.rpm                    nss-util-3.44.0-4.el7_7.x86_64.rpm
filesystem-3.2-25.el7.x86_64.rpm                 openssl-libs-1.0.2k-19.el7.x86_64.rpm
gawk-4.0.2-4.el7_3.1.x86_64.rpm                  p11-kit-0.23.5-3.el7.x86_64.rpm
gdbm-1.10-8.el7.x86_64.rpm                       p11-kit-trust-0.23.5-3.el7.x86_64.rpm
glibc-2.17-317.el7.x86_64.rpm                    pcre-8.32-17.el7.x86_64.rpm
glibc-common-2.17-317.el7.x86_64.rpm             popt-1.13-16.el7.x86_64.rpm
gmp-6.0.0-15.el7.x86_64.rpm                      python-2.7.5-89.el7.x86_64.rpm
grep-2.20-3.el7.x86_64.rpm                       python2-pip-8.1.2-14.el7.noarch.rpm
info-5.1-5.el7.x86_64.rpm                        python-backports-1.0-8.el7.x86_64.rpm
keyutils-libs-1.5.8-3.el7.x86_64.rpm             python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
krb5-libs-1.15.1-50.el7.x86_64.rpm               python-ipaddress-1.0.16-2.el7.noarch.rpm
libacl-2.2.51-15.el7.x86_64.rpm                  python-libs-2.7.5-89.el7.x86_64.rpm
libattr-2.4.46-13.el7.x86_64.rpm                 python-setuptools-0.9.8-7.el7.noarch.rpm
libcap-2.22-11.el7.x86_64.rpm                    readline-6.2-11.el7.x86_64.rpm
libcom_err-1.42.9-19.el7.x86_64.rpm              repodata
libdb-5.3.21-25.el7.x86_64.rpm                   sed-4.2.2-7.el7.x86_64.rpm
libffi-3.0.13-19.el7.x86_64.rpm                  setup-2.8.71-11.el7.noarch.rpm
libgcc-4.8.5-44.el7.x86_64.rpm                   sqlite-3.7.17-8.el7_7.1.x86_64.rpm
libselinux-2.5-15.el7.x86_64.rpm                 tzdata-2020a-1.el7.noarch.rpm
libsepol-2.5-10.el7.x86_64.rpm                   zlib-1.2.7-18.el7.x86_64.rpm
libstdc++-4.8.5-44.el7.x86_64.rpm

测试

[root@localhost ~]# yum remove python2-pip.noarch -y
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package python2-pip.noarch 0:8.1.2-14.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                        Arch                      Version                         Repository               Size
========================================================================================================================
Removing:
 python2-pip                    noarch                    8.1.2-14.el7                    @ftp                    7.2 M

Transaction Summary
========================================================================================================================
Remove  1 Package

Installed size: 7.2 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : python2-pip-8.1.2-14.el7.noarch                                                                      1/1
  Verifying  : python2-pip-8.1.2-14.el7.noarch                                                                      1/1

Removed:
  python2-pip.noarch 0:8.1.2-14.el7

Complete!
[root@localhost ~]#
[root@localhost ~]# cat /etc/yum.repos.d/test.repo
[ftp]
name=ftp
baseurl=ftp://192.168.200.30/repo-test2
ggpcheck=0
enabled=1
[root@localhost ~]# yum install python2-pip.noarch -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
ftp                                                                                              | 2.9 kB  00:00:00
ftp/primary_db                                                                                   |  42 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package python2-pip.noarch 0:8.1.2-14.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                        Arch                      Version                          Repository              Size
========================================================================================================================
Installing:
 python2-pip                    noarch                    8.1.2-14.el7                     ftp                    1.7 M

Transaction Summary
========================================================================================================================
Install  1 Package

Total download size: 1.7 M
Installed size: 7.2 M
Downloading packages:
python2-pip-8.1.2-14.el7.noarch.rpm                                                              | 1.7 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python2-pip-8.1.2-14.el7.noarch                                                                      1/1
  Verifying  : python2-pip-8.1.2-14.el7.noarch                                                                      1/1

Installed:
  python2-pip.noarch 0:8.1.2-14.el7

Complete!
[root@localhost ~]# yum clean all;yum repolist
Loaded plugins: fastestmirror
Cleaning repos: ftp
Cleaning up list of fastest mirrors
Other repos take up 176 M of disk space (use --verbose for details)
Loaded plugins: fastestmirror
Determining fastest mirrors
ftp                                                                                              | 2.9 kB  00:00:00
ftp/primary_db                                                                                   |  42 kB  00:00:00
repo id                                                    repo name                                              status
ftp                                                        ftp                                                    54
repolist: 54
[root@localhost ~]#

标签:Downloading,x86,离线,noarch,centos7.9,64,rpm,el7
From: https://www.cnblogs.com/hoyeong/p/17482566.html

相关文章

  • k8s第四篇:离线业务
    pod是k8s的最小调度单元,为了保持它的独立性,不应该向它添加多余的功能。k8s为离线业务提供了job和cronjob两种api对象,分别处理临时任务和定时任务。job的关键字段是spec.template,里面定义了用来运行业务的pod模板。cronjob的关键字段是spec.jobTemplate和spec.schedule,分别定义......
  • 新浪微博:大规模离线视频处理系统的架构设计
    微博视频平台在4亿月活用户吃瓜嗨聊的高并发、大流量背景下,既要保证用户微博生产和消费体验,又要支持业务快速迭代,确保正确性、稳定性和高可用性。本次演将以微博视频大规模视频离线处理系统的架构设计为主题为大家带来大规模分布式系统的架构设计,性能优化和高可用保障......
  • 《最新出炉》系列初窥篇-Python+Playwright自动化测试-3-离线搭建playwright环境
    1.简介有些小伙伴或者童鞋们私信留言说自己是在公司局域网办公,或者公司为了安全对网络管控比较严格(尤其是一些大的国企、央企),总之就是一句话无法连到外网去在线下载,宏哥刚看到留言时觉得这问题还留言问啊,你找个有网的电脑下载好安装包然后安装就可以用了。(第一种情况及解决办法:带......
  • centos系统配置离线yum源
    背景在生产环境中,服务器会由于某些无法连接到公网,而我们想在这样的服务器上安装软件时会出现依赖导致安装失败。我们可以通过配置离线的yum源解决类似问题。大概流程为1、在公网环境下载yum源;2、将yum源上传到服务器;3、配置离线yum源。下面详细介绍如何配置yum源。下载yum源文......
  • 推荐两个查找rpm包的网站
    http://rpmfind.net/http://rpm.pbone.net/addbyjoeyon1985......
  • linux系统离线安装oracle 11g
    1.修改hostname(机器名根据自己的要求改)root用户修改hostname命令:hostnamectlset-hostnamenode2 重启下服务器:reboot 2.安装依赖 root用户在一台有网的电脑上先下载好所需的依赖yuminstall--downloadonly--downloaddir=/tmp/compat-libstdc++-33elfutils-lib......
  • 离线使用 ubuntu下的dict
    离线使用ubuntu下的dict首先sudoapt-getinstalldict      //安装客户端sudoapt-getinstalldictd     //安装服务器端安装辞典sudoapt-getinstalldict-wn    //WorldNet英英字典这个我推荐其他辞典英英dict-gcide英汉dict-xdict,dict......
  • linux下安装mysql(rpm文件安装)
    数据库包下载:https://www.mysql.com/downloads/在GPL开原协议的社区开源版里边下载我们用mysqlcommunityserver里边的其中workbench是客户端工具MySQLCluster是oracle自己搞的集群版的(集成了一些开源工具和增值服务)选择操作系统和版本建议在linux下安装也可以选择......
  • CentOS7 本地光盘镜像rpm包
    CentOS7本地光盘镜像rpm包一、前言rpm包的下载方式通过本地光盘镜像下载rpm,centos7.iso镜像文件,内置了绝大多数软件的rpm包(本文章即演示如何配置本地rpm)在线下载rpm包,有很多软件的官网,以及第三方软件仓库,会提供下载功能http://rpm.phone.net/www.rpmfind.net更加精......
  • 视频融合EasyCVR平台接入RTSP流后设备显示离线是什么原因?
    EasyCVR视频融合平台基于云边端智能协同架构,具有强大的数据接入、处理及分发能力,平台支持海量视频汇聚管理、全网分发、按需调阅、鉴权播放、智能分析等视频能力与服务。平台开放度高、兼容性强、可支持灵活拓展与第三方集成,我们也提供了丰富的API接口供有需求的用户进行自由调用......