Professional Documents
Culture Documents
Chapter 4.7 - Linux Package Managers
Chapter 4.7 - Linux Package Managers
Module 4 - Linux OS
11001010101010
● APT
● Snap
● Flatpak
12 July 2023
1
11001010110001101010
11001010110001101010
We can use APT to search for program packages to install them or bring the whole system up to date. It is not just
11001010101010
11001010101010
limited to this, a variety of tasks can be done using it, and here some common examples of how to use the APT
Ubuntu package manager on the command line.
2
11001010110001101010
11001010110001101010
11001010101010
3
11001010110001101010
11001010110001101010
11001010101010
● Install software from repo– Syntax: [sudo] apt-get [option] Command [packg1] [packg2]
sudo apt package-name, example sudo apt install vlc
4
11001010110001101010
11001010110001101010
The command apt-get update is used to update the package index files on the system, which contain
information about available packages and their versions. It downloads the most recent package
11001010101010
11001010101010
information from the sources listed in the "/etc/apt/sources.list" file that contains your sources list. It is
advised to run apt-get update frequently in order to ensure that the system is aware of the latest
available package updates.
OTOH, apt-get upgrade is used to update installed packages to the most recent version. To identify which
packages require an upgrade, "apt-get update" is used to gather the necessary information. The "apt-get
upgrade" program downloads and installs the most recent packages, replacing any earlier versions that
were already on your system.
In a nutshell, "apt-get update" updates the package index files, whereas "apt-get upgrade" upgrades the
actual packages installed on your system.
Using apt-get update and apt-get upgrade is essential for keeping your Linux system up-to-date with the
latest package releases.
5
11001010110001101010
11001010110001101010
11001010101010
sudo apt-get install firefox
sudo apt-get remove firefox
6
11001010110001101010
11001010110001101010
11001010101010
leftover packages are no longer used by anything else and can be
removed.
To remove the unneeded dependencies use the following command:
sudo apt autoremove
7
11001010110001101010
11001010110001101010
11001010101010
sudo apt list
The command will print a list of all packages, including information about the versions and architecture of
the package. To find out whether a specific package is installed, you can filter the output with the grep
command.
8
11001010110001101010
11001010110001101010
Getting a list of the upgradeable packages may be useful before actually upgrading the packages:
sudo apt list --upgradeable
11001010101010
11001010101010
Searching Packages (apt search)
This command allows you to search for a given package in the list of the available packages:
sudo apt search package_name
If found, the command will return the packages which name matches the search term.
9
11001010110001101010
11001010110001101010
11001010101010
stores information about all available packages.
10
11001010110001101010
11001010110001101010
11001010101010
For example, we want to install the KDE connection app that is available in
the official Ubuntu repo but how do we know the exact package name to use
with the apt command. Thus, we will search it:
11
11001010110001101010
11001010110001101010
11001010101010
updates for the installed Firefox version, so the syntax will be:
12
11001010110001101010
11001010110001101010
11001010101010
software deployment and package management system developed
by Canonical to provide a universal package management platform
for all major Linux distros. Primarily it meant for a server or cloud
environment and also for the Internet of Things. However, now it
can be found in the desktop versions and even integrated into the
GUI Software Manager of Ubuntu.
13
11001010110001101010
11001010110001101010
sudo snap install package-name– To install packages from Snap
snap list --all – Will show all installed SNAP programs or packages
snap changes – Shows the progress of the installations, reinstallations, etc. of snaps.
11001010101010
11001010101010
sudo snap refresh– command refresh updates all snaps:
sudo snap refresh package-name – You can also specifically update individual
snaps.
snap list – lists the installed snaps. The name, version, revision, track/channel,
developer, and notes of the snap are displayed by default.
14
11001010110001101010
11001010110001101010
11001010101010
binaries, libraries, configuration files, and other files in a directory /var/lib/flatpak/app.
Thus, it can be install and use on various kinds of popular Linux distributions without any
further adjustments. All the major open-source applications are available in its repository
called FlatHub.
15
11001010110001101010
11001010110001101010
11001010101010
FlaHub.
16
11001010110001101010
11001010110001101010
11001010101010
Step 1: Updating the Packages
First, ensure that Ubuntu packages are up to date and that the below
command will be used for this purpose.
17
11001010110001101010
11001010110001101010
11001010101010
$ sudo apt install flatpak
To check the Flatpak version, you can use the following command.
$ flatpak --version
18
11001010110001101010
11001010110001101010
After successfully installing Flatpak on Ubuntu 22.04, it’s now time to tell you how you
can use this tool to download different packages or software.
11001010101010
11001010101010
First enable the Flathub (a popular destination for searching the application) using the
following command.
19
11001010110001101010
11001010110001101010
Once the Flathub is enabled, you can then install the application through the following
command.
11001010101010
11001010101010
Just replace the “Application_name” with the name of the application you want to install. In
our case, we are installing Telegram through Flatpak using the following command.
20
11001010110001101010
11001010110001101010
To uninstall the application from Flatpak, you will again need to use the
application ID in the following command.
11001010101010
11001010101010
$ flatpak uninstall <Application_ID>
To uninstall Telegram:
21
11001010110001101010