LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Understanding rpm and yum (https://www.linuxquestions.org/questions/linux-newbie-8/understanding-rpm-and-yum-4175465839/)

NotionCommotion 06-13-2013 07:40 AM

Understanding rpm and yum
 
I am trying to better understand how applications are installed. Let's say I run the following two lines.

The first line upgrades (or installs if not existing) either a file on my hard drive or a file on the internet, and displays verbose information and hash marks. Where does it get installed? Is it just one application/file? What is being installed?

The next line then installs php54. Is yum looking at all my repositories, and looking for php54? Before it does so, how can I tell what is being installed?

I am not sure that I even asked the right questions, and appreciate any clarification. Thanks!


Code:

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install php54w

rpm
Quote:

The general form of an rpm upgrade command is

rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...

This upgrades or installs the package currently installed to a newer version. This is the same as install, except all other version(s) of the package are removed after the new package is installed.

-v
Print verbose information - normally routine progress messages will be displayed.

-h, --hash
Print 50 hash marks as the package archive is unpacked. Use with -v|--verbose for a nicer display.
yum
Quote:

install
Is used to install the latest version of a package or group of packages while ensuring that all dependencies are satisfied. (See Specifying package names for more information) If no package matches the given package name(s), they are assumed to be a shell glob and any matches are then installed. If the name starts with an @ character the rest of the name is used as though passed to the groupinstall command. If the name starts with a - character, then a search is done within the transaction and any matches are removed. If the name is a file, then install works like localinstall. If the name doesn't match a package, then package "provides" are searched (e.g. "_sqlitecache.so()(64bit)") as are filelists (Eg. "/usr/bin/yum"). Also note that for filelists, wildcards will match multiple packages.

chrism01 06-13-2013 07:52 AM

A pkg can contain many files, which (should) be installed according to https://en.wikipedia.org/wiki/Filesy...archy_Standard.

rpm is really a pkg format, but you can also do operations with the rpm cmd.
However, the rpm cmd does not handle dependencies, whereas the yum cmd does operations with rpm files, but DOES handle dependencies automatically, so normally you'd use this, not rpm cmd.

What actually gets installed by any pkg is defined within the pkg and is unique to that pkg.

There is some good info in the man pages, as you seem to have found, but there are also lots of HOWTOs on the web.
Feel free to ask some more if you need to.

HTH

shane25119 06-13-2013 07:54 AM

Generally speaking you can think of .rpm, .yum, .dpkg files etc as .exes for Linux. Yes, I know the comparison is not perfect.

Where things install varies, you can figure out where by using the whereis command after installing. So, your example:

Code:

whereis php54

acid_kewpie 06-13-2013 08:00 AM

I don't know what that latest.rpm is, but seeing as you are asking about this sort fo thing... have a look. run:

wget http://mirror.webtatic.com/yum/el6/latest.rpm
rpm -qlf latest.rpm

actually, I presume "rpm -qlf http://mirror.webtatic.com/yum/el6/latest.rpm" would also work

and you'll be able to see what files are in it. One thing that is odd is that you'd really NEVER see a file called "latest"... what is it??? I presume it's some repo files or something... so how you're messing with that file now is not very typical, as it's surely not going to install a package called "latest" whereas "php54" is the package (NOT the file) you're after, so that's more normal.

How can you tell what's being installed? it'll tell you at the time. Note that until you ask to install it, it's not going to check what is needed on your specific system in terms of dependencies.

NotionCommotion 06-13-2013 08:08 AM

Thank you all! I am still trying to digest the information. In the mean time, what am I missing? Thanks

Code:

[root@vps /]# rpm -qlf http://mirror.webtatic.com/yum/el6/latest.rpm
error: file /http://mirror.webtatic.com/yum/el6/latest.rpm: No such file or directory
[root@vps ~]# wget http://mirror.webtatic.com/yum/el6/latest.rpm
--2013-06-13 08:03:09--  http://mirror.webtatic.com/yum/el6/latest.rpm
Resolving mirror.webtatic.com... 72.21.195.40
Connecting to mirror.webtatic.com|72.21.195.40|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11612 (11K) [binary/octet-stream]
Saving to: `latest.rpm'

100%[======================================>] 11,612      --.-K/s  in 0.01s

2013-06-13 08:03:10 (857 KB/s) - `latest.rpm' saved [11612/11612]

[root@vps ~]# rpm -qlf latest.rpm
file /root/latest.rpm is not owned by any package
[root@vps ~]#


Madhu Desai 06-13-2013 08:15 AM

Code:

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
Above line installs Webtatic Yum Repository. Check /etc/yum.repos.d/ directory, you should have webtatic.repo file in it.

Code:

yum install php54w
This installs PHP 5.4 from webstatic repository

kepson77 06-13-2013 08:21 AM

Hi ,

I too had difficulties understanding yum and rpm when getting started. I will attempt to reply to your individual questions.

For starters, forgive me if this is redundant to you.

rpm is a package management tool that installs, queries, removes, updates, and performs integrity checks (among other things) with *.rpm packages. yum is a tool used to download and install rpm packages, along with any packages the new package may be dependent on. With that being said, I will now address your questions.

1----------------------------------------------------------------
You said 'Where does it get installed?

Depending on the package, it may go in several locations. For instance, the most typical location will be under '/usr/bin/'. This is where executable files are commonly installed. Still, there may be what is called a 'modular' package, which is a package that contains many (more than one) associated file. Such files may be an executable (located in /usr/bin/) and a configuration file (located in /etc/). To solve the seemingly ridiculous riddle of 'where are the installation files', you can run the below rpm command:

rpm -qc [package name] (e.g. rpm -qc php54w)

The '-q' option enables a query, while the '-c' option enables a listing of all configuration files associated with the package name; this will also list the locations of those files.


2-------------------------------------------------------------------
You said 'Is it just one application/file?

When installing a package via rpm, it may be one file or multiple files. Its important to note that an rpm 'package' may be a combination of several files that work together to make a complete application. So, to answer this question, you may run the above-mentioned command, rpm -qc [package name] to list all associated configuration files for the package. If there are no files listed, the application is likely a standalone file. But chances are it contains at least one other files.

3-------------------------------------------------------------------
You said 'What is being installed?'

To find what's actually being installed on an rpm package, you can run the below command:

rpm -ql [package name] (e.g. rpm -ql systemd)

The -q option (of course) enables a query, while the -l option enables a listing of all associated files.

One more thing... when installing packages via yum, yum actually downloads and installs all packages the new package is dependent on; this is important for the above question of what's being installed. If yum is executed without any additional options (e.g. yum install [package]), it will report that it is downloading dependencies, and will even give a [y/n] prompt for approval before installed the additional packages. This too will help in understanding what's being installed.

I hope this info is helpful for both this post, as well as other rpm/yum usage for you.

NotionCommotion 06-13-2013 08:32 AM

Thank you mddesai, When I first used rpm to install the first application, did it ONLY install the following in the /etc/yum.repos.d/ directory? They yum looks at all my repos and tries to use one of them to install a given package?
Code:

[webtatic]
name=Webtatic Repository $releasever - $basearch
#baseurl=http://repo.webtatic.com/yum/el6/$basearch/
mirrorlist=http://mirror.webtatic.com/yum/el6/$basearch/mirrorlist
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy

[webtatic-debuginfo]
name=Webtatic Repository $releasever - $basearch - Debug
#baseurl=http://repo.webtatic.com/yum/el6/$basearch/debug/
mirrorlist=http://mirror.webtatic.com/yum/el6/$basearch/debug/mirrorlist
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy

[webtatic-source]
name=Webtatic Repository $releasever - $basearch
#baseurl=http://repo.webtatic.com/yum/el6/SRPMS/
mirrorlist=http://mirror.webtatic.com/yum/el6/SRPMS/mirrorlist
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy


NotionCommotion 06-13-2013 08:35 AM

Thank you kepson77! Very informative. I understand much of what you have said, but will need to go through it in more detail.

Madhu Desai 06-13-2013 09:06 AM

Quote:

Originally Posted by NotionCommotion (Post 4970972)
When I first used rpm to install the first application, did it ONLY install the following in the /etc/yum.repos.d/ directory? They yum looks at all my repos and tries to use one of them to install a given package?

if you check the files that are contained in latest.rpm, it suggets so.
Code:

# rpm -qpl http://mirror.webtatic.com/yum/el6/latest.rpm
warning: http://mirror.webtatic.com/yum/el6/latest.rpm: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
/etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy
/etc/yum.repos.d/webtatic.repo
/usr/share/doc/webtatic-release-6
/usr/share/doc/webtatic-release-6/GPLv2

i suggest you to change enabled=1 to enabled=0 in webtatic.repo, so that every time you install any package it doesnt look in webtatic repository. when you want to install specific package from webtatic repo, you can use '--enablerepo=webtatic' option. to list available packages in webtatic repo, you can use following command.

Code:

# yum --disablerepo="*" --enablerepo="webtatic" list available

Madhu Desai 06-13-2013 09:33 AM

Quote:

Originally Posted by NotionCommotion (Post 4970937)
What is being installed?

how can I tell what is being installed?

To find what and where files are installed, you can do one of the following:

For example,

For packages that are already installed:
Code:

# rpm -qa | grep beesu
beesu-2.6-1.el6.x86_64
# rpm -ql beesu-2.6-1.el6.x86_64
/etc/beesu.conf
/etc/pam.d/beesu
/etc/profile.d/beesu-bash-completion.sh
/etc/security/console.apps/beesu
/usr/bin/beesu
/usr/sbin/beesu
/usr/share/doc/beesu-2.6
/usr/share/doc/beesu-2.6/COPYING
/usr/share/doc/beesu-2.6/README
/usr/share/man/man1/beesu.1.gz

For packages that are not installed you can use -p option. (packages could be local, ftp or http):
Code:

# rpm -qpl http://repo.webtatic.com/yum/el6/x86_64/php54w-5.4.16-1.w6.x86_64.rpm
warning: http://repo.webtatic.com/yum/el6/x86_64/php54w-5.4.16-1.w6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
/etc/httpd/conf.d/php.conf
/usr/lib64/httpd/modules/libphp5.so
/var/lib/php/session
/var/www/icons/php.gif

From the above response, you will know where files will be installed.

You can also use -i option to get more information
Code:

# rpm -qpi http://repo.webtatic.com/yum/el6/x86_64/php54w-5.4.16-1.w6.x86_64.rpm
warning: http://repo.webtatic.com/yum/el6/x86_64/php54w-5.4.16-1.w6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
Name        : php54w                      Relocations: (not relocatable)
Version    : 5.4.16                            Vendor: Webtatic
Release    : 1.w6                          Build Date: Sun 09 Jun 2013 12:17:44 PM IST
Install Date: (not installed)              Build Host: mock6.local
Group      : Development/Languages        Source RPM: php54w-5.4.16-1.w6.src.rpm
Size        : 4657421                          License: PHP
Signature  : DSA/SHA1, Sun 09 Jun 2013 01:40:48 PM IST, Key ID b7434b06cf4c4ff9
Packager    : Andy Thompson <andy@webtatic.com>
URL        : http://www.php.net/
Summary    : PHP scripting language for creating dynamic web sites
Description :
PHP is an HTML-embedded scripting language. PHP attempts to make it
easy for developers to write dynamically generated webpages. PHP also
offers built-in database integration for several commercial and
non-commercial database management systems, so writing a
database-enabled webpage with PHP is fairly simple. The most common
use of PHP coding is probably as a replacement for CGI scripts.

The php54w package contains the module which adds support for the PHP
language to Apache HTTP Server.

More: man rpm

chrism01 06-13-2013 07:26 PM

If you're going to add extra repos you MUST install yum-priorities and set it up to prevent clashes
http://wiki.centos.org/PackageManagement/Yum/Priorities.
Otherwise, sooner or later, you'll break something (most likely sooner), and that includes the OS.


All times are GMT -5. The time now is 11:47 PM.