背景
离线环境中节点安装的操作系统为Ubuntu-22.04
,该离线环境无法直通公网,但是在本地可以通过ssh连接节点。 因此可以通过 scp 复制 deb 包到离线节点的方式来安装应用。
执行步骤
- 下载安装包
sudo apt-get download percona-xtrabackup-80
- 安装包
ubuntu@ubuntu:~$ sudo dpkg -i percona-xtrabackup-80_8.0.32-26-1.jammy_amd64.deb
Selecting previously unselected package percona-xtrabackup-80.
(Reading database ... 74393 files and directories currently installed.)
Preparing to unpack percona-xtrabackup-80_8.0.32-26-1.jammy_amd64.deb ...
Unpacking percona-xtrabackup-80 (8.0.32-26-1.jammy) ...
dpkg: dependency problems prevent configuration of percona-xtrabackup-80:
percona-xtrabackup-80 depends on libdbd-mysql-perl; however:
Package libdbd-mysql-perl is not installed.
percona-xtrabackup-80 depends on libcurl4-openssl-dev; however:
Package libcurl4-openssl-dev is not installed.
percona-xtrabackup-80 depends on libev4 (>= 1:4.04); however:
Package libev4 is not installed.
dpkg: error processing package percona-xtrabackup-80 (--install):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
percona-xtrabackup-80
- 若无报错则安装完成
- 若提示依赖错误,则按照提示继续下载依赖包。如上面的运行结果中缺失
libdbd-mysql-perl
,libcurl4-openssl-dev
,libev4
三个依赖包。
sudo apt-get download libdbd-mysql-perl
sudo apt-get download libcurl4-openssl-dev
sudo apt-get download libev4
# 使用sudo dpgk -i xxxxx命令安装下载的依赖包
- 若存在递归的依赖,则继续下载依赖包即可。
- 把所有的deb包通过scp传到离线环境中,并直接使用
dpkg
命令安装即可。
PS
- 可以使用以下命令来查看
xxxx
依赖的deb包
sudo apt-cache depends xxxx
如果只想显示必须的软件包,可以使用:
sudo apt-cache depends sshpass | grep Depends | cut -d ":" -f 2-