What is package manager in linux

Альманах пакетных менеджеров Linux

Иногда может возникнуть вопрос: чьих этот файл, откуда вообще взялась эта библиотека? Удобный менеджер пакетов решает очень многие проблемы ОС. Можно с уверенностью сказать, что если вы подружитесь с МП, то подружитесь и с дистрибутивом как таковым. Причем важно освоить именно набор основных команд, и знать где найти дополнительную информацию.

Далее следует джентльменский набор необходимых для повседневной рутины команд основных Linux дистрибутивов: установить, обновить и удалить пакет, накатить обновления, проверить зависимости, установить принадлежность файла пакету и пр.

Debian и родственные

Популярность и образ дружественного к пользователю Linux дистрибутива сыграли с Ubuntu злую шутку. Некоторым новичкам кажется, что можно на нем делать все, что угодно без помощи командной строки. Это заблуждение и лучше от него поскорее избавиться.

То, что в примерах aptitude не значит, что он правильнее, чем apt-get . Для меня это всего лишь дело привычки.

Некоторые функции доступны с дополнительным МП dpkg .

Есть еще такое чудо — wajig. Несмотря на странное звучание, вполне годный МП с человеко-читабельным выводом информации на экран.

Настройка репозиториев производится правкой файла /etc/apt/sources.list

В целом ПМ Debian один из лучших, с которыми мне доводилось иметь дело.

Redhat и другие RPM дистрибутивы

RPM нельзя назвать образцовым пакетным менеджером, скорее это был кактус, который мыши употребляли в пищу со слезами на глазах. Затем появились более или менее вменяемые МП: yum , dnf , zypper и другие. Только что на сервере RHEL 7.4 yum за раз обновил более 700 пакетов и ничего при этом не сломал, неплохой результат я считаю.

Команды rpm на те случаи, когда использовать yum не с руки.

Чтобы настроить репозитории Yum , откройте файл /etc/yum.repos.d/*.repo , или используйте команду yum-config-manager .

Zypper

На SuSE Linux используется Zypper / YaST для управления пакетами, движок ZYpp крутится поверх RPM.

Можно использовать операторы и регулярные выражения.

Управление репозиториями производится командой zypper mr .

Pacman

Этот МП используется в Арче и Manjaro.

Движок поиска в базе данных поддерживает регулярные выражения.

Настройка репозиториев и зеркал производится из файла /etc/pacman.conf

Gentoo emerge

Конечно же это скорее умозрительный сценарий, чем реальный, так как сложно предположить, что красноглазый пользователь Gentoo Linux не знает необходимых опций emerge . Тем не менее, без этого альманах был бы неполным.

С дополнительными утилитами можно получить больше информации о файлах, ненужных пакетах и т. д.

Источник

Linux package managers: Learning apt and yum

If you are coming from the desktop side of computing, especially from Windows, then the notion of package management may seem a little odd to you. However, it is easy to understand the functionality and the advantages of using Linux package managers.

On the server side of computing, or on Linux in genreal, your applications run on top of layers of other software. A simple blog built using WordPress may depend on an Apache web server, PHP modules, and a MySQL database. These packages themselves depend on lower-level libraries. As these are independent projects, if there’s an update released for Apache web server, there’s no guarantee that, say, MySQL will work perfectly with the newer version.

To make matters worse, even the base operating system is constantly evolving and receiving updates that might be crucial but can potentially break the applications running on top of it. To solve these, and many other complications, we are going to familiarize ourselves with package managers.

Get 480GB NVMe extra storage for FREE
Celebrating our 9 year anniversary! Capacity is limited and some deals will sell out. Get yours before they are gone!

What are Package managers?

  • Package managers are responsible for making sure you don’t get drowned in a complex list of inter-dependent software that you require for your application to run. They perform the following tasks.
  • Keep a list of trusted remote repositories from where the packages can be downloaded and installed.
  • Maintain a local index of all the available and installed packages.
  • Keep track of what packages are needed as dependencies for a particular package.
  • Perform package installations including bringing in the dependencies, adding binaries to PATH and making system-wide changes.
  • Update packages when a newer version comes in the remote repository.

So let’s get started with the two package managers that you are most likely to cross paths with, namely apt and yum .

Note: If you are planning on using Ubuntu or Debian, follow the apt package manager section. On the other hand, if you use CentOS you can skip ahead to yum package manager instead.

What’s the BEST DEAL in cloud hosting?

Develop at hyperspeed with a Performance VPS from SSD Nodes. We DOUBLED the amount of blazing-fast NVMe storage on our most popular plan and beefed up the CPU offering on these plans. There’s nothing else like it on the market, at least not at these prices.

Читайте также:  Corsair ssd toolbox windows 10

Score a 16GB Performance VPS with 160GB of NVMe storage for just $99/year for a limited time!

APT package manager

Advanced Packaging Tool (or APT) is the defacto package manager for many variants of Debian and Ubuntu operating systems. It installs packages system-wide and therefore requires root privileges to carry out the task. That’s why most commands below begin with sudo . If you are already logged in as the root user, you may skip the sudo part of the command.

Install a package

To install a package named PACKAGE_NAME , all you need to do is run:

Or you can use a shorter command:

What happens here is that the apt-get utility consults a local index of package names sees a match for PACKAGE_NAME and gets the package and necessary dependencies for it from a list of trusted URLs. It then installs the package and its dependencies and makes a note about these newer additions that are made to the system.

The command may nag you to confirm that you want to install the package, by entering y or yes if you want to avoid that, use the -y flag.

You can also use the -qq flag which updates the system without printing anything to the terminal. This is useful when you are writing shell scripts to automate any apt related task.

Install packages from your filesystem

Debian and Ubuntu packages typically come as files with .deb extension. If you have one of these in your local filesystem you can install it by first traversing to the directory where the file is located and then running:

dpkg is the utility that is responsible for the actual installation and configuration in the backend. apt interfaces with it every time it needs to modify the local installation of packages.

Upgrade installed packages

Once you have your VPS up and running, the most common task is going to involve checking if the package maintainers have released a new version of a package or if there are minor patches and fixes available for ones you currently have installed on your system.

Running the command sudo apt-get update updates the local index of packages and brings it up to speed with the remote sources from where the packages come. For example, if you are using Python 3.5 on your Ubuntu 16.04 system and the people who are responsible for testing the stability of Python 3.6 on Ubuntu 16.04 confirm that this newer version works perfectly, they will make it a part of the official repo.

To install the updates, you will have to run the following:

Together, the apt-get update and apt-get upgrade command can bring your system up to speed with the latest release of all the available packages. It is customary to run these on any new VPS before you start working with it.

List all available updates

If you are worried that the updates might mess up your pristine server you can issue the apt-get update and follow it with:

This would list all the installed packages that would get updated the next time you run apt-get upgrade . Notice, that this one uses apt and not apt-get .

Remove packages

To remove an installed package, just run:

To remove a package along with config files and other modifications, add a —purge flag.

It is likely that despite removing a package, there might still be other dependencies left over in the system. Apt-get command installed these dependencies as they were needed for the main package that you have now removed, and they are no longer needed. To remove them, run:

Search packages

If you are unsure about what package you need, you can search for it in the local index.

This might result in a long list of results. Most of which might not even be related to what you are looking for, but could be an additional plugin for it with just the KEYWORD mentioned in its description. To narrow the search down to only the names of the available packages use the -n flag.

Now the search result will be much more manageable.

Listing the dependencies

To list all the dependencies that a package may bring along with it, use the command:

To list all the reverse dependencies, that is to say, to list all the packages that depend on one particular package, use the command:

Add another repository

Sometimes the official repositories maintained by Debian or Ubuntu are far behind from what the package vendor can offer. In these cases, vendors offer their packages which you can add to the list of sources.

Usually, although not always, you begin by adding the cryptographic keys that the vendor has provided (generally as a URL):

To add a repository, use the command:

The REPO_URL part is formatted differently for different vendors. Some use PPA (Personal Package Archive) which is an Ubuntu-specific way for allowing vendors to build and publish apt packages. Also, there are fields with the codename for the OS version (trusty, xenial, bionic) and what kind of support the package receives (main, restricted, universe and multiverse). These are not the details that you have to worry about, for now, just know that they might be a part of various installation procedures and official docs.

The next time you run apt-get update apt will index the packages made available by this newer repo after which you are free to install them.

Apt, Apt-get and Apt-cache

Commands which involve apt-get typically involve querying remote repositories and fetching data from them, whereas, apt-cache related commands refer to the local index of packages. If you have trouble remembering which one is used where you can use apt instead. It’s shorter to type, and it unifies both the apt-get and apt-cache into a single command.

Читайте также:  Windows server 2012 r2 foundation windows server 2012 r2 foundation

YUM package manager

The Red Hat family of Linux uses a different package manager, but it works similarly.

Install packages

To install any package, use the command:

Install packages from your filesystem

Packages for CentOS, Red Hat, and Fedora family of operating systems have an extension of .rpm . If an .rpm file is present on your server that you wish to install, you can traverse to the directory where the file lives and run:

Alternatively, you can use yum localinstall /PATH/TO/FILE to tell yum where the file is located.

Check for Updates

To check for the updates available for the installed packages, use the command:

Update installed packages

To update all the installed packages, run:

Of course, it’s recommended that you check for the updates before installing them. You can also use the -y flag so you won’t be prompted to say yes as the installation progresses, or you can use the —quiet flag which prints no output and runs the update quietly in the background. The latter is useful if you are writing scripts to automate certain tasks. These flags work similarly for all the yum commands.

An alternative to update is the command yum update-minimal which only updates your packages from one revision to another. Which is handy in case there’s a bug fix that you need to apply. But it defers the feature updates where complete rework of packages may take place breaking the software running on your system in unexpected ways.

Remove packages

To remove a given package from your system, run:

This would get rid of the specified package from your system. To get rid of the dependencies that were installed along with PACKAGE_NAME , which are no longer required, run:

Searching for packages

To install a package, you first need to know its proper name as it appears in the package index. The yum search utility can help you narrow your search down:

It searches the package index and displays results where KEYWORD has appeared in the name or summary of the package description. To do a more thorough search you can use:

Listing all the Dependencies

To list all the dependencies that were (or will be) installed along with a specified package use the command:

Add another repository

To add repositories which are not included by default in the system, you can use a utility yum-config-manager . However, there’s a chance that this might not be available out of the box, either! You can install it by running:

After the installation finishes, adding new repositories is as easy as running:

You can now install the packages available in this new repository.

Источник

5 Best Linux Package Managers for Linux Newbies

One thing a new Linux user will get to know as he/she progresses in using it is the existence of several Linux distributions and the different ways they manage packages.

Package management is very important in Linux, and knowing how to use multiple package managers can proof life saving for a power user, since downloading or installing software from repositories, plus updating, handling dependencies and uninstalling software is very vital and a critical section in Linux system Administration.

Best Linux Package Managers

Therefore to become a Linux power user, it is significant to understand how the major Linux distributions actually handle packages and in this article, we shall take a look at some of the best package managers you can find in Linux.

Here, our main focus is on relevant information about some of the best package managers, but not how to use them, that is left to you to discover more. But I will provide meaningful links that point out usage guides and many more.

1. DPKG – Debian Package Management System

Dpkg is a base package management system for the Debian Linux family, it is used to install, remove, store and provide information about .deb packages.

It is a low-level tool and there are front-end tools that help users to obtain packages from remote repositories and/or handle complex package relations and these include:

APT (Advanced Packaging Tool)

It is a very popular, free, powerful and more so, useful command line package management system that is a front end for dpkg package management system.

Users of Debian or its derivatives such as Ubuntu and Linux Mint should be familiar with this package management tool.

To understand how it actually works, you can go over these how to guides:

Aptitude Package Manager

This is also a popular command line front-end package management tool for Debian Linux family, it works similar to APT and there have been a lot of comparisons between the two, but above all, testing out both can make you understand which one actually works better.

It was initially built for Debian and its derivatives but now its functionality stretches to RHEL family as well. You can refer to this guide for more understanding of APT and Aptitude:

Synaptic Package Manager

Synaptic is a GUI package management tool for APT based on GTK+ and it works fine for users who may not want to get their hands dirty on a command line. It implements the same features as apt-get command line tool.

2. RPM (Red Hat Package Manager)

This is the Linux Standard Base packing format and a base package management system created by RedHat. Being the underlying system, there several front-end package management tools that you can use with it and but we shall only look at the best and that is:

Читайте также:  Ошибка 22 windows не имеет конструктора линия 388

YUM (Yellowdog Updater, Modified)

It is an open source and popular command line package manager that works as a interface for users to RPM. You can compare it to APT under Debian Linux systems, it incorporates the common functionalities that APT has. You can get a clear understanding of YUM with examples from this how to guide:

DNF – Dandified Yum

It is also a package manager for the RPM-based distributions, introduced in Fedora 18 and it is the next generation of version of YUM.

If you have been using Fedora 22 onwards, you must have realized that it is the default package manager. Here are some links that will provide you more information about DNF and how to use it:

3. Pacman Package Manager – Arch Linux

It is a popular and powerful yet simple package manager for Arch Linux and some little known Linux distributions, it provides some of the fundamental functionalities that other common package managers provide including installing, automatic dependency resolution, upgrading, uninstalling and also downgrading software.

But most effectively, it is built to be simple for easy package management by Arch users. You can read this Pacman overview which explains into details some of its functions mentioned above.

4. Zypper Package Manager – openSUSE

It is a command line package manager on OpenSUSE Linux and makes use of the libzypp library, its common functionalities include repository access, package installation, resolution of dependencies issues and many more.

Importantly, it can also handle repository extensions such as patterns, patches, and products. New OpenSUSE user can refer to this following guide to master it.

5. Portage Package Manager – Gentoo

It is a package manager for Gentoo, a less popular Linux distribution as of now, but this won’t limit it as one of the best package managers in Linux.

The main aim of the Portage project is to make a simple and trouble free package management system to include functionalities such as backwards compatibility, automation plus many more.

For better understanding, try reading Portage project page.

Concluding Remarks

As I already hinted at the beginning, the main purpose of this guide was to provide Linux users a list of the best package managers but knowing how to use them can be done by following the necessary links provided and trying to test them out.

Users of the different Linux distributions will have to learn more on their own to better understand the different package managers mentioned above.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

5 thoughts on “5 Best Linux Package Managers for Linux Newbies”

I agree with @dragonmouth Newbies are very scary about terminal and command line (including myself at the beginning). Imagine users used to a perfect graphical interface and switch to one window and just one line that says [[email protected]]

$: that is scary right? that means newbies want a gui! want a graphical interface, not a command-line tool.

I wish Linux writers write that way “Linux is easy to learn even for those who not like it, and not like terminal! ” In this way, I am sure newbies won’t switch back to their previous OS…

sorry for the bad English. It’s not my native language.

Thank you so much for the great topic.

“5 Best Linux Package Managers for Linux NEWBIES” (emphases mine)

The article is an epic, total FAIL.

Linux newbies need (require) applications that they can understand and are intuitive, which means GUI. Of the Package Managers mentioned only Synaptic fits that description. All the other PMs are command-line applications. They use esoteric, byzantine, absolutely non-intuitive commands.

Don’t get me wrong. I am NOT putting down the command line or command-line applications. There are very powerful and useful but not to NEWBIES. To NEWBIES, they are scary, confusing, overwhelming, and off-putting. Declaring that these are the “best” package managers for NEWBIES is the same as declaring that a jumbo jet is the “best” plane to use to learn how to fly. It can be done but how many people will quit along the way discouraged?

Maybe if tech writers emphasized the ease of use of Linux GUI applications for those switching from other O/Ss instead of emphasizing and glorifying the command line, more people would switch to Linux. Even though Windows and OS/X both have a command line, none of the ads for those O/Ss ever mentions that. There are relatively few articles about Windows Power Shell and even fewer about the OS/X command line. At the same time, a majority of Linux articles are on how to use the command line. It is ironic that those that know Linux best and could/should spread its use are the very ones that are driving users from trying it.

Worse than that, why do you compare low-level and high-level managers altogether? This is just unacceptable.

Why are they the best, how do you score them? Wouldn’t that be less confusing to new Linux admins to understand what is important?

For example, a pretty important aspect is conflict management, since this is a common cause of system breakage.

Got something to say? Join the discussion. Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Источник

Оцените статью