有很多软件我们是通过.deb文件安装的,因为官方的Ubuntu仓库里面的版本都非常旧。但是我一直在想如何更新通过.deb文件安装的软件包。
一个特别的例子就是sonic-visualiser。 官方的Ubuntu仓库里面的版本是3年前的2.5版本,而官方网站上有最新的3.0.3版本。
一个特别的例子就是sonic-visualiser。 官方的Ubuntu仓库里面的版本是3年前的2.5版本,而官方网站上有最新的3.0.3版本。
编辑: 在这篇文章的评论中,有些人对使用带有安装文件路径的apt命令感到困惑。虽然apt的主要功能是管理软件包并从apt获取的存储库列表中更新它们,但它也可以用于安装已下载的软件包,就像上面的例子一样。也许也可以使用Debian and Ubuntu based distributions
The easiest way to install Visual Studio Code for Debian/Ubuntu based distributions is to download and install the .deb package (64-bit), either through the graphical software center if it's available, or through the command line with:
sudo apt install ./<file>.deb
Installing the .deb package will automatically install the apt repository and signing key to enable auto-updating using the system's package manager. Note that 32-bit and .tar.gz binaries are also available on the VS Code download page.
The repository and key can also be installed manually with the following script:
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
Then update the package cache and install the package using:
sudo apt-get install apt-transport-https sudo apt-get update sudo apt-get install code # or code-insiders
dpkg -i
命令以相同的效果进行安装-我不知道。我只能说的是,上面示例中的下载软件包会获得签名,并使用签名的源存储库更新apt的存储库列表。而Visual Studio推荐用于安装它的软件是apt。apt
与apt-get
和apt-cache
有一组共同的命令,这些命令广泛分布在它们两者之间。因此,apt是一组少数通用的日常使用命令,应该更加用户友好。有关更多比较,请参阅这篇易读的文章:https://itsfoss.com/apt-vs-apt-get-difference/。sudo apt install ./<file>.deb
这是错误的。应该使用 dpkg -i
而不是 apt install
。APT 只能从软件包仓库安装软件包,而不能安装已下载的软件包。 - philsf./
。否则,apt将尝试从Ubuntu的存储库或设置的其他地方检索和安装软件包。希望能帮到你。 - Ola下载一个新的 .deb
文件,并像之前安装的那样进行安装。
不,你不能通过正常的 apt update && apt upgrade
过程来获取自动更新;这就是仓库的作用。