Use Topgrade to update packages on Linux 1

How to Use Topgrade to Update Packages on Linux

Package managers oftentimes refer only to specific Linux distributions and cannot update your entire system and virtual environments. Topgrade helps to resolve this issue by being a universal tool to update packages on Linux.

Take, for example, package managers like snap, apt, and dnf. Unlike Topgrade, each of these caters only to specific forks of Linux-based OS. If you are working with other virtual environments such as Anaconda and Python, chances are, a full system update won’t affect your isolated environments. 

What if there was a tool that manages all the details on every program, application, software, and even firmware that you are using? Then you’re in luck, such a tool does exist, and it’s called Topgrade. In this article, we will be explaining how to use Topgrade to update packages in your Linux device.

An overview of Topgrade

Topgrade is an open-source CLI tool initially developed by Roey Darwish Dror on Github. It detects and scans the entire system on which programs you use by running the appropriate commands to update them.

As of this writing, however, r-darwish no longer maintains the repository. But an effort was made by the Github community to keep maintaining the project at topgrade-rs.

As a tool that scans your system, it abides by a simple yet effective method that executes a list of possible commands—that would, in essence, update the installed programs, tools, or system environments housed in your device.

The versatility of Topgrade, as provided for under the Step List, includes Operating Systems such as Linux-based systems, Free BSD systems, Unix Systems, Windows, and Mac OS.

Installing Topgrade

In this article, we will install Topgrade on a Linux-based OS, specifically Ubuntu.

Prerequisites 

Topgrade is written using Rust programming language. In order for it to work properly, we will need to install the cargo package as well as certain libraries. To start, type the command:

$ sudo apt install cargo libssl-dev pkg-config

Installing and Configuring Topgrade

To install Topgrade on your Linux device, execute the following command:

$ cargo install topgrade

The above command will then download, compile and build all the necessary packages that come with Topgrade. It will also provide the following log output:

install topgrade

You can include that specified bin path to your home directory by executing the command:

$ echo 'export PATH=$PATH:/home/disdroid/.cargo/bin' >> /home/disdroid/.bashrc

Don’t forget to make sure to change the path to your own custom home address. The end of your “.bashrc” should look something similar to this:

check

Next, it is recommended to also install cargo-upgrade so that Topgrade can include cargo in updating your system. Simply execute:

$ cargo install cargo-update 

Lastly, reboot your device in order for Topgrade to fully integrate into the system.

How to Use Topgrade to Update Your Entire System Applications

Once Topgrade has been installed, we will now begin exploring its functionalities. The utility itself does not have a dedicated man page since it is sourced and compiled from a community git repo, but it does include a help page just to satisfy curious users.

Topgrade Command to update your packages

First, let us explore the different ways in which Topgrade may be executed. A summary of the help command displayed below will tell you all the additional variables you may use to run Topgrade.

Use Topgrade update packages Linux

Executing “topgrade” itself will automatically update your system. But if you are unsure what the exact output is, you can also do a dry-run just to have a summary on what it will update. Execute the following command to do so:

$ toprade --dry-run

This is how its output should look like:

Use Topgrade update packages Linux

Next, if you are confident with the dry-run results, try executing Topgrade by doing a dry-run this time around. 

$ topgrade

Its output should look like this:

Use Topgrade update packages Linux

Familiarizing with the Topgrade default config

As described earlier, Topgrade offers a wide array setup depending on your work environment. A summary of the customizable config is shown below. Just execute:

$ topgrade --edit-config

This is its output:

Use Topgrade update packages Linux

The above command will open the configuration file using vim.

Upgrading a specific package or program

To update a specific package, Topgrade provides a specified command depending on the software, whether inside virtual environments or containers.

For example, to update conda, type the command:

$ topgrade --only conda


Blacklisting certain repositories or package-managers

Topgrade also offers this added flexibility to skip or disable certain repositories or package managers from being called or executed when upgrading. You normally do this by disabling that repo on the package-manager’s configuration file. 

However, you can execute this through CLI just by adding a few variables. Topgrade also includes an expression to exclude git-sourced repos. To illustrate, simply execute:

$ topgrade --disable snap

or

$ topgrade --disable-predefined-git-repos

Final Thoughts

As a precision-made tool that handles as a universal packagemanager, Topgrade offers some of the most customizable and diverse command modules to update almost any program on almost any Operating System available today.

Developed as an open-source program, anyone can fork and customize the design and add certain concepts to make it more attuned to their work environment.

But the biggest takeaway is the simplicity of its design in executing your desired update, no matter which system you are currently using. So we hope you were able to find out how to update your packages in Linux now. If you have any question regarding this topic, do not hesitate to leave a comment below.

If this guide helped you, please share it. ?

Leave a Reply
Related Posts