Hello people, today we are going to see the topic of installing programs with APT, but also, update, uninstall, search and some other things. But first we are going to review some basic concepts but without going too deep so as not to make this article too long, including repository, package and the APT system.
Package manager: WHAT IT IS AND WHAT IT DOES
Packages encapsulate the files needed to install a program, and in some cases a single package installs multiple programs. The package format used in Deepin is .deb. Many programs use other programs to work, in this way the system looks like a big toolbox or rather a workshop full of tools, where tools are built with other tools, let's use a wooden cutting table as an analogy, that can be built with a table and an electric hand saw, that is, that to build (install) a table for cutting wood it is necessary (depends) on having a table and an electric hand saw in the workshop. This would be an analogy of dependencies when installing a program.
Continuing with the analogy, a repository looks like a hardware store, where we can get the tools that we need and that we do not have, the repository usually has more programs than we need but that satisfy the different needs of users, such as the Hardware store has more tools than each one needs individually. Like hardware stores, each repository has an inventory of everything they have available, and if a repository does not have what we need, we can add a repository that does have what we need.
But you have to check that the repository is compatible; Continuing with the analogy of hardware stores, as we know in Europe the electric current is 220 volts, but in most of America it is 110 volts, also the plugs are not the same, so the power tools of the European hardware stores are not going to be able to connect in America and vice versa, and if the plug is forced, a European tool in America will not work at full power and an American one in Europe will burn (spark gap). Likewise, we must make sure that the repositories that we add to the system are compatible.
It is a package management system, it has a list of all the programs installed on our computer, it also has a list of everything that is available in the added repositories, so when a package is installed, it is checked if it already has everything installed. is required (dependencies) or if you need to install additional packages from installed repositories.
The system package management that Deepin uses is APT, but there are more in other distributions, for example YUM in Fedora, YaST in openSUSE and Pacman in Arch Linux, just to mention the most popular ones.
Finally we are going to mention the package conflict, that happens when to install a package you have to uninstall another, this is equivalent to that for reasons of space, to put a tool in the workshop, first you have to remove another to make room for it. This is the main cause of a system breaking when adding a repository that is not compatible, because many programs that work well are replaced by others that were not designed to work on our system, after enough changes the system stops working .
Here are some basic APT commands that are very useful.
sudo apt update
This downloads and updates the list of packages available in the installed repositories.
sudo apt install nombre_del_paquete
This command installs a package, for example Sudo apt install firefox-latest install Mozilla Firefox in its latest version.
You can also reinstall a package by adding the parameter -reinstall.
sudo apt install --reinstall nombre_del_paquete
One way is to start typing the name of the package and press the TAB key twice, this way it shows all the packages that start with what we have written, for example, all the packages that start with gimp.
[email protected]:~$ sudo apt install gimp gimp gimp-gluas gimp-help-es gimp-help-ru gimp-cbmplugs gimp-gmic gimp-help-fr gimp-help-sl gimp-data gimp-gutenprint gimp-help-it gimp-help-sv gimp-data-extras gimp-help-ca gimp-help-ja gimp-lensfun gimp-dbg gimp-help-common gimp-help-ko gimp-plugin-registry gimp-dcraw gimp-help-de gimp-help-nl gimp-texturize gimp-dds gimp-help-el gimp-help-nn gimp-ufraw gimp-gap gimp-help-en gimp-help-pt [email protected]:~$ sudo apt install gimp
When there are too many results then it will ask us if we want to show them all.
[email protected]:~$ sudo apt install firefox Display all 104 possibilities? (y or n)
If you press the Y key it is yes, if you press the N key it is no. If you answer affirmatively at the end of the terminal window, the legend -More- indicating that there are more results than can be displayed in the window.
[email protected]:~$ sudo apt install firefox Display all 104 possibilities? (y or n) firefoxdriver firefox-esr-l10n-en-gb firefox-esr-l10n-id firefox-esr-l10n-pl firefox-esr firefox-esr-l10n-en-za firefox-esr-l10n-is firefox-esr-l10n-pt-br firefox-esr52.9-cn firefox-esr-l10n-eo firefox-esr-l10n-it firefox-esr-l10n-pt-pt firefox-esr-dev firefox-esr-l10n-es-ar firefox-esr-l10n-ja firefox-esr-l10n-rm firefox-esr-l10n-ach firefox-esr-l10n-es-cl firefox-esr-l10n-ka firefox-esr-l10n-ro firefox-esr-l10n-af firefox-esr-l10n-es-es firefox-esr-l10n-kab firefox-esr-l10n-ru firefox-esr-l10n-all firefox-esr-l10n-es-mx firefox-esr-l10n-kk firefox-esr-l10n-si firefox-esr-l10n-an firefox-esr-l10n-et firefox-esr-l10n-km firefox-esr-l10n-sk firefox-esr-l10n-ar firefox-esr-l10n-eu firefox-esr-l10n-kn firefox-esr-l10n-sl firefox-esr-l10n-as firefox-esr-l10n-fa firefox-esr-l10n-ko firefox-esr-l10n-son --More--
You can move by pressing the key Enter or the space key. Press the Q key to quit.
Another way to search for packages in APT is with the option search, for example:
apt search firefox
Shows all packages that match the term "firefox".
And if we want a more compact list we can do the search in the following way.
apt list | grep firefox
If you want to see only the ones that are installed you can combine the search with the grep command.
apt search chrome | grep instal
There are two options.
sudo apt upgrade
This updates everything that is installed but does not uninstall any packages, so if updating a package requires that something be uninstalled, that package is not updated, but the rest are. The other option is with the following command.
sudo apt full-upgrade
This option, in addition to updating everything that is installed, uninstalls all the packages that are necessary to install all the updates, ensures that everything is updated to the latest version available in the installed repositories.
We will present three options
sudo apt remove paquete
Uninstall the package but leave some files, for example configuration files.
sudo apt purge
With this option the package is uninstalled and all related files are deleted, trying not to leave any trace that the package has been installed.
sudo apt autoremove
This command is related to dependencies. When a package is uninstalled, its dependencies are not uninstalled. With the autoremove option, APT finds all packages that were installed as dependencies but are no longer used by any other package and uninstalls them automatically.
BEWARE break the system
When you run an update, install or uninstall, you should pay attention to the system warnings. The format and behavior of the warnings is the same in all cases. The following is an example of uninstallation, where removing a single package triggers the uninstallation of the entire Deepin desktop; vlc-plugin-base at first glance seems unrelated, but it is more important than suspected.
[email protected]:~$ sudo apt remove vlc-plugin-base [sudo] password for usuario: Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho Los paquetes indicados a continuación se instalaron de forma automática y ya no son necesarios. libkf5activitiesstats1 libkf5js5 libkf5khtml-data libkf5kirigami2-5 libkf5parts-data libkworkspace5-5 libnotify-bin qml-module-org-kde-kirigami2 Utilice «sudo apt autoremove» para eliminarlos. Los siguientes paquetes se ELIMINARÁN: dde-clipboard dde-control-center dde-daemon dde-kwin dde-session-shell dde-session-ui kio kwin-common kwin-x11 libkf5declarative5 libkf5kcmutils5 libkf5khtml-bin libkf5khtml5 libkf5newstuff5 libkf5newstuffcore5 libkf5notifications5 libkf5parts-plugins libkf5parts5 libkf5plasma5 libkf5plasmaquick5 libkf5quickaddons5 libkf5wallet-bin libkf5wallet5 libkscreenlocker5 libkwalletbackend5-5 libkwin4-effect-builtins1 phonon4qt5 phonon4qt5-backend-vlc plasma-framework qml-module-org-kde-kcm qml-module-org-kde-kconfig qml-module-org-kde-kquickcontrols qml-module-org-kde-kquickcontrolsaddons startdde systemsettings vlc-plugin-base 0 actualizados, 0 nuevos se instalarán, 36 para eliminar y 0 no actualizados. Se liberarán 252 MB después de esta operación. ¿Desea continuar? [S/n] n Anulado.
The first thing to look carefully at is the list of packages to be removed, headed by the phrase: "The following packages WILL be REMOVED." If you don't understand what uninstalling that package list entails, you'd better press the N key and then Enter to abort the operation.
The second thing to check is the modification counter, in this case "0 updated, 0 new will be installed, 36 to remove and 0 not updated". This is also an indicator to know if the operation is what we expected or is getting out of control.
It is also interesting to see the total weight of the files that will be added or that will be released after the operation, in the example it is “252 MB will be released after this operation”.
Finally, if you agree and understand the changes, press the S key and EnterIf you have better questions and press the N key Enter to cancel the operation.
If the operation does not affect other packages already installed, the system does not ask whether to continue or not.
Having broken packages is when an installation was interrupted or for some reason did not finish successfully, with the following command all pending installations are repaired.
sudo apt install --fix-broken
If you need to reconfigure the package so that it reconfigures as it was when it was installed, use the following command.
sudo dpkg-reconfigure paquete
To see all the details of a package there is the option show, with which you can check the version, description, size, among others. The command is as follows.
apt show paquete
If you want to see all available versions add the -a parameter.
apt show -a paquete
To see a list of the location of the files installed by the package run the following.
dpkg-query -L paquete
Limpar CACHE PACKET
Every time a package is installed from a repository, the corresponding .deb file is downloaded and saved in the / var / cache / apt / archives / folder. If you want to delete all the files and free up that space, run the following command.
sudo apt autoclean
All those .deb files are no longer needed as they have already been used to install the corresponding packages. They are only useful if you need to reinstall the same packages.
For newbies we think this is more than enough, although the apt command has more options. We mentioned that there are programs to use APT graphically, among them is Synaptic and GDebi, the first is to manage the system packages and those available in the installed repositories, and the second to install the packages when a file is manually downloaded. deb. Deepin has the Deepin Package Manager program (deepin-deb-installer) that comes pre-installed, it does the same function as GDebi but in a more simplified and simple way.
OTHER ITEMS THIS SERIES
TERMINAL FOR ROOKIE
This was the first article in this series. We quickly show basic tricks and commands to start using the terminal in GNU / Linux.
TERMINAL FOR ROOKIE: FISH, SHORTCUTS, ALIAS AND MORE
The terminal is a very useful tool, and its use is almost unavoidable. We facilitate its handling with these tricks.
TERMINAL FOR ROOKIE: COMMAND SUDO
Sudo, a very basic command and very easy to use. It is used to modify components that affect the entire system and not just the user account settings.
Newbie terminal: manage folders and files
How to copy, move, delete and create files and folders.