zl程序教程

您现在的位置是:首页 >  其他

当前栏目

ubuntu20.04安装deb包

安装 deb ubuntu20.04
2023-06-13 09:14:22 时间

ubuntu20.04安装本地deb包

apt-get安装

我们知道,一般ubuntu系统安装软件使用apt-get install -y <package-name>,不过这种安装依赖源,依赖源在文件/etc/apt/sources.list中存放

腾讯tke集群默认的Ubuntu20.04依赖源参考如下:

deb http://mirrors.tencentyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.tencentyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.tencentyun.com/ubuntu/ focal-updates main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ focal-proposed main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.tencentyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.tencentyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.tencentyun.com/ubuntu/ focal-updates main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ focal-proposed main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ focal-backports main restricted universe multiverse

dpkg安装

如果依赖源里没有安装包,需要用google搜索下载deb安装包并安装

ubuntu内置的dpkg工具,可以安装/卸载deb包软件,这里以google-chrome-stable为例

安装命令: dpkg -i <package_version_arch.deb>
卸载命令: dpkg -r <package>

下载google-chrome-stable包

从google上搜索google-chrome-stable的deb包并复制链接,然后使用wget命令下载

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

wget命令下载结果如下

安装google-chrome-stable

下载好deb包后使用dpkg安装

dpkg -i google-chrome-stable_current_amd64.deb

可以看到安装报错,提示多个依赖包没有安装。这是因为dpkg不会自动安装deb包的依赖包,需要提前安装好。如果想用自动安装依赖包,可以使用gdebi工具

先把安装的google-chrome-stable卸载清理掉,注意卸载软件dpkg -r后面需要填写包名,而不是deb文件

dpkg -r google-chrome-stable

gdebi安装

ubuntu默认不会安装gdebi工具,需要使用apt-get安装

apt-get install gdebi -y

安装好之后测试命令是否正常安装

gdebi --version

如下图表示安装成功

使用gdebi安装deb包

gdebi google-chrome-stable_current_amd64.deb

可以看到执行结果,正常安装依赖包

安装好之后使用如下命令查看google-chrome是否安装成功

google-chrome --version

安装成功如下:

卸载的话还是使用dpkg命令即可

dpkg -r google-chrome-stable