我想要一个 shell 脚本方法来测试/报告是否安装了软件包。我不需要细节,只需要布尔返回来设置逻辑流程。我查看了Find if a package is installed,但dpkg返回复杂的输出,其格式会根据软件包是在 Debian 存储库中还是在 Ubuntu PPA 中而发生变化。
我发现这apt-cache做得很好,我想出了这个方法:
is_installed=0
test_installed=( `apt-cache policy package-name | grep "Installed:" ` )
[ ! "${test_installed[1]}" == "(none)" ] && is_installed=1
Run Code Online (Sandbox Code Playgroud)
有谁知道更简单或更直接的方法?
我最近发现我们可以使用更近的apt install, remove... 在祖先apt-get install. 我以前不知道。因为我有一些脚本可以安装跨各种操作系统的软件包,我想知道什么时候apt install可以在 Debian 和 Ubuntu 中使用?
当我这样做时会发生这种情况apt-get update:
Get:1 http://security.debian.org stretch/updates InRelease [68.2 kB]
Ign:1 http://security.debian.org stretch/updates InRelease
Get:2 http://ftp.bme.hu/debian stretch InRelease [175 kB]
Get:3 http://ftp.cz.debian.org/debian stretch-updates InRelease [88.5 kB]
Ign:2 http://ftp.bme.hu/debian stretch InRelease
Ign:3 http://ftp.cz.debian.org/debian stretch-updates InRelease
Fetched 332 kB in 1s (175 kB/s)
Reading package lists... Done
W: GPG error: http://security.debian.org stretch/updates InRelease: At least one invalid signature was encountered.
W: The repository 'http://security.debian.org stretch/updates InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially …Run Code Online (Sandbox Code Playgroud) 我正在使用 PureOS,它基本上是 Debian 并做了一些小调整。我尝试在其上安装 firefox,但结果一团糟。如果我现在尝试进行基本升级,则会得到以下信息:
$ sudo apt update && sudo apt upgrade
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:3 http://deb.opera.com/opera stable InRelease [2592 B]
Get:4 http://security.debian.org stretch/updates InRelease [63.0 kB]
Hit:5 http://deb.debian.org/debian stretch Release
Get:6 https://repo.skype.com/deb stable InRelease [4486 B]
Get:7 http://deb.opera.com/opera stable/non-free amd64 Packages [1835 B]
Get:8 http://packages.microsoft.com/repos/vscode stable InRelease [2801 B]
Get:9 http://repository.spotify.com stable InRelease [3302 B]
Get:10 http://repo.puri.sm/pureos green InRelease [9427 B]
Get:12 http://security.debian.org stretch/updates/main Sources [110 kB]
Get:13 http://security.debian.org stretch/updates/contrib Sources …Run Code Online (Sandbox Code Playgroud) 我正在尝试玩一个名为 punes 的 NES 模拟器,在它的 github 页面上,它说我需要手动配置和构建。当我这样做时./configure,我明白了configure: error: Qt5 library not found。然而,当我这样做时apt list *qt5*,它给了我一个非常长的包列表,其中没有一个是明显的包qt5或qt5-dev类似的东西,所以完全不明显我需要哪个包才能“获取 qt5”。
我使用的是 Debian 11 bullseye stable。
我无法安装neovim 0.8.0+(KDE neon基于ubuntu)。我neovim 0.8+需要LunarVim。apt下一个说:
\xe2\x9e\x9c ~ LV_BRANCH=\'release-1.2/neovim-0.8\' bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)\n\n 88\\ 88\\\n 88 | \\__|\n 88 |88\\ 88\\ 888888$\\ 888888\\ 888888\\ 88\\ 88\\ 88\\ 888888\\8888\\\n 88 |88 | 88 |88 __88\\ \\____88\\ 88 __88\\\\88\\ 88 |88 |88 _88 _88\\\n 88 |88 | 88 |88 | 88 | 888888$ |88 | \\__|\\88\\88 / 88 |88 / 88 / 88 |\n 88 |88 | 88 |88 | 88 …Run Code Online (Sandbox Code Playgroud) 我习惯于apt将下载的包存储在 中/var/cache/apt/archives/,但它不再这样做了,我不明白为什么。
恕我直言,配置已相应设置:
# apt-config dump | grep -i cache
Dir::Cache "var/cache/apt";
Dir::Cache::archives "archives/";
Dir::Cache::srcpkgcache "srcpkgcache.bin";
Dir::Cache::pkgcache "pkgcache.bin";
Binary::apt::APT::Cache "";
Binary::apt::APT::Cache::Show "";
Binary::apt::APT::Cache::Show::Version "2";
Binary::apt::APT::Cache::AllVersions "0";
Binary::apt::APT::Cache::ShowVirtuals "1";
Binary::apt::APT::Cache::Search "";
Binary::apt::APT::Cache::Search::Version "2";
Binary::apt::APT::Cache::ShowDependencyType "1";
Binary::apt::APT::Cache::ShowVersion "1";
Run Code Online (Sandbox Code Playgroud)
虽然我对那些东西一无所知Binary::*。
它似乎也与任何权限问题无关,因为/var/cache/apt/archives/在使用时会重新创建apt install <arbitrary-package>。
有什么提示吗?
我想知道如何mysql-client-5.7使用 apt-get 在 debian buster 上安装,因为它尚未出现在Debian Buster Package Repository?
一些背景信息:
我想安装mysql-client-5.7在无法通过 SSH 连接的 AWS Codebuild(远程服务器)上,所以我可以在那里安装它的唯一方法是使用 apt-get 命令。
在在 Ubuntu 上安装 Docker 引擎的Docker 文档中,有一个从存储库安装的选项(以及下载 deb 文件并安装它的选项,以及使用也使用存储库的便捷脚本)。但我发现如果我只是跑
sudo apt-get install docker.io
Run Code Online (Sandbox Code Playgroud)
在我的机器上,它将完美下载并运行 Docker。
我的问题是:从自己的存储库安装 docker 或从已配置的默认存储库安装 docker 有区别吗?
另外,在查看文档时,您应该安装 3 个软件包docker-ce docker-ce-cli,而containerd.io从默认存储库安装时,您只需安装docker.io.
这些不同的软件包是什么以及它们包含什么?
我最近刚刚在带有 Windows 7(64 位)主机的 Virtual Box 上安装了 Kali Linux 2.0(64 位)。我对 apt-get 有问题,这里的简单问题是,我该如何解决?
不幸的是,运行:“apt-get update”,返回错误信息如下:
(如果你看到一些不太正确的东西,我只是手动输入,因为我无法让桥接剪贴板工作。)
root@kali~# apt-get update
0% [Connecting to http.kali.org (192.99.200.113)}]
Run Code Online (Sandbox Code Playgroud)
“0%”消息会在那里停留 30 秒,然后在错误消息出现后消失。
Err http://http.kali.org sana InRelease
Err http://http.kali.org sana/updates InRelease
Err http://http.kali.org sna Release.gpg
Unable to connect to http.kali.org:http:
Segmentation fault
Reading package lists... Done
W: Failed to fetch http://http.kai.org/kali/dists/sana/InRelease
W: Failed to fetch http://http.kali.org/kalisecurity/dists/sana/updates/InRelease
W: Faied to fetch http://http.kali.org/kali/dists/sana/Release.gpg
Unable to connect to http.kali.org:http:
W: Some index files failed to download. They have been …Run Code Online (Sandbox Code Playgroud) apt ×10
debian ×5
linux ×5
apt-get ×3
ubuntu ×2
dependencies ×1
docker ×1
dpkg ×1
kali-linux ×1
kde ×1
mysql ×1
neovim ×1
qt ×1
qt5 ×1
shell-script ×1
virtualbox ×1