Fundamentals of Package Management in Ubuntu and Debian
ubuntu·@aser1111·
0.000 HBDFundamentals of Package Management in Ubuntu and Debian
Package management is one of the key features of Linux distributions. The method of packing and packet management tools varies from one distribution to another, although two groups have emerged and have been classified as the most prevalent.  For Linux-based distributions, they use RPM tools such as rpm and yum. The other group, which is used by Debian, Ubuntu, and related distributions, uses a deb way and tools such as apt and dpkg. The article will discuss this last group. package-managment-ubunt-debian.png What this article will cover This article will cover user-level package management tools, which are often used in Debian and Ubuntu systems. The tools necessary to create packages will not be covered due to differing policy views between different distributions and complexities with examples in mind. We will discuss each tool available individually in the Debian package management toolkit, but the majority of this article will be sorted by function rather than tool. This article is a functional reference. To make the most of this article please keep the following points in mind: If you are a beginner in Debian package management tools, please read the Debian Package Management Summary below. This section will provide you with a comprehensive summary of each tool's features and how they relate to each other. Use each section of this article as necessary to get what you want. This article is not procedural, so you have the freedom to access what you think is right for you. Copy and paste examples of the given commands, replacing the values listed with your values. Overview of Debian's package management tools The available environment in Debian / Ubuntu uses management tools that are fairly different to manage programs in the system. Most of these tools are interconnected and run on the same package database. Some of these tools attempt to provide high-level interfaces for packet systems, while other tools focus on providing low-level functionality. Apt-get The Apt-get command is most commonly used by the apt group, whose main purpose is to interface with the remote repositories that are maintained by the distribution package team, as well as to perform operations on the available packages. The apt group generally works by dragging information from the repositories to the cache that is managed by the local system. The apt-get command is used to update the local cache, and is also used to modify the status of the package; we intend to install or remove the package from the system. Apt-cache Another important command in the apt set is the apt-cache command , which uses local cache to learn about the information about the packages available in its repositories. For example, any time you want to search for a specific package or tool to perform a specific function, the apt-cache command is a good starting point. It can also be useful to know which version of a package will be used for any action. As it is apt-cache useful in the case of reliability information, reverse and reliability. Aptitude The aptitude command combines many of the above functions, with the command-line feature that integrates the functionality of the two tools above, and can also work with ncurses, which is a text-based interface. When working from the command line, many commands represent exactly the apt-get and apt-cache capabilities . We will not discuss aptitude extensively in this article because of the obvious overlap in command functions. If you prefer this tool, you can always use aptitude by trading with apt-get or apt-cache . Dpkg While the previous tools focus on managing packages stored in repositories, the dpkg command can be used to run deb packages. individually. This is exactly responsible for the actions that take place in the above-mentioned scenes. Taskkel Tasksel is a different kind of program management tool. Instead of managing packages or even individual applications, taskel focuses on assembling programs needed to perform specific tasks. Organized tasks can be selected using a text interface, or can be targeted just as some packages are targeted in standard packages. The tool is very useful for getting started and moving on, although it is not the best way. Other tools There are many tools available to manage packages that provide us with many tasks and functions, or invoke information in different ways. Some of these tools are useful in certain situations but we will mention some of these tools when necessary. Update the system and system cache memory Packet management tools provide us with excellent ways to constantly update the system list of available packages, and provide simple ways to update the packages currently installed on your server. Update the local packet cache memory The repositories on which your packet tools depend on packet information are always up-to-date, but most of the package management tools work with the temporary memory of this information. It is always recommended to update the packet cache for each session before making any packet-specific commands, this will ensure that you are working on updated information about the available software. Additionally, some installation commands will not be executed if you are working on outdated information for some packages. To update the cache, use the apt-get command with the following update : sudo apt-get update This will bring up a list of updated information from the repositories about the packages you are following. Update the packages without removing The apt package package makes it easy to update all server-installed programs. The apt command distinguishes between two different update operations, the first process (which will be detailed in this section) can be used to update any part that does not require removal of other parts. This method is very important when you do not want to remove any installed package under any circumstances. But - in fact - some updates include replacing system parts or removing conflict files. This method will ignore any updates that require removal of packages: sudo apt-get upgrade After you perform this procedure, any update that does not include removing partitions will be applied. Update the packages and remove as necessary Apt makes it easy to update all server-based programs. The command distinguishes between two different updates, the first ignoring any update that requires the removal of any package, which is described in the section above. The second process, you update all packages, even those that require removal of certain packages. This is often necessary as a reliability to change packets. Typically, replaced packages are replaced by a functional alternative during the update process, making the update process safe. However, you should pay attention to the packages that need to be removed. To perform this functionality, perform the command: sudo apt-get dist-upgrade It will update all packages on the system, this process is considered to be a full update larger than the previous update. Download and install packages The task of facilitating the download and installation of packages on the system is one of the main tasks in the package management tools. Search for packages After downloading and installing packages, the first step is to search the distribution repositories for packages that you need. Most apt commands work mainly on the cache memory of the package information stored on the local computer. Of course, this allows for faster implementation and less traffic on the network. Packet searching is a process that targets information in the cache memory of packets. The apt-cache search sub - command is the tool used to search for available packages. Please note that you need to make sure that your local cache is updated before the search by sudo apt-get update : apt-cache search package Since this process only queries information, it does not require the sudo powers . Any search done will look for package names as well as a full description of them. For example, if you are looking for htop , the results will be as follows: apt-cache search htop aha - ANSI color to HTML converter htop - interactive processes viewer libauthen-oath-perl - Perl module for OATH One Time Passwords As you can see, we have a package called htop , but we also see two other programs, both referring to htop in the full description field of the package (the description that follows the output is a brief description). Install packages from warehouses To install a package of repositories, in addition to the entire package that is supported, we use the apt-get command with the install command . Inputs with this command must be the name or names of the packages as shown / used in the repository: sudo apt-get install package You can install several packages at once, separated by a space: sudo apt-get install package1 package2 If you request a package that requires other credits, it will be displayed and prompts you to confirm the process, which will be similar to the following: Reading package lists ... Done Building dependency tree Reading state information ... Done The following extra packages will be installed: apache2-data Suggested packages: apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils The following NEW packages will be installed: apache2 apache2-data 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 236 kB of archives. After this operation, 1,163 kB of additional disk space will be used. Do you want to continue [Y / n]? As you can see, although we requested the installation of apache2 , the apache2-data package is required as reliability. In this case you can complete by pressing ENTER or "y" or ignoring the process by pressing "n". Installation of a specific package of warehouses If you want to install a specific version of a package, you can add the version that you want with the equal sign, as follows: sudo apt-get install package = version The version in this case must correspond to the numbers available in the repository. This means using the version template in the distribution that you are using. You can find available versions by executing the command apt-cache policy package Reset settings Many packages include pre-installation settings, which are executed after the installation is completed. Often the administrator has the freedom to choose settings. If you want to delay the steps of these additional settings, you can use the dpkg-reconfigure command , which in turn looks at the package that is passed to it, and executes any commands for the subsequent settings included in the package specification: sudo dpkg-reconfigure package This will allow you to access the additional (and possibly other) settings you have exceeded during installation. Simulate package operations Sometimes, you need to see the side effects of an operation without actually relying on the execution of the command. Fortunately the apt will allow you to add s- to simulate the process. For example, you want to see what can happen when you choose to install a package, you can execute the command: apt-get install -s package This will allow you to see all the credits and changes on your system, which will occur if you remove the suffix s- . One of the benefits of this method is to enable you to see the results of an operation, which require root validity, without the use of sudo . For example, to evaluate what can be installed with apache2, you can execute the command: NOTE: This is only a simulation! apt-get needs root privileges for real execution. Keep also in mind that locking is deactivated, so do not depend on the relevance to the real current situation! Reading package lists ... Done Building dependency tree Reading state information ... Done The following extra packages will be installed: apache2-data Suggested packages: apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils The following NEW packages will be installed: apache2 apache2-data 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Inst apache2-data (2.4.6-2ubuntu2.2 Ubuntu: 13.10 / saucy-updates [all]) Inst apache2 (2.4.6-2ubuntu2.2 Ubuntu: 13.10 / saucy-updates [amd64]) Conf apache2-data (2.4 6-2ubuntu2.2 Ubuntu: 13.10 / saucy-updates [all]) Conf apache2 (2.4.6-2ubuntu2.2 Ubuntu: 13.10 / saucy-updates [amd64]) We'll get all the information about packages and releases without having to actually complete the process. This method also works with other processes such as system updates: apt-get -s dist-upgrade Do not wait for confirmation request with package actions Are apt to alert the user by default to confirm many processes, this includes the installation that require additional dependencies and update packages for operations. To override these updates, you can add y- when executing these commands: sudo apt-get install -y package This will install the package and any dependencies without requiring confirmation from the user, also used in the update process: sudo apt-get dist-upgrade -y Repairing incomplete dependencies and packages Sometimes some installations are not completed because of dependencies or other problems. One of the common cases of such problems is when you install a .deb package. Through dpkg , which does not analyze dependencies. The apt-get command tries to organize the situation by passing the f- command . sudo apt-get install -f It will search for any unavailable credentials and try to install them to repair the dependency tree. If the installation is incomplete due to a problem with dependencies, this should be the first step to try the solution. Download a pack of repositories In many cases it is useful to download packages from warehouses without actually installing them. You can do this through the download command of the apt-get command . Since the case is a file upload only, the system is not affected, so no sudo powers are required : apt-get download package This command loads a specific package / packages to the current folder. Load the package source from the repositories You can download the source files for the packages, although the apt command mainly deals with deb., As long as the apt source lists are equipped with that information. To load the package source, there must be an appropriate deb-src line in the source.list file for that apt . You can see how it works in the Add apt repositories section . After the repositories have been set up, you can load a package source by executing: sudo apt-get source package This command will load the package files into the current folder. Of course the download includes a package folder, a dsc description file, and a compressed and archived file package. ls -F sublime-text-2.0.2 / sublime-text_2.0.2-1 ~ webupd8 ~ 3.tar.gz sublime-text_2.0.2-1 ~ webupd8 ~ 3.dsc If you want to use distribution packages as a basis for future modifications, you can use the method listed. Install the deb package. Some providers provide raw files. For their programs, which you can install on your system, but most distributions recommend installing programs from their repositories that are getting their attention. To install .db files, we use the dpkg tool which is mainly used to work with standalone packages. The tool does not install procedures, instead it looks for deb packages. In the current folder, or the path that is provided: sudo dpkg - install debfile.deb It is important to note that the dpkg tool does not handle dependencies, which means that the installation will fail if there are no packages on which the current package depends. Fortunately, the tool identifies the required dependencies, since if the dependencies are available in the warehouses, you can easily provide them later by executing the command sudo apt-get install -f This command will install the requested dependencies, including those that the dpkg tool has specified. Installing "Tasks" programs through Taskkel It is possible to install a wide range of related programs by using tasks. Tasks - simply - are groups of packages that process a particular environment when they are installed together. Examples of these tasks include: LAMP server (Web development environment), desktop environment, application server. Some systems may have an existing tasksel package by default. To obtain them, you can perform: sudo apt-get update sudo apt-get install tasksel You can also choose different task packs by: sudo tasksel This command will display an interface that allows you to select different package groups and apply the changes. You can review the list of available tasks and their status (in terms of installation) by executing the command: taskel --list-task Finally, you can install tasks from the command line by executing: sudo taskel install task_name In the next section, we will continue with the basics of package management in Ubuntu and Debian .
👍 aser1111, polbot, moby-dick, sensation, logan6230, valdemar1991, jakubgrab, jhendrych, hipolitc, klimekaczma, nicestbot, pferdynand, ikalinowski, fryderykn, kaczmareke, cwitosaw, backbonewriter, upperhonorable, lemonydietary, cankermouthed, rubydetails, beamarete, taigacabinet, pinchtedious, hooveshydra, gravityenteral, pursercomet, upperhostler, publicchord, unicodedemi, warnmembrane, imperfectvital, warblingunchin, portionvolume, scorpiusdata, filmsdormant, wigeonfeatures, stressedboiler, appleabsurd, evasivepike, ruralcapsule, berwynelbow, benrest, islandlimit, cupswavy, hearttoasting, amuseaccuracy, filkreserved, luffnoisy, dusterdeciles, ceriumenable, followmutable, bowlinediamox, whirrhomerun, cloudtickets, ropessecond, dearshy, slavic, bomit555, serdgstan, profess, slowtrain, neata, membraniks, radionchirkasch, sfinks1987, ddrake22, saberellofv411, balbez, vaziliza, denis098, varwar, larisa2017, van0, karmian, crypyk, cherk, bogdan7, aivan88, lookfine, zynlord, xmaster, cymchik, dvduha, smalldragon, jack.rock.hammer, bingo.bongo, vityk, misha45, freezee, grandcan, drumandtrance, hacke20, ivanovichivan, dfcz13, apilot, chilly-willy, tryagain8, popovichartpow, typ, casidas, lunagata, blackrzn, vinnik8842, banenzo, maxkondratyk, igorageeww, lightseeker666, kissmesweet, geekov, ukr.net, timurr, aristotel, pandarian, exodusmyroom, crypto-currency, wenzip, nikopu, emil258, missnadeen, czciborj, kosheliuk, ushkurwike, tolya1966, vagabond66, lapaxcp, dunot9, kavalerios, yliyivanova84, khalib, gennadiy74, margosha.st18, remiz, lovepiplle, hardtofind, institution, aserov25121978, ivashov, frikfrik, businessblog, willam23, genifer, tashafilip, smilecaptain, chainclan, farango, maxroyonline, zizu, pilly, bonusdan, antrikdjoin, kit-kat, nikolay178, volvofmx, maikl18, zenykmxm, whisperinthedark, vik567, matillda, dementei, maikl960, petrenkosashka, andrei8, missvega, shavgen111, appreciator, grandpawhale, alphacore, romancereviews, mxzn, intuitivejakob, tesaganewton, bigdeej, timmylace, jonbit, irfanullah, zoltarian, renzoarg, onealfa, coolenglish, detlev, dexter-k, plainoldme, youareyourowngod, shadowbot, popovicsjodie, nickfost, harleymechanix, arunava, staticinstance, duckmast3r, frank.william, sam99, omar-hesham, sonu, sanmi, brandonh, zonguin, ksolymosi, anjana77, embomb701, zord189, retinox, madstacks, kiraxoy, acwood, politi-frantici, herrleger,