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

来日方长,继续努力吧!

相关推荐
写点什么啦8 小时前
[debug]不同的window连接ubuntu的vscode后无法正常加载kernel
linux·vscode·ubuntu·debug
wellnw9 小时前
[ubuntu]编译共享内存读取出现read.c:(.text+0x1a): undefined reference to `shm_open‘问题解决方案
linux·ubuntu
oushaojun213 小时前
ubuntu中使用ffmpeg和nginx推流rtmp视频
nginx·ubuntu·ffmpeg·rtmp
命里有定数16 小时前
Ubuntu问题 -- 通过远程修改文件配置ubuntu服务器的静态IP (不需要到服务器现场) (通过NetworkManager)
运维·服务器·tcp/ip·ubuntu·网卡
命里有定数20 小时前
Ubuntu问题 - 显示ubuntu服务器上可用磁盘空间 一条命令df -h
服务器·ubuntu·数据集
命里有定数1 天前
Ubuntu问题 -- 设置ubuntu的IP为静态IP (图形化界面设置) 小白友好
linux·tcp/ip·ubuntu·ip
基极向上的三极管1 天前
【Linux学习】【Ubuntu入门】1-8 ubuntu下压缩与解压缩
linux·ubuntu
云计算运维丁丁1 天前
Linux四剑客及正则表达式
linux·运维·服务器·ubuntu
sun0077001 天前
Ubuntu networkmanager
linux·运维·ubuntu
xx小寂1 天前
ubuntu16.04在ros使用USB摄像头-解决could not open /dev/video0问题
ubuntu·机器人