The best part about Ubuntu and any flavor of Linux is that it comes with its own repository. A repository is basically like a store filled with thousands of packages or software. However, all the software available in the repository is open source and for Linux.
You can, of course, search the repository for available packages using the apt command. To search the repository in Ubuntu:
For example, suppose that I’m looking for a package called MySQL:
Suppose that you’ve found the package you want but are looking for more information about the found package, then you’d use the apt show command.
Ex:
Next, you can check for the dependencies using the following code:
Ex:
Once you’re satisfied with the package you’ve found, you can install it. The apt-get install command will fetch and install the dependencies first and then install the package itself so that you can sit back and relax while the command does everything automatically for you. To install using the repository in Ubuntu:
Ex:
Once installed, it is always a possibility that you might not like the package and wish to completely remove it from your system. To remove an installed package, type:
Ex:
Apt -get remove will not remove the configuration files of the program you installed, and in those cases, you may use purge instead. To remove everything, including configuration files, you would type:
There are many instances when and where the package you’re looking for will not be in the repository; however, it might be available in a totally different repository. So what do we do then? We add the repository that does have the file to our own. Apt primarily look for repositories in /etc/apt/sources.list – this is where all the repositories are found.
In order to add another repository to the ones you currently own, you can use the Personal Package Archives (PPAs). It is advised that you do not randomly add repositories, as it is not scanned for malware! Only add from trusted sources!
For example, if you want to add the ppa for the simple screen recorder:
To remove the ppa repository for the simple screen recorder:
For example, when you want to install Wine for Linux, they ask you to add a repository.
Ex:
The latter will add the repository specified to /etc/apt/sources.list.
At times, there’s just no other way around it; you need to install the package manually. In such cases, the packaging format you get depends on the software you’re downloading.
DEB Packages
In order to install a DEB packaging, I personally use gdebi:
Once gdebi is installed, you can use the following code to install the .deb package.
Alternatively, most users use the dpkg command. The dpkg command is used to install, build, remove, and manage debian packages. Sometimes, you simply download a deb file and can’t use the apt command; in such cases, we use the dpkg command.
To install a package using dpkg:
One can also use dpkg to scan the deb file to see its contents:
To uninstall using dpkg, you need the package name used by the system; you can get it by typing:
And then uninstall it using the following:
And should it require reconfiguration because it’s corrupt, you can type:
RPM Package
RPM packages are typically used by CentOS, RHEL, and Fedora. However, there are times when as an Ubuntu user, you just need to use an rpm package. You can turn the rpm package into a deb package and install it in such cases.
First, let’s install alien, a package used to convert rpm files into deb files.
Then, download the rpm file and type:
For example, the latter will create a deb version of the same package that you can install with gdebi.
Tarballs
With tarballs, it’s harder to satisfy dependencies, and it’s harder to remove and update. However, there are times when tarballs are the only option, especially if you are prone to downloading off of github. In such cases, to install tarballs:
Advanced Linux users prefer to install packages via the command line; this is a fact. Packages come in all shapes and forms; this is another fact. Some packages are rpm packages, others are tarballs, others can be found in a repository, and others require you to add novel repositories. In this tutorial, we learned the various ways in which one can install and manage packages. In fact, we rely on the apt and the dpkg commands to manage them overall. Using apt and dpkg, we can install, update, and remove packages.
Happy Coding!
One of the most critical gaps in traditional Large Language Models (LLMs) is that they…
Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…
What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…
Wouldn’t it be wonderful to wake up one day with a desire to explore AI…
Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…
Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…