下载整个Yum源的所有安装包到本地指定目录

简介: 下载整个Yum源的所有安装包到本地指定目录

前言:


 由于公司业务大部分都在内网环境下运行,内网环境无法直接使用yum安装升级更新软件,所以需要自建Yum源来满足目前日常工作需要。


下载整个Yum源中所有安装包至本地指定目录


1.准备要下载到本地的Yum源(阿里源、清华源)

9.png

2.查看Yum源情况

[root@centos ~]# yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
仓库标识                                     仓库名称                                                           状态
extras                                       Qcloud centos extras - x86_64                                         47
os                                           Qcloud centos os - x86_64                                          6,713
updates                                      Qcloud centos updates - x86_64                                     1,169
repolist: 7,929

 可以看到我们准备好的Yum源中有三个仓库,总共有7929个安装包。


3.下载整个Yum源中所有安装包到本地服务器上


reposync:该命令很强大,可以将远端Yum仓库里面的所有安装包全部下载到本地目录中。该命令是来自于 yum-utils 软件包里面的。


 常用参数说明:


 -r :指定已经本地已经配置的 yum 仓库的 repo源的名称


 -p :指定下载的路径

[root@centos ~]# yum -y install yum-utils     #执行安装软件包
[root@centos ~]# mkdir centos6    #创建本地Yum包存放目录
[root@centos ~]# yum repolist    #查看Yum源的仓库标识名称
Loading mirror speeds from cached hostfile
仓库标识                                     仓库名称                                                           状态
extras                                       Qcloud centos extras - x86_64                                         47
os                                           Qcloud centos os - x86_64                                          6,713
updates                                      Qcloud centos updates - x86_64                                     1,169
repolist: 7,929
[root@centos ~]# reposync -r extras -p /root/centos6/    #根据每个据仓库标识下载安装包到本地目录
[extras: 1     of 47    ] Downloading Packages/bakefile-0.2.8-3.el6.centos.x86_64.rpm
bakefile-0.2.8-3.el6.centos.x86_64.rpm                                                        | 250 kB     00:00
[extras: 2     of 47    ] Downloading Packages/centos-release-azure-1.0-2.el6.centos.noarch.rpm
centos-release-azure-1.0-2.el6.centos.noarch.rpm                                              | 4.0 kB     00:00
[extras: 3     of 47    ] Downloading Packages/centos-release-cr-6-0.el6.centos.x86_64.rpm
centos-release-cr-6-0.el6.centos.x86_64.rpm 
...
...
[root@centos ~]# reposync -r os -p /root/centos6/
[os: 1     of 6713  ] Downloading Packages/389-ds-base-1.2.11.15-95.el6_9.x86_64.rpm
389-ds-base-1.2.11.15-95.el6_9.x86_64.rpm                                                     | 1.5 MB     00:00
[os: 2     of 6713  ] Downloading Packages/389-ds-base-devel-1.2.11.15-95.el6_9.i686.rpm
389-ds-base-devel-1.2.11.15-95.el6_9.i686.rpm                                                 | 149 kB     00:00
[os: 3     of 6713  ] Downloading Packages/389-ds-base-devel-1.2.11.15-95.el6_9.x86_64.rpm
389-ds-base-devel-1.2.11.15-95.el6_9.x86_64.rpm
...
...
[root@centos ~]# reposync -r updates -p /root/centos6/


10.png

4,查看下载到本地的整个Yum源的安装包

[root@centos ~]# ll centos6/
drwxr-xr-x 3 root root 4096 10月 31 14:28 extras
drwxr-xr-x 3 root root 4096 10月 31 14:28 os
drwxr-xr-x 3 root root 4096 10月 31 13:14 updates
[root@centos ~]# ll centos6/extras/
drwxr-xr-x 2 root root 4096 10月 31 14:28 Packages
[root@centos ~]# ll centos6/extras/Packages/
-rw-r--r-- 1 root root  256356 10月 31 14:28 bakefile-0.2.8-3.el6.centos.x86_64.rpm
-rw-r--r-- 1 root root    4096 10月 31 14:28 centos-release-azure-1.0-2.el6.centos.noarch.rpm
-rw-r--r-- 1 root root    3996 10月 31 14:28 centos-release-cr-6-0.el6.centos.x86_64.rpm
-rw-r--r-- 1 root root    4316 10月 31 14:28 centos-release-gluster312-1.0-1.el6.centos.noarch.rpm
-rw-r--r-- 1 root root    5116 10月 31 14:28 centos-release-gluster41-1.0-1.el6.centos.x86_64.rpm
-rw-r--r-- 1 root root    4316 10月 31 14:28 centos-release-gluster5-1.0-1.el6.centos.noarch.rpm
-rw-r--r-- 1 root root    4268 10月 31 14:28 centos-release-gluster6-1.0-1.el6.centos.noarch.rpm
-rw-r--r-- 1 root root    4160 10月 31 14:28 centos-release-gluster7-1.0-1.el6.centos.noarch.rpm
-rw-r--r-- 1 root root    4728 10月 31 14:28 centos-release-gluster-legacy-3.10-1.el6.centos.noarch.rpm
...
...

11.png

[root@centos ~]# ll centos6/extras/Packages/ | wc -l
48
[root@centos ~]# ll centos6/os/Packages/ | wc -l
6714
[root@centos ~]# ll centos6/updates/Packages/ | wc -l
1170

 可以看到本地centos6目录中有三个文件夹,这三个文件夹表示我们下载的Yum源中的三个仓库,每个仓库都有不同的安装包,有了整个Yum源的所有安装包,接下来我们就可以利用它们来搭建属于自己的Yum源了。


相关文章
|
关系型数据库 MySQL Linux
Centos7 yum如何下载离线安装包?(详解)
相信大家也遇到过这种问题,在没有外网的情况下,想安装一个服务却安装不了,这期我就教大家如何如何下载离线安装包,在内网中使用;
1603 0
Centos7 yum如何下载离线安装包?(详解)
|
5月前
|
Linux Apache
Linux【环境部署 02】yum源镜像下载+挂载镜像+本地yum源配置+局域网yum源服务搭建+局域网yum源使用(一篇学会离线yum源配置)
Linux【环境部署 02】yum源镜像下载+挂载镜像+本地yum源配置+局域网yum源服务搭建+局域网yum源使用(一篇学会离线yum源配置)
1433 0
|
3月前
|
SQL Python
你需要在你的系统上安装`sqlmap`。这通常可以通过下载其源代码并编译,或者使用包管理器(如`apt`、`yum`或`pip`,但请注意,`pip`通常不直接提供`sqlmap`)来完成。
你需要在你的系统上安装`sqlmap`。这通常可以通过下载其源代码并编译,或者使用包管理器(如`apt`、`yum`或`pip`,但请注意,`pip`通常不直接提供`sqlmap`)来完成。
|
3月前
|
应用服务中间件 nginx
Ngnix07---通过yum安装Ngnix下 whereis ngnix可以查看Ngnix相关的一些目录,使用./nginx -y可以查看Ngnix版本及相关配置信息,使用 more CHANGES
Ngnix07---通过yum安装Ngnix下 whereis ngnix可以查看Ngnix相关的一些目录,使用./nginx -y可以查看Ngnix版本及相关配置信息,使用 more CHANGES
|
3月前
|
Ubuntu Linux
Linux软件安装-Linux系统靠yum命令安装软件,yum命令是一个RPM包软件管理器,用于自动化安装配置Linux软件,.rpm是Linux包下的软件,yum install下载 wget re
Linux软件安装-Linux系统靠yum命令安装软件,yum命令是一个RPM包软件管理器,用于自动化安装配置Linux软件,.rpm是Linux包下的软件,yum install下载 wget re
|
5月前
|
缓存 Linux 应用服务中间件
linux yum下载离线包缓存 安装到服务器 实测!!!
linux yum下载离线包缓存 安装到服务器 实测!!!
73 0
|
Linux
Centos7下载网络yum源及epel源
Centos7下载网络yum源及epel源
696 0
|
运维 Linux
【运维杂谈】如何用yum只下载,不安装?
【运维杂谈】如何用yum只下载,不安装?
265 0
|
Shell Python
-bash: /usr/bin/yum: /usr/bin/python: 坏的解释器: 没有那个文件或目录
-bash: /usr/bin/yum: /usr/bin/python: 坏的解释器: 没有那个文件或目录
-bash: /usr/bin/yum: /usr/bin/python: 坏的解释器: 没有那个文件或目录
|
Shell Python
yum报错:bash: /usr/bin/yum: /usr/bin/python: 坏的解释器:没有那个文件或目录
yum报错:bash: /usr/bin/yum: /usr/bin/python: 坏的解释器:没有那个文件或目录
2047 0
yum报错:bash: /usr/bin/yum: /usr/bin/python: 坏的解释器:没有那个文件或目录