57

There are so many software which we installed via .deb file because official ubuntu repo has very old version of it. But I was just wondering how to update packages install via .deb file.

One particular example is sonic-visualiser The official ubuntu has 3 years old 2.5 version while the official site has 3.0.3 version

1

4 Answers 4

60

Disclaimer: I would say that the way distributions encourage users to install software is apt these days, which is a package manager that checks if the dependencies between packages are intact, you can issue an update to all your software that can be fetched from the source repositories list.

While it can be that installing a program with the .deb package doesn't add the repository to apt for automatic updates, some .deb installations do just that: they add repositories to apt for further updates or make it possible for you to add them manually and then install the software. Example: 'Visual Studio Code'. https://code.visualstudio.com/docs/setup/linux

I cite from their website:

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

EDIT: A discussion in the comments to this post started with some people being confused about calling apt with a path to the file being installed. While apt's great functionality is managing the software packages and updating them from the list of repositories apt gets, it can also be used to install a downloaded package, like in the case above. Perhaps it could also be installed with the dpkg -i with the same effect - I do not know that. What I can say is that the downloaded package from the example above gets the signature, updates the apt list of repositories with the signed source repo. And that the software the Visual Studio recommends for installing it is apt.

More generally apt, apt-get and apt-cache is a software included in APT, and they are package managers. apt has a set of commands in common with apt-get and apt-cache, and those are widely used package management commands that are scattered across both of them. So apt is a set of few universal every-day use commands and is supposed to be more user-friendly that way. For more comparison see this easy-read article: https://itsfoss.com/apt-vs-apt-get-difference/.

IN CONTRAST dpkg is another software that APT package manager calls to say which packages and of which versions to install so that the packages on the system interact with each other nicely and don't cause some conflicts. "While dpkg performs actions on individual packages, APT manages relations (especially dependencies) between them, as well as sourcing and management of higher-level versioning decisions (release tracking and version pinning). A major feature of APT is the way it calls dpkg — it does topological sorting of the list of packages to be installed or removed and calls dpkg in the best possible sequence. In some cases, it utilizes the --force options of dpkg. However, it only does this when it is unable to calculate how to avoid the reason dpkg requires the action to be forced. " -source: https://en.wikipedia.org/wiki/APT_(software)#Front-ends

6
  • 10
    sudo apt install ./<file>.deb this is wrong. It should be dpkg -i instead of apt install. APT only installs packages from package repositories and NOT downloaded packages
    – philsf
    Dec 8, 2021 at 19:41
  • @philsf are you sure ? I think apt is preferable over dpkg. Check this one askubuntu.com/questions/309113/….
    – John
    Mar 24, 2022 at 14:50
  • Yes I am sure. The accepted answer in the linked question explains why.
    – philsf
    Mar 24, 2022 at 16:37
  • 3
    Hi @philsf, naturally you can install a downloaded file with apt. I did it many times myself as apt is my go-to way to install the software. You can indicate the file by providing the absolute path to the apt install command or if the file is located in your current working directory you can prepend the file name with ./. Otherwise, apt will try to retrieve and install the package from Ubuntu's repositories or whatever is set. I hope it helps.
    – Ola
    Apr 4, 2022 at 8:47
  • 1
    Also @philsf, you can read more about APT on wikipedia: en.wikipedia.org/wiki/APT_(software)
    – Ola
    Apr 4, 2022 at 8:53
21

Download a newer .deb and install it just like you installed the previous one.

No, you cannot get automatic updates as part of the normal apt update && apt upgrade process; that's what repositories are for.

4
  • Snaps are also supposed to help with this; so consider Snaps (which if from the Ubuntu store do have a update path)
    – guiverc
    Dec 2, 2017 at 11:26
  • 2
    @guiverc I am not at all familiar with Snaps, so feel free to write another answer about that.
    – fkraiem
    Dec 2, 2017 at 11:33
  • 1
    my comment was for @Nipun to consider; but as the question was for .deb's a snap answer doesn't fit
    – guiverc
    Dec 2, 2017 at 12:04
  • @fkraiem how about using "sudo apt upgrade ./new_version.deb" look legit but I am hesitate to try it in the live system, any suggestions
    – dileepa
    May 20, 2021 at 18:22
1

Pacstall can install and update many popular applications and if yours is not yet in the repository you could add it yourself.

0

deb-get can do this for many popular applications and if yours is not yet in the repository you could add it yourself.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .