- How to List Files Installed From a RPM or DEB Package in Linux
- How to List All Files of Installed Package in Linux
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- Discover to which package a file belongs to
- Related Packages and Files
- CentOS, Fedora, RHEL
- Show files for RPM packages
- Show files for packages on the repository
- Show files per installed package
- Debian and Ubuntu
- Discover related package
- Show files installed by package
- Gentoo
- OpenSUSE
- Show related package
- Continue reading
- Troubleshooting a full /boot partition on Ubuntu
- Show vulnerable packages on Arch Linux with arch-audit
- Linux security guide: the extended version
- How to solve an expired key (KEYEXPIRED) with apt
- 4 comments
- Leave a Reply Cancel reply
- About Linux Audit
- Linux and UNIX security automation
- Recent Posts
- Contact
- Установка rpm пакетов в Linux
- Что такое RPM?
- Установка RPM пакетов в Linux
- Установка RPM файла в GUI
- Выводы
How to List Files Installed From a RPM or DEB Package in Linux
Have you ever wondered where the various files contained inside a package are installed (located) in the Linux file system? In this article, we’ll show how to list all files installed from or present in a certain package or group of packages in Linux.
This can help you to easily locate important package files like configurations files, documentation and more. Let’s look at the different methods of listing files in or installed from a package:
How to List All Files of Installed Package in Linux
You can use the repoquery command which is part of the yum-utils to list files installed on a CentOS/RHEL system from a given package.
To install and use yum-utils, run the commands below:
Now you can list files of an installed RPM package, for example httpd web server (note that the package name is case-sensitive). The —installed flag means installed packages and -l flags enables listing of files:
Repoquery List Installed Files of Httpd
Important: In Fedora 22+ version, the repoquery command is integrated with dnf package manager for RPM based distribution to list files installed from a package as shown above.
Alternatively, you can as well use the rpm command below to list the files inside or installed on the system from a .rpm package as follows, where the -g and -l means to list files in package receptively:
RPM Query Package for Installed Files
Another useful option is used to use -p to list .rpm package files before installing it.
On Debian/Ubuntu distributions, you can use the dpkg command with the -L flag to list files installed to your Debian system or its derivatives, from a given .deb package.
In this example, we will list files installed from apache2 web server:
dpkg List Installed Packages
Don’t forget to check out following useful articles for package management in Linux.
That’s all! In this article, we showed you how to list/locate all files installed from a given package or group of packages in Linux. Share your thoughts with us using the feedback form below.
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.
Источник
Discover to which package a file belongs to
Related Packages and Files
Sometimes you want to know the related package of a file, before installation, or when it is already there. This is of great help during system hardening or general system cleanups. In this article we have a look at several ways to determine the relationships between files and the package they belong to. We have gathered this information for multiple Linux distributions.
CentOS, Fedora, RHEL
Show files for RPM packages
Show files for packages on the repository
If you use dnf, then you can query files from the packages that are in your repositories. The package itself does not have to be installed.
Use the -q option with dnf to show only the relevant output.
Show files per installed package
To show what files are in a package, use the rpm command.
If you have the file name, you can turn this around and find the related package.
The output will provide the package and its version.
To just see the package name, use the –queryformat option.
With yum you can do a similar request to see the related package.
And with DNF there is the provides argument.
This will give you possibly multiple hits, as a file can be part of packages from different repositories.
This data is less easy to parse due to the different types of lines.
Debian and Ubuntu
Discover related package
If you want to find the related package of a binary (or file), we first have to know the full path. If you know the binary, then use the which command to discover where it is stored. Using the find command is another option, but may be less efficient. With the dpkg package management tool we can find the related package.
Without the awk command, the output will look like this.
Show files installed by package
If you already know the package name, you can quickly look up the files that are installed by a Debian package.
Let’s do the same for the at package and see what it exactly installs (and where).
Gentoo
The first option is using equery, which is part of the package app-portage/gentoolkit.
The package itself should be installed.
Next alternative is qlist, which is part of app-portage/portage-utils
OpenSUSE
Systems running the distributions from SuSE can use the zypper tool to find the link between a file and a package.
Show related package
Got more useful commands to share? Let it know in the comments and we add them to the article.
Keep learning
So you are interested in Linux security? Join the Linux Security Expert training program, a practical and lab-based training ground. For those who want to become (or stay) a Linux security expert.
Run automated security scans and increase your defenses. Lynis is an open source security tool to perform in-depth audits. It helps with system hardening, vulnerability discovery, and compliance.
Continue reading
Troubleshooting a full /boot partition on Ubuntu
Show vulnerable packages on Arch Linux with arch-audit
Linux security guide: the extended version
How to solve an expired key (KEYEXPIRED) with apt
4 comments
Example for Arch Linux:
$ pacman -Qo /usr/bin/ls
/usr/bin/ls is owned by coreutils 8.26-1
Thanks for sharing Frank
Hey, place a like button somewhere in your blog pages!.
Those like buttons can leak information to Facebook and Twitter, so that is why there are none 🙂
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
About Linux Audit
This blog is part of our mission: help individuals and companies, to scan and secure their systems. We simply love Linux security, system hardening, and questions regarding compliance.
Besides the blog, we have our security auditing tool Lynis. Open source, GPL, and free to use.
For those with enterprise needs, or want to audit multiple systems, there is an Enterprise version.
«One security solution to audit, harden, and secure your Linux/UNIX systems.»
Benefits:
- Perform audits within a few minutes
- Central management
- Powerful reporting
- Compliance checks (e.g. PCI DSS)
- Additional plugins and more tests
Enjoy the articles!
Linux and UNIX security automation
Lynis is a free and open source security scanner. It helps with testing the defenses of your Linux, macOS, and Unix systems. Typical use-cases for this software include system hardening, vulnerability scanning, and checking compliance with security standards (PCI-DSS, ISO27001, etc).
Recent Posts
Contact
This blog is part of our mission to share valuable tips about Linux security. We are reachable via @linuxaudit
Company details
CISOfy
De Klok 28,
5251 DN, Vlijmen, The Netherlands
+31-20-2260055
Источник
Установка rpm пакетов в Linux
Рано или поздно нам приходится устанавливать программное обеспечение не из официальных репозиториев. Там есть далеко не все пакеты, и не всегда есть самые новые версии, только что вышедших программ. Очень часто разработчики размещают на своем официальном сайте пакеты для самых популярных дистрибутивов. Обычно это deb и rpm.
Последний встречается немного реже, но если вы используете дистрибутив на базе Red Hat Enterprice Linux, вам нужен именно этот формат пакетов. Также в сети часто можно найти библиотеки и другие компоненты, которых нет в репозиториях в виде пакетов. Раньше мы уже рассматривали установку deb пакетов в Ubuntu. А в этой статье будет подробно разобрана установка rpm пакетов в linux.
Что такое RPM?
RPM или RPM Package Manager — это пакетный менеджер, используемый в дистрибутивах Linux, основанных на Red Hat. Такое же название имеет формат файлов этого пакетного менеджера.
Этот формат не очень сильно отличается от того же самого Deb. Вы можете посмотреть их детальное сравнение в статье что лучше *.deb или *.rpm. Здесь же, только отмечу, что файл rpm — это обычный cpio архив, в котором содержатся сами файлы программы, а также метаданные, описывающие куда их нужно устанавливать. База всех установленных пакетов находится в каталоге /var/lib/rpm. Из особенностей можно отметить, что rpm не поддерживает рекомендованные пакеты, а также зависимости формата или-или.
Для управления пакетами, так же как и в Debian-системах, здесь существует консольная, низкоуровневая утилита с одноименным названием — rpm. Ее мы и будем рассматривать дальше в статье. В разных системах используются разные пакетные менеджеры, например в Red Hat используется Yum, в Fedora — DNF, а в OpenSUSE — zypper, но во всех этих системах будет работать утилита rpm.
Установка RPM пакетов в Linux
Давайте сначала рассмотрим синтаксис самой утилиты rpm:
$ rpm -режим опции пакет
Утилита может работать в одном из режимов:
- -q, —query — запрос, получение информации;
- -i, —install — установка;
- -V, —verify — проверка пакетов;
- -U, —upgrade — обновление;
- -e, —erase — удаление.
Рассмотрим только самые интересные опции программы, которые понадобятся нам в этой статье:
- -v — показать подробную информацию;
- —vv — выводить отладочную информацию;
- —quiet — выводить как можно меньше информации;
- -h — выводить статус-бар;
- —percent — выводить информацию в процентах о процессе распаковки;
- —force — выполнять действие принудительно;
- —nodeps — не проверять зависимости;
- —replacefiles — заменять все старые файлы на новые без предупреждений;
- -i — получить информацию о пакете;
- -l — список файлов пакета;
- -R — вывести пакеты, от которых зависит этот пакет;
Теперь, когда вы уже имеете представление как работать с этой утилитой, может быть рассмотрена установка rpm пакета в Linux. Самая простая команда установки будет выглядеть вот так:
sudo rpm -i имя_пакета.rpm
Для работы с командной текущей директорией должна быть папка с пакетом. Здесь мы устанавливаем режим установки и передаем файл пакета. При успешной установке утилита не выведет ничего, если произойдет ошибка, вы об этом узнаете.
Для того чтобы посмотреть более подробную информацию в процессе установки используйте опцию -v:
sudo rpm -iv имя_пакета.rpm
Также вы можете включить отображение статус бара в процессе установки:
sudo rpm -ivh имя_пакета.rpm
Чтобы проверить установлен ли пакет, нам уже нужно использовать режим запроса:
sudo rpm -q имя_пакета
Также сразу можно удалить пакет, если он не нужен:
sudo rpm -e имя_пакета
Но у rpm так же как и у dpkg, есть один существенный недостаток. Программа не может разрешать зависимости. В случае отсутствия нужного пакета в системе, вы просто получите сообщение об ошибке и пакет не установится.
Для автоматической загрузки зависимостей во время выполнения установки rpm linux нужно использовать пакетный менеджер дистрибутива. Рассмотрим несколько команд для самых популярных RPM дистрибутивов. В RedHat и других дистрибутивах, использующих Yum используйте такую команду:
sudo yum —nogpgcheck localinstall имя_пакета.rpm
Первая опция отключает проверку GPG ключа, а вторая говорит, что мы будем выполнять установку локального пакета. В Fedora, с помощью dnf все делается еще проще:
sudo dnf install имя_пакета.rpm
Пакетный менеджер Zypper и OpenSUSE справляются не хуже:
sudo zypper install имя_пакета.rpm
Вот так очень просто выполняется установка rpm с зависимостями. Но не всем нравится работать в консоли, многие новые пользователи хотят использовать графический интерфейс для решения всех задач, в том числе и этой. Дальше мы рассмотрим несколько таких утилит.
Установка RPM файла в GUI
Если вы используете OpenSUSE, то это делается очень просто. Универсальный конфигуратор системы YaST, кроме всего прочего позволяет установить rpm пакеты. Вы можете сделать это с помощью файлового менеджера, выбрав пункт контекстного меню для файла открыть с помощью Yast или выполнив команду:
yast2 -i имя_пакета.rpm
В Fedora для тех же целей вы можете использовать менеджер приложений дистрибутива. Раньше было еще несколько универсальных утилит для решения этой задачи, но сейчас они уже все устарели.
Выводы
Теперь вы знаете как выполняется установка rpm файла в Linux. На самом деле это очень просто и даже существует не только один способ, а целых несколько. Хотя графических утилит здесь немного меньше чем в Ubuntu. Но консольных утилит полностью хватает. Если у вас остались вопросы, спрашивайте в комментариях!
Источник