Linux operating systems have a different approach in dealing with installation of softwares.Windows installers usually include all the necessary libraries within the .exe file and the installation is super easy with a double click.But,in linux,we have to install all the dependent packages before installing a software.This system has many advantages but it is a bit confusing for newbies.Manually installing dependencies is a tedious task,but it can be automated using software managers and command line tools like APT.This section will familiarize usage of APT in debian based distributions like ubuntu and linuxmint.
1.UPDATING LIST OF SOFTWARES
Linux based distributions have repositories containing packages which are supported by the community or the developers.Details of these softwares are locally saved on our machine. apt update or apt update command downloads the package lists from the repositories to get information on the newest versions of packages and their dependencies.This command will not install any updates.
eg: sudo apt update
2. INSTALLING A PACKAGE
Packages can be installed using the apt install command. We can also install many packages at once by listing all their names.APT will automatically fetch and install all required dependencies for the package.It will let you know if there are some errors like missing dependencies.
eg: sudo apt install clementine
3. SEARCH FOR A PACKAGE
The search option searches for the given package name and show all the matching packages.
eg: apt search chromium
4. UPDATE PACKAGES
Actual updation of installed softwares is done using the apt upgrade command.We can either install all packages or individual packages.An update should always be performed first so that apt knows which new versions of packages are available.
eg: sudo apt upgrade
Installed softwares can be removed using the apt remove command.This command will not remove the automatically installed depensencies.
eg: sudo apt remove evince
6.CLEAN UNNEEDED INSTALLED PACKAGES
apt remove command will left you with uncleaned dependencies consuming system disk space.This unneeded packages can be removed using the apt autoremove command
eg: sudo apt autoremove
7.REMOVE PACKAGES WITH CONFIGURATION FILES
apt remove command will not remove the configuration of the package causing the same configuration on reinstalling the package.For removing package including its configuration,apt purge command can be use.Usage is similar to apt remove.
eg: sudo apt purge firefox
8.DELETING DOWNLOADED PACKAGES
apt clean command clean clears out the local repository of downloaded package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/ which contains all .deb packages.Disk space can be retrieved by removing these package files.
eg: sudo apt clean
9.FIND HELP WHILE USING APT
APT contains many more commands for advanced package management.List of all commands including details can be found using the command apt help.
NOTE:apt and apt-get are very similar command line tools.apt-get may be considered as lower-level and “back-end”, and support other APT-based tools.