Check RPM dependencies - linux

When you are installing a program using .deb packages on Ubuntu, you can check dependencies of package using Ubuntu Packages Search. For example I can see dependencies of Wireshark from here. As you can see, dependencies marked by red bullet. If you know all packages your program depends them, you can download and install them using dpkg.
Is there any alternative website for RPM packages? Specially for RHEL?
I know that I can get these packages' names by other methods such as when installing RPM package using rpm -i, but it is not user friendly and needs access to running Linux.

In fact that's not a one but four different questions :).
*) First you can quickly list a downloaded package's dependencies/requirements by using the following commands:
$ rpm -qp mypackage.rpm --provides
$ rpm -qp mypackage.rpm --requires
*) Second, you can use yum utility in order to satisfy these (somewhat cryptic) dependencies automatically (assuming that all your repositories are set up correctly, and all the dependencies are available):
$ sudo yum install mypackage.rpm
*) Third, there are several RPM search resources, some of them already suggested above. I'd like to list another one, just for the reference - pkgs.org.
*) Fourth, there is an additional popular repository for RHEL5 and RHEL6 distros - EPEL. Note that it's not supported by Red Hat.
Hope my answer(s) will help.

To merely list all dependencies of a package on the command-line, here is an example which builds upon the answer by Peter:
$ PKG="http://yum.postgresql.org/9.3/redhat/rhel-6.2-x86_64/pgdg-sl93-9.3-1.noarch.rpm"
Using yum (recommended):
$ yum -q deplist $PKG
package: pgdg-sl93.noarch 9.3-1
dependency: sl-release
Unsatisfied dependency
dependency: /bin/sh
provider: bash.x86_64 4.1.2-8.el6
dependency: config(pgdg-sl93) = 9.3-1
provider: pgdg-sl93.noarch 9.3-1
-q above is of course optional and is equivalent to --quiet.
Using rpm:
$ rpm -qpR $PKG
/bin/sh
config(pgdg-sl93) = 9.3-1
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
sl-release
-qpR above is equivalent to --query --package --requires.

This site http://www.rpmfind.net/linux/RPM/ provides a search engine for rpm files. You can see dependencies and description. It also classifies them per distro.

Related

How to compile a C file with an OpenSSL dependency? [duplicate]

I'm trying to build some code on Ubuntu 10.04 LTS that uses OpenSSL 1.0.0. When I run make, it invokes g++ with the "-lssl" option. The source includes:
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/des.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
I ran:
$ sudo apt-get install openssl
Reading package lists... Done
Building dependency tree
Reading state information... Done
openssl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
But I guess the openssl package doesn't include the library. I get these errors on make:
foo.cpp:21:25: error: openssl/bio.h: No such file or directory
foo.cpp:22:28: error: openssl/buffer.h: No such file or directory
foo.cpp:23:25: error: openssl/des.h: No such file or directory
foo.cpp:24:25: error: openssl/evp.h: No such file or directory
foo.cpp:25:25: error: openssl/pem.h: No such file or directory
foo.cpp:26:25: error: openssl/rsa.h: No such file or directory
How do I install the OpenSSL C++ library on Ubuntu 10.04 LTS?
I did a man g++ and (under "Options for Linking") for the -l option it states: " The linker searches a standard list of directories for the library..." and "The directories searched include several standard system directories..." What are those standard system directories?
You want to install the development package, which is libssl-dev:
sudo apt-get install libssl-dev
Run:
apt-get install libssl-dev
All of these answers are very outdated and from when the package was still being developed. You can now just use the "normal" command listed below:
sudo apt install openssl
Edit: OP's question is poorly worded... after all, OpenSSL is a library itself, so I read his question too quickly before answering. The command above installs "normal" OpenSSL.
Toward the bottom of his question he mentions that make fails, suggesting he is compiling the package manually. And yes, even if you download the TAR ball, it will include all of the openssl and libssl files, which you can then make from.
What OP is really asking for is the OpenSSL Development Library, in which case you can first install OpenSSL using the above command, and then run this afterwards:
sudo apt install libssl-dev
More info: https://linuxtect.com/how-to-install-openssl-libraries-on-ubuntu-debian-mint/
I found a detailed solution here: Install OpenSSL Manually On Linux
From the blog post...:
Steps to download, compile, and install are as follows (I'm installing version 1.0.1g below; please replace "1.0.1g" with your version number):
Step – 1 : Downloading OpenSSL:
Run the command as below :
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz
Also, download the MD5 hash to verify the integrity of the downloaded file for just varifacation purpose. In the same folder where you have downloaded the OpenSSL file from the website :
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz.md5
$ md5sum openssl-1.0.1g.tar.gz
$ cat openssl-1.0.1g.tar.gz.md5
Step – 2 : Extract files from the downloaded package:
$ tar -xvzf openssl-1.0.1g.tar.gz
Now, enter the directory where the package is extracted like here is openssl-1.0.1g
$ cd openssl-1.0.1g
Step – 3 : Configuration OpenSSL
Run below command with optional condition to set prefix and directory where you want to copy files and folder.
$ ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
You can replace “/usr/local/openssl” with the directory path where you want to copy the files and folders. But make sure while doing this steps check for any error message on terminal.
Step – 4 : Compiling OpenSSL
To compile openssl you will need to run 2 command : make, make install as below :
$ make
Note: check for any error message for verification purpose.
Step -5 : Installing OpenSSL:
$ sudo make install
Or without sudo,
$ make install
That’s it. OpenSSL has been successfully installed. You can run the version command to see if it worked or not as below :
$ /usr/local/openssl/bin/openssl version
OpenSSL 1.0.1g 7 Apr 2014
How could I have figured that out for
myself (other than asking this
question here)? Can I somehow tell
apt-get to list all packages, and grep
for ssl? Or do I need to know the
"lib*-dev" naming convention?
If you're linking with -lfoo then the library is likely libfoo.so. The library itself is probably part of the libfoo package, and the headers are in the libfoo-dev package as you've discovered.
Some people use the GUI "synaptic" app (sudo synaptic) to (locate and) install packages, but I prefer to use the command line. One thing that makes it easier to find the right package from the command line is the fact that apt-get supports bash completion.
Try typing sudo apt-get install libssl and then hit tab to see a list of matching package names (which can help when you need to select the correct version of a package that has multiple versions or other variations available).
Bash completion is actually very useful... for example, you can also get a list of commands that apt-get supports by typing sudo apt-get and then hitting tab.
Another way to install openssl library from source code on Ubuntu, follows steps below, here WORKDIR is your working directory:
sudo apt-get install pkg-config
cd WORKDIR
git clone https://github.com/openssl/openssl.git
cd openssl
./config
make
sudo make install
# Open file /etc/ld.so.conf, add a new line: "/usr/local/lib" at EOF
sudo ldconfig
You want the openssl-devel package.
At least I think it's -devel on Ubuntu. Might be -dev. It's one of the two.
As a general rule, when on Debian or Ubuntu and you're missing a development file (or any other file for that matter), use apt-file to figure out which package provides that file:
~ apt-file search openssl/bio.h
android-libboringssl-dev: /usr/include/android/openssl/bio.h
libssl-dev: /usr/include/openssl/bio.h
libwolfssl-dev: /usr/include/cyassl/openssl/bio.h
libwolfssl-dev: /usr/include/wolfssl/openssl/bio.h
A quick glance at each of the packages that are returned by the command, using apt show will tell you which among the packages is the one you're looking for:
~ apt show libssl-dev
Package: libssl-dev
Version: 1.1.1d-2
Priority: optional
Section: libdevel
Source: openssl
Maintainer: Debian OpenSSL Team <pkg-openssl-devel#lists.alioth.debian.org>
Installed-Size: 8,095 kB
Depends: libssl1.1 (= 1.1.1d-2)
Suggests: libssl-doc
Conflicts: libssl1.0-dev
Homepage: https://www.openssl.org/
Tag: devel::lang:c, devel::library, implemented-in::TODO, implemented-in::c,
protocol::ssl, role::devel-lib, security::cryptography
Download-Size: 1,797 kB
APT-Sources: http://ftp.fr.debian.org/debian unstable/main amd64 Packages
Description: Secure Sockets Layer toolkit - development files
This package is part of the OpenSSL project's implementation of the SSL
and TLS cryptographic protocols for secure communication over the
Internet.
.
It contains development libraries, header files, and manpages for libssl
and libcrypto.
N: There is 1 additional record. Please use the '-a' switch to see it
Go to the official website and download the source code for the version you need
Then unzip the update package and execute the following command
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl -Wl,-rpath,/usr/local/ssl/lib shared
Because the default is to generate only static libraries, if you want dynamic libraries, add the "shared" option
make && make install
sudo apt-get install libcurl4-openssl-dev

Wind River Linux, Failed Dependency Error

I am working on Wind River Linux. Failed Dependency Error. Can anyone please tell me what I have to do ? I have been trying from past one day
root#AC-04:/home/mysql# rpm -ivh MySQL-server-5.6.33-1.linux_glibc2.5.x86_64.rpm
warning: MySQL-server-5.6.33-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 5072e1f5
error: Failed dependencies:
/sbin/chkconfig is needed by MySQL-server-5.6.33-1.linux_glibc2.5.x86_64
/usr/lib64/mysql/plugin is needed by MySQL-server-5.6.33-1.linux_glibc2.5.x86_64
/usr/lib64/mysql/plugin/debug is needed by MySQL-server-5.6.33-1.linux_glibc2.5.x86_64
First of all, use -Uvh instead of -ivh when installing: -Uvh is almost (kernel is the one exception) the right way to install/upgrade rpm packages.
The final solution will be to find the packages that provide those dependencies using (if all else fails)
rpm -qP /sbin/chkconfig *.rpm
on the WRL packages, and make sure those packages are installed.
Those are all file/directpory dependencies. Try (e.g.)
rpm -qf --whatprovides /sbin/chkconfig
to see if there is a package that provides the file.
(Note: what follows "works" for RPM5 on WRL, not RPM on Fedora/RHEL)
You can stub out dependencies by doing (e.g.)
mkdir -p /etc/rpm/sysinfo
echo "/sbin/chkconfig" >> /etc/rpm/sysinfo/Requirename
Masking the dependencies will permit installation (so will --nodeps) and might help get you further along in debugging your packaging.

SPEC file builds two RPMs, but dependency makes -Uvh upgrade impossible

I'm working on a spec file (foo.spec) that, when built, results in two RPMs: foo-1-1.i386.rpm (the main program) and libfoo-1-1.i386.rpm (the required library files). The foo.spec file states that foo requires libfoo at the same version and release level:
Requires: libfoo = %{version}-%{release}
foo-1-1 installs just fine with:
rpm -ivh libfoo-1-1.i386.rpm
which installs the dependent library, and then:
rpm -ivh foo-1-1.i386.rpm
But upgrading to a newer version (foo-2-1) doesn't work because of the dependency on the libraries:
$ rpm -Uvh libfoo-2-1.i386.rpm
error: Failed dependencies:
libfoo = 1-1 is needed by (installed) foo-1-1.i386
$ rpm -Uvh foo-2-1.i386.rpm
error: Failed dependencies:
libfoo = 2-1 is needed by foo-2-1.i386
So I'm stuck. I want users to be able to do rpm -Uvh to upgrade the foo package (requiring them to ignore dependencies, etc. is asking too much of novice users).
Any ideas of how I can work around this so that rpm -Uvh can be used to upgrade all parts of the package when a new release is available?
Thanks in advance.
rpm shouldn't and doesn't allow you to update these RPMs individually as the the state between installing the first RPM and the second is not valid.
You can, as Hasturkun points out, install both of them in the same command:
rpm -Uvh libfoo-2-1.i386.rpm foo-1-1.i386.rpm
FWIW, if you creaate a yum repo and used that to update you would find that updating one RPM would automatically drag in the other.

Packages, Ubuntu counterparts of Gentoo's useful commands

Trying to learn how to work with packages in Ubuntu (and have Gentoo experience). This command is already known:
(1) sudo apt-get install pkgname
Looking for counterparts of these:
(2) emerge -s pkgname
(3) equery files pkgname
(4) equery belongs filename
(5) cat /var/lib/portage world
Which useful (console) package commands do you use in Ubuntu? Links to Ubuntu packages tutorial in style of Gentoo's Handbook?
This would be the equivalent commands in Ubuntu:
apt-cache search package
dpkg -L package
dpkg -S filename
aptitude search ~n.*
This question is better suited for superuser.com or https://askubuntu.com/.
Anyway, I haven't used Gentoo's tools, but I think this Debian guide on package management is quite complete and you'll find the equivalents.
Some examples on apt-get:
apt-cache search package queries the repo for package.
apt-cache show package displays info on a certain package (dependencies and such).
Ubuntu Hacks/Package Management - Manage Packages From the Command Line
Debian Reference - Basic package management tools: apt-get / apt-cache and aptitude.

Installing RPM Dependencies

I am trying to install dbus-1.1.2-12.el5.i386 but I get the error
" dbus-libs = 1.1.2-12.el5 is needed by dbus-1.1.2-12.el5.i386" :-(
So I downloaded "dbus-libs-1.1.2-12.el5.i386.rpm" in the same directory and ran the
command rpm -ivh dbus-1.1.2-12.el5.i386 again, but I still got the same error. On searching on Forums I found that RPM takes care of dependecies if they are present in the same Directory. but it does not work with -ivh option ??
Steve B is correct:
yum install dbus-libs
yum install dbus
yum will also allow you to do "whatprovides" for a package:
yum whatprovides dbus-libs
This will show you if you have another version of dbus-libs "installed" on your system, it spools out what repos provide the package and is any are provided (installed) locally.
Also helpful is:
rpm -q dbus
which will show any packages that are locally install as will:
rpm -q dbus-libs
or
rpm -qa | grep 'dbus'
You may find that you already have an eariler version of dbus installed, which case:
yum -y update dbus
Hope this helps.
http://www.of-networks.co.uk
You need to install the dependant RPMs before installing dbus. You should also know that this is the hard way, these days RPM-based distributions usually have a dependancy managment system so that you don't need to do this by hand. e.g. on Redhat/Fedora/Centos you can just type "yum install mypackagename".

Resources