Difference between revisions of "Yum Centos"

From Teknologisk videncenter
Jump to: navigation, search
m
m (Updating packages)
 
(11 intermediate revisions by the same user not shown)
Line 16: Line 16:
 
=Installing packages=
 
=Installing packages=
 
<source lang=cli>
 
<source lang=cli>
[root@centos1 ~]# <input>yum -y install atftp-server<input>
+
[root@centos1 ~]# <input>yum -y install atftp-server</input>
 
<notice>...OMITTED OUTPUT...</notice>
 
<notice>...OMITTED OUTPUT...</notice>
 
---> Package atftp-server.x86_64 0:0.7-6.el6.rf will be installed
 
---> Package atftp-server.x86_64 0:0.7-6.el6.rf will be installed
Line 22: Line 22:
 
   atftp-server.x86_64 0:0.7-6.el6.rf
 
   atftp-server.x86_64 0:0.7-6.el6.rf
 
</source>
 
</source>
 +
 
=Listing installed packages=
 
=Listing installed packages=
 
To list installed packages it is necessary to use [[rpm]]
 
To list installed packages it is necessary to use [[rpm]]
Line 50: Line 51:
 
<source lang=cli>
 
<source lang=cli>
 
[root@centos1 ~]# <input>yum search all "tftp"</input>
 
[root@centos1 ~]# <input>yum search all "tftp"</input>
======================================= Matched: tftp =======================================
+
================================= Matched: tftp =================================
 
atftp.x86_64 : Advanced Trivial File Transfer Protocol (TFTP) client
 
atftp.x86_64 : Advanced Trivial File Transfer Protocol (TFTP) client
 
atftp-server.x86_64 : Advanced Trivial File Transfer Protocol (TFTP) server
 
atftp-server.x86_64 : Advanced Trivial File Transfer Protocol (TFTP) server
Line 56: Line 57:
 
<notice>...OUTPUT OMITTED...</output>
 
<notice>...OUTPUT OMITTED...</output>
 
</source>
 
</source>
 +
 
=Obtaining information about a package=
 
=Obtaining information about a package=
 
<source lang=cli>
 
<source lang=cli>
[root@centos1 ~]# yum info atftp
+
[root@centos1 ~]# <input>yum info atftp</input>
 
Available Packages
 
Available Packages
 
Name        : atftp
 
Name        : atftp
Line 68: Line 70:
 
             : lacks IPv6 support.
 
             : lacks IPv6 support.
 
</source>
 
</source>
 +
 
=To which package does a file belong=
 
=To which package does a file belong=
 +
What package does this file belong to '''/etc/sestatus.conf'''.
 +
 +
<source lang=cli>
 +
[root@centos1 etc]# <input>rpm -qf /etc/sestatus.conf<input>
 +
policycoreutils-2.0.83-19.21.el6_2.x86_64
 +
[root@centos1 etc]# <input>yum info policycoreutils-2.0.83-19.21.el6_2.x86_64</input>
 +
Description : Security-enhanced Linux is a feature of the Linux® kernel and a number
 +
            : of utilities with enhanced security functionality designed to add
 +
<notice>...OUTPUT OMITTED...</notice>
 +
</source>
 +
=Listing files in a package=
 +
To see the files in a installed package you could use
 +
<source lang=cli>
 +
[root@centos1 bin]# <input>rpm -ql  mpitests-openmpi-psm</input>
 +
/usr/lib64/openmpi-psm/bin/mpitests-IMB-EXT
 +
/usr/lib64/openmpi-psm/bin/mpitests-IMB-IO
 +
<notice>...OUTPUT OMITTED...</notice>
 +
</source>
  
 
=Removing installed packages=
 
=Removing installed packages=
Line 82: Line 103:
 
<source lang=cli>
 
<source lang=cli>
 
[root@centos1 ~]# <input>yum repolist</input>
 
[root@centos1 ~]# <input>yum repolist</input>
repo id                           repo name                                           status
+
repo id                         repo name                                     status
base                             CentOS-6 - Base                                     6.294
+
base                           CentOS-6 - Base                               6.294
extras                           CentOS-6 - Extras                                       4
+
extras                         CentOS-6 - Extras                                 4
rpmforge                         RHEL 6 - RPMforge.net - dag                         4.309
+
rpmforge                       RHEL 6 - RPMforge.net - dag                   4.309
updates                           CentOS-6 - Updates                                     784
+
updates                         CentOS-6 - Updates                               784
 
</source>
 
</source>
 +
 
=Working with groups=
 
=Working with groups=
 
Groups are packages that belong together and can be installed or removed together.
 
Groups are packages that belong together and can be installed or removed together.
Line 95: Line 117:
 
   NFS file server
 
   NFS file server
 
</source>
 
</source>
==Updating
 
 
==listing packages in a group==
 
==listing packages in a group==
 
<source lang=cli>
 
<source lang=cli>
Line 125: Line 146:
 
</source>
 
</source>
 
{{Source cli}}
 
{{Source cli}}
[[Category:Centos]][[Category:Linux]]
+
[[Category:CentOS]][[Category:Linux]][[Category:Linux Command]]

Latest revision as of 05:50, 3 May 2012

yum - Yellowdog Updater Modified

yum is an interactive, rpm based, package manager. It can automatically perform system updates, including dependency analysis and obsolete processing based on "repository" metadata. It can also perform installation of new packages, removal of old packages and perform queries on the installed and/or available packages among many other commands/services (see below).

yum is similar to other high level package managers like apt-get and smart.

While there are some graphical interfaces directly to the yum code, more recent graphical interface development is happening with PackageKit and the gnome-packagekit application.

Additional packages

To install rpmforge extras it's necessary to install the rpmforge-release package by hand. The example below is for Centos 6. See http://wiki.centos.org/AdditionalResources/Repositories/RPMForge or http://pkgs.repoforge.org/rpmforge-release/ for your version.

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm

Installing packages

[root@centos1 ~]# <input>yum -y install atftp-server</input>
<notice>...OMITTED OUTPUT...</notice>
---> Package atftp-server.x86_64 0:0.7-6.el6.rf will be installed
Installed:
  atftp-server.x86_64 0:0.7-6.el6.rf

Listing installed packages

To list installed packages it is necessary to use rpm

[root@centos1 ~]# <input>rpm -qa</input>
iwl100-firmware-39.31.5.1-1.el6.noarch
hwdata-0.233-7.6.el6.noarch
aic94xx-firmware-30-2.el6.noarch
rpcbind-0.2.0-8.el6.x86_64
<notice>...OMITTED OUTPUT...</notice>

Finding packages

By known filename

using a glob */FILENAME will instruct yum to search for a file in a package

For example remembering that the configuration file for a dhcp server is called dhcpd.conf - you search for the package name with the following command, and find the package is called dhcp or more specific dhcp-4.1.1-25.P1.el6.x86_64

[root@centos1 ~]# <input>yum provides */dhcpd.conf</input>
Loaded plugins: fastestmirror, security
<notice>...OMITTED OUTPUT...</notice>
12:dhcp-4.1.1-25.P1.el6.x86_64 : Dynamic host configuration protocol software
Repo        : base
Matched from:
Filename    : /etc/dhcp/dhcpd.conf

By known function or words

It is possible to search all available packages for a text string. For example searching for a specific tftp server

[root@centos1 ~]# <input>yum search all "tftp"</input>
================================= Matched: tftp =================================
atftp.x86_64 : Advanced Trivial File Transfer Protocol (TFTP) client
atftp-server.x86_64 : Advanced Trivial File Transfer Protocol (TFTP) server
perl-Net-TFTP.noarch : TFTP Client class
<notice>...OUTPUT OMITTED...</output>

Obtaining information about a package

[root@centos1 ~]# <input>yum info atftp</input>
Available Packages
Name        : atftp
<notice>...OUTPUT OMITTED...</notice>
Description : atftp is an advanced client implementation of the TFTP
            : protocol that implements RFCs 1350, 2090, 2347, 2348, and 2349.
            : The server is multi-threaded and the client presents a friendly
            : interface using libreadline. The current server implementation
            : lacks IPv6 support.

To which package does a file belong

What package does this file belong to /etc/sestatus.conf.

[root@centos1 etc]# <input>rpm -qf /etc/sestatus.conf<input>
policycoreutils-2.0.83-19.21.el6_2.x86_64
[root@centos1 etc]# <input>yum info policycoreutils-2.0.83-19.21.el6_2.x86_64</input>
Description : Security-enhanced Linux is a feature of the Linux® kernel and a number
            : of utilities with enhanced security functionality designed to add
<notice>...OUTPUT OMITTED...</notice>

Listing files in a package

To see the files in a installed package you could use

[root@centos1 bin]# <input>rpm -ql  mpitests-openmpi-psm</input>
/usr/lib64/openmpi-psm/bin/mpitests-IMB-EXT
/usr/lib64/openmpi-psm/bin/mpitests-IMB-IO
<notice>...OUTPUT OMITTED...</notice>

Removing installed packages

[root@centos1 ~]# <input>yum remove rpmforge-release</input>
---> Package rpmforge-release.i686 0:0.5.2-2.el6.rf will be erased
<notice>...OUTPUT OMITTED...</notice>
Removed:
  rpmforge-release.i686 0:0.5.2-2.el6.rf
Complete!

Listing available repos

[root@centos1 ~]# <input>yum repolist</input>
repo id                         repo name                                      status
base                            CentOS-6 - Base                                6.294
extras                          CentOS-6 - Extras                                  4
rpmforge                        RHEL 6 - RPMforge.net - dag                    4.309
updates                         CentOS-6 - Updates                               784

Working with groups

Groups are packages that belong together and can be installed or removed together.

Searching for a group

[root@centos1 ~]# <input>yum grouplist | grep -i nfs</input>
   NFS file server

listing packages in a group

[root@centos1 ~]# <input>yum groupinfo "NFS file server"</input>
Group: NFS file server
 Description: NFS file server.
 Mandatory Packages:
   nfs-utils
   nfs4-acl-tools

Installing or removing a group

[root@centos1 ~]# <input>yum groupinstall "NFS file server"</input>
<notice>...OUTPUT OMITTED...</notice>
[root@centos1 ~]# <input>yum groupremove "NFS file server"</input>
<notice>...OUTPUT OMITTED...</notice>

Updating packages

[root@centos1 ~]# <input>yum update</input>
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.intergenia.de
 * extras: centos.intergenia.de
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: centos.intergenia.de
Setting up Update Process
No Packages marked for Update