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系统比较方便,哈哈哈~

来日方长,继续努力吧!

相关推荐
wowocpp7 小时前
ubuntu 22.04 server 安装 anaconda3
linux·运维·ubuntu
wowocpp9 小时前
ubuntu 22.04 防火墙 ufw
linux·运维·ubuntu
188_djh17 小时前
# Python基础到实战一飞冲天(一)--linux基础(一)
linux·开发语言·python·ubuntu·centos·os·operationsystem
winds~17 小时前
ubuntu中安装matplotcpp绘图
linux·运维·ubuntu
UsamaBinLaden18 小时前
Ubuntu和Debian系列的Release默认shell解释器变更
linux·ubuntu·debian
黑风风1 天前
Ubuntu 22 安装 Apache Doris 3.0.3 笔记
笔记·ubuntu·apache
knighthood20012 天前
ros中仿真编写launch时robot_state_publisher,output参数
c++·ubuntu·ros
Jackilina_Stone2 天前
【Linux】网络相关的命令
网络·ubuntu·ip
188_djh2 天前
# vim那些事...... vim删除文件全部内容
linux·ubuntu·centos·编辑器·vim·vi·vim删除文件全部内容
Code-world-12 天前
6-解决Ubuntu系统与Windows系统双系统时间不同步问题
windows·ubuntu·系统时间同步