Software & AppsOperating SystemLinux

How To Update Software Installed via .deb File on Ubuntu

Ubuntu 19

In the realm of Linux, the Debian (.deb) package format is a common method for distributing software. Ubuntu, as a Debian-based distribution, supports this package format. This article will guide you through the process of updating software installed via .deb files on Ubuntu.

Quick Answer

To update software installed via .deb files on Ubuntu, you have a few options. If the installation added repositories for automatic updates, you can use the apt package manager to update the software. If not, you can manually add repositories and use the apt package manager to update. In some cases, you may need to manually download and install newer .deb packages.

Understanding .deb Files

Before we dive into the updating process, it’s crucial to understand what .deb files are. A .deb file is essentially a Debian software package format that contains compiled files and installation instructions for a specific software. When you install a .deb file, the system unpacks the file and follows the instructions to install the software.

Automatic Updates

Some .deb installations automatically add repositories to the apt package manager, which allows for automatic updates. For instance, when you install Visual Studio Code using a .deb file, it adds the apt repository and signing key during installation. This enables the software to auto-update using the system’s package manager.

To install a .deb package with automatic updates, use the following command:

sudo apt install ./<file>.deb

In this command, sudo gives you superuser privileges, apt is the package handling utility, install is the command to install a package, and ./<file>.deb is the path to your .deb file.

Manual Updates

If the .deb installation does not add repositories for automatic updates, you can manually add them. Visual Studio Code, for example, provides a script to add the repository and key manually.

Here are the steps to manually install a .deb package and enable updates:

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'
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code

In this script, curl is used to download the Microsoft signing key, which is then processed by gpg and stored as packages.microsoft.gpg. The sudo install command moves this key to /usr/share/keyrings/. The echo command adds the Visual Studio Code repository to your list of apt sources. apt-transport-https is a package that allows the package manager to transfer files and data over https. Finally, sudo apt-get update updates your package list, and sudo apt-get install code installs Visual Studio Code.

Using apt to Update .deb Files

You can also use the apt package manager to install a downloaded .deb package. This method allows you to specify the absolute path to the .deb file or use ./<file>.deb if the file is located in your current working directory. Here’s the command:

sudo apt install /path/to/your/package.deb

However, note that apt is primarily used for managing packages from repositories, so it may not be the recommended method for updating software installed via .deb files.

Manual Download and Installation

It’s important to note that not all .deb installations provide automatic updates or repositories for updates. In such cases, you may need to manually download and install newer .deb packages as they become available from the official website or other trusted sources.

To manually install a .deb package, you can use the dpkg command:

sudo dpkg -i /path/to/your/package.deb

In this command, dpkg is the Debian package management utility, -i instructs it to install a package, and /path/to/your/package.deb is the path to your .deb file.

Conclusion

Updating software installed via .deb files on Ubuntu can be a straightforward process, whether it’s done automatically through repositories or manually. Understanding how .deb files work and how to use commands to manage them is an essential skill for any Ubuntu user. With the information provided in this article, you should be well-equipped to keep your .deb installed software up-to-date.

Can I update software installed via .deb files automatically?

Yes, some .deb installations automatically add repositories to the apt package manager, allowing for automatic updates. However, not all .deb installations provide this feature.

How can I install a .deb package with automatic updates?

To install a .deb package with automatic updates, use the following command: sudo apt install ./<file>.deb. Replace <file> with the name of your .deb file.

What should I do if the .deb installation does not add repositories for automatic updates?

If the .deb installation does not provide automatic updates, you can manually add repositories. Some installations, like Visual Studio Code, provide scripts to add the repository and key manually. Refer to the specific software’s documentation for instructions.

Can I use the apt package manager to update .deb files?

While you can use the apt package manager to install a downloaded .deb package, it is primarily used for managing packages from repositories. It may not be the recommended method for updating software installed via .deb files.

How can I manually download and install a .deb package?

To manually download and install a .deb package, use the dpkg command. Run sudo dpkg -i /path/to/your/package.deb, replacing /path/to/your/package.deb with the actual path to your .deb file.

Leave a Comment

Your email address will not be published. Required fields are marked *