ubuntu下载离线软件包及依赖

目录

一、前言

二、正文

1.准备环境

2.开始下载

3.后续工作

三、总结


一、前言

由于给客户提供的设备机不允许上网,那么所有待安装的软件包及依赖库都需要提前下载好,然后通过局域网传过去再安装。

另外,软件包可能还依赖其他的库,库还依赖其他的库...,所以需要一步步耐心的查找并下载。

二、正文

我这边需要安装的软件是用QT编写的一个代理程序,它所依赖Boost库和UUID库,以及JSON等库。

由于当前Ubuntu系统中已经自带了UUID和JSON库,所以下面用Boost库进行演示。

1.准备环境

  • 查看一下下载源是否设置好了
  • 在系统合适的路径下新建一个文件夹,用于下载软件包

2.开始下载

先切换到root用户,方便后面输入命令,否则总得输入sudo

然后进入到新建的文件夹中,执行apt download <库名> 下载

ok,第一个库文件已经下载好了,然后我们再通过apt-cache depends <库名>查询一下它所依赖的库

它依赖libboost1.71-dev和libboost-atomic1.71.0,冲突先不管,如果有建议的库也记录下来。

那下面我就继续下载那两个依赖的库

剩下工作就是重复执行"查询依赖"和"下载库文件"的工作了,就不在此复述。

我将所有依赖关系列表在下面列出,供大家参考:

cpp 复制代码
libboost-all-dev
  Depends: libboost-dev
	  Depends: libboost1.71-dev
	  Suggests: libboost-doc
  #Depends: libboost-tools-dev:armhf
	Depends: libboost1.71-tools-dev:armhf
  Depends: libboost-atomic-dev
	Depends: libboost-atomic1.71-dev
		Depends: libboost1.71-dev
		Depends: libboost-atomic1.71.0
  Depends: libboost-chrono-dev
	Depends: libboost-chrono1.71-dev
		Depends: libboost1.71-dev
		  Depends: libboost-chrono1.71.0
			Depends: libc6
			Depends: libgcc-s1
				Depends: gcc-10-base
				  Depends: libc6
			Depends: libstdc++6
  Depends: libboost-container-dev
	Depends: libboost-container1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-container1.71.0
			Depends: libc6
			  Depends: libgcc-s1
			  Depends: libstdc++6
  Depends: libboost-context-dev
	Depends: libboost-context1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-thread1.71-dev
			Depends: libboost1.71-dev
			Depends: libboost-atomic1.71-dev
			Depends: libboost-chrono1.71-dev
			Depends: libboost-date-time1.71-dev
			Depends: libboost-system1.71-dev
			Depends: libboost-thread1.71.0
		  Depends: libboost-context1.71.0
  Depends: libboost-coroutine-dev
	Depends: libboost-coroutine1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-context1.71-dev
		  Depends: libboost-coroutine1.71.0
			  Depends: libboost-context1.71.0
			  Depends: libboost-thread1.71.0
			  Depends: libc6
			  Depends: libgcc-s1
			  Depends: libstdc++6
  Depends: libboost-date-time-dev
	Depends: libboost-date-time1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-date-time1.71.0
		  Depends: libboost-serialization1.71-dev
			Depends: libboost1.71-dev
			Depends: libboost-serialization1.71.0
  Depends: libboost-exception-dev
	  Depends: libboost-exception1.71-dev
  Depends: libboost-fiber-dev
	Depends: libboost-fiber1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-context1.71-dev
		  Depends: libboost-filesystem1.71-dev
			  Depends: libboost1.71-dev
			  Depends: libboost-filesystem1.71.0
			  Depends: libboost-system1.71-dev
		  Depends: libboost-fiber1.71.0
  Depends: libboost-filesystem-dev
	Depends: libboost-filesystem1.71-dev
  Depends: libboost-graph-dev
	Depends: libboost-graph1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-graph1.71.0
			  Depends:libboost-regex1.71.0
			  Depends: libc6
			  Depends: libgcc-s1
			  Depends: libstdc++6
			  Suggests: graphviz
		  Depends: libboost-regex1.71-dev
		  Depends: libboost-serialization1.71-dev
		  Depends: libboost-test1.71-dev
  Depends: libboost-graph-parallel-dev
	Depends: libboost-graph-parallel1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-graph-parallel1.71.0
		  Depends: libboost-serialization1.71-dev
		  Depends: libboost-test1.71-dev
  Depends: libboost-iostreams-dev
	Depends: libboost-iostreams1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-regex1.71-dev
		  Depends: libboost-iostreams1.71.0
  Depends: libboost-locale-dev
	Depends: libboost-locale1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-thread1.71-dev
		  Depends: libboost-locale1.71.0
  Depends: libboost-log-dev
	Depends: libboost-log1.71-dev
		  Depends: libboost-log1.71.0
		  Depends: libboost1.71-dev
		  Depends: libboost-atomic1.71-dev
		  Depends: libboost-date-time1.71-dev
		  Depends: libboost-filesystem1.71-dev
		  Depends: libboost-system1.71-dev
		  Depends: libboost-regex1.71-dev
		  Depends: libboost-thread1.71-dev
  Depends: libboost-math-dev
	Depends: libboost-math1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-math1.71.0
  Depends: libboost-mpi-dev
	Depends: libboost-mpi1.71-dev
		Depends: libboost1.71-dev
		  Depends: libboost-serialization1.71-dev
		  Depends: libboost-mpi1.71.0
		  Depends: mpi-default-dev
		  Suggests: libboost-graph1.71-dev
  Depends: libboost-mpi-python-dev
	Depends: libboost-mpi-python1.71-dev
		  Depends: libboost-mpi1.71-dev
		  Depends: libboost-mpi-python1.71.0
			  Depends: libboost-mpi1.71.0
			  Depends: libboost-python1.71.0
			  Depends: libboost-python1.71.0
			  Depends: libboost-serialization1.71.0
			  Depends: libc6
			  Depends: libgcc-s1
			  Depends: libopenmpi3
			  Depends: libstdc++6
			  Depends: python3
			  Depends: python3
			  Depends: mpi-default-bin
  Depends: libboost-numpy-dev
	Depends: libboost-numpy1.71-dev
		Depends: libboost-numpy1.71.0
			  Depends: libboost-python1.71.0
			  Depends: libboost-python1.71.0
			  Depends: libc6
			  Depends: libgcc-s1
			  Depends: libstdc++6
			  Suggests: python3
		  Suggests: libboost1.71-doc
  Depends: libboost-program-options-dev
	Depends: libboost-program-options1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-program-options1.71.0
  Depends: libboost-python-dev
	Depends: libboost-python1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-python1.71.0
		  Depends: python3-dev
		  Suggests: libboost1.71-doc
		  Suggests: <gccxml>
  Depends: libboost-random-dev
	Depends: libboost-random1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-system1.71-dev
		  Depends: libboost-random1.71.0
  Depends: libboost-regex-dev
	Depends: libboost-regex1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-regex1.71.0
		  Depends: libicu-dev
  Depends: libboost-serialization-dev
	Depends: libboost-serialization1.71-dev
  Depends: libboost-stacktrace-dev
	Depends: libboost-stacktrace1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-stacktrace1.71.0
  Depends: libboost-system-dev
	Depends: libboost-system1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-system1.71.0
  Depends: libboost-test-dev
	Depends: libboost-test1.71-dev
		Depends: libboost1.71-dev
		  Depends: libboost-test1.71.0
  Depends: libboost-thread-dev
	Depends: libboost-thread1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-atomic1.71-dev
		  Depends: libboost-chrono1.71-dev
		  Depends: libboost-date-time1.71-dev
		  Depends: libboost-system1.71-dev
		  Depends: libboost-thread1.71.0
  Depends: libboost-timer-dev
	Depends: libboost-timer1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-chrono1.71-dev
		  Depends: libboost-timer1.71.0
  Depends: libboost-type-erasure-dev
	Depends: libboost-type-erasure1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-system1.71-dev
		  Depends: libboost-thread1.71-dev
		  Depends: libboost-type-erasure1.71.0
  Depends: libboost-wave-dev
	Depends: libboost-wave1.71-dev
		  Depends: libboost1.71-dev
		  Depends: libboost-serialization1.71-dev
		  Depends: libboost-wave1.71.0
		  Depends: libboost-filesystem1.71-dev

3.后续工作

当我们下载完所有需要的库文件和依赖库之后,我们可以把前面新建的文件夹进行压缩

然后我们将压缩包拷贝出来,或者通过局域网传递给新设备机上,然后先解压

进入到解压后的目录下,你可以看到之前下载好的库软件包。

下面执行sudo dpkg -i *.deb 命令即可安装此目录下所有的软件包。

注意:如果你之前下载完全的话,应该能正确安装;如果有错误提示,那么请根据提示返回原电脑(可以联网)继续下载软件包。

三、总结

查找依赖和下载软件包的过程是比较考验耐心的,可能由于我是个初学者只能用这个"笨方法"。但为了工作需要,由不得不使用。

当我把工作完成后才发现,确实window系统比较方便,哈哈哈~

来日方长,继续努力吧!

相关推荐
希雅不是希望15 分钟前
Ubuntu命令行网络配置
网络·ubuntu·php
kaixin_learn_qt_ing33 分钟前
Debian和Ubuntu
运维·ubuntu·debian
带电的小王36 分钟前
Docker在Ubuntu上安装
ubuntu·docker
CSND7403 小时前
Ubuntu vi(vim)编辑器配置一键补全main函数
linux·c语言·ubuntu·编辑器·vim
Joyner201815 小时前
ubuntu批量依赖库拷贝(ldd)
linux·运维·ubuntu
Jason_C_15 小时前
【NVIDIA】启动ubuntu后显卡驱动丢失
linux·运维·ubuntu
阑梦清川15 小时前
基于ubuntu的mysql 8.0安装教程
linux·mysql·ubuntu
Snow_Dragon_L15 小时前
【MySQL】表操作
linux·数据库·后端·sql·mysql·ubuntu
wkd_00716 小时前
【C++读写.xlsx文件】OpenXLSX开源库在 Ubuntu 18.04 的编译、交叉编译与使用教程
linux·ubuntu·openxlsx·c++写xlsx·开源库编译
zhy2956316 小时前
【LIBS】开源库编译之OSQP
ubuntu·cmake·osqp·libs