Awọn pipaṣẹ 20 YUM fun Man Mania Package


Ninu àpilẹkọ yii, a yoo kọ bi a ṣe le fi sori ẹrọ, imudojuiwọn, yọkuro, wa awọn idii, ṣakoso awọn idii ati awọn ibi ipamọ lori awọn eto Linux nipa lilo ọpa YUM (Yellowdog Updater ti a Ṣatunṣe) ti o dagbasoke nipasẹ RedHat. Awọn aṣẹ apẹẹrẹ ti o han ninu nkan yii ni idanwo ni idanwo lori olupin wa CentOS 6.3, o le lo awọn ohun elo wọnyi fun idi iwadi, awọn iwe-ẹri tabi kan lati ṣawari awọn ọna lati fi awọn idii tuntun sii ati lati jẹ ki eto rẹ di imudojuiwọn. Ibeere ipilẹ ti nkan yii ni, o gbọdọ ni oye ipilẹ ti awọn ofin ati ẹrọ ṣiṣe Lainos ṣiṣẹ, nibi ti o ti le ṣawari ati ṣe gbogbo awọn ofin ti a ṣe akojọ rẹ ni isalẹ.

Kini YUM?

YUM (Yellowdog Updater títúnṣe) jẹ laini aṣẹ orisun orisun bi daradara bi ohun elo orisun iṣakoso package fun iwọn RPM (RedHat Package Manager) awọn eto Linux ti o da. O gba awọn olumulo laaye ati alakoso eto lati fi rọọrun, imudojuiwọn, yọkuro tabi wa awọn idii sọfitiwia lori awọn eto kan. O ti dagbasoke ati tu silẹ nipasẹ Seth Vidal labẹ GPL (Iwe-aṣẹ Gbogbogbo Gbogbogbo) bi orisun ṣiṣi, tumọ si pe ẹnikẹni le gba laaye lati gbasilẹ ati wọle si koodu lati ṣatunṣe awọn idun ati idagbasoke awọn idii ti adani. YUM nlo ọpọlọpọ awọn ibi ipamọ ẹgbẹ kẹta lati fi awọn idii sori ẹrọ laifọwọyi nipasẹ ipinnu awọn ọran igbẹkẹle wọn.

Lati fi package ti a pe ni Firefox 14 sori ẹrọ, kan ṣiṣe aṣẹ ni isalẹ o yoo wa laifọwọyi ati fi sori ẹrọ gbogbo awọn igbẹkẹle ti o nilo fun Firefox.

# yum install firefox
Loaded plugins: fastestmirror
Dependencies Resolved

================================================================================================
 Package                    Arch        Version                    Repository            Size        
================================================================================================
Updating:
firefox                        i686        10.0.6-1.el6.centos     updates             20 M
Updating for dependencies:
 xulrunner                     i686        10.0.6-1.el6.centos     updates             12 M

Transaction Summary
================================================================================================
Install       0 Package(s)
Upgrade       2 Package(s)

Total download size: 32 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): firefox-10.0.6-1.el6.centos.i686.rpm                                |  20 MB   01:10
(2/2): xulrunner-10.0.6-1.el6.centos.i686.rpm                              |  12 MB   00:52
------------------------------------------------------------------------------------------------
Total                                                           63 kB/s |  32 MB   02:04

Updated:
  firefox.i686 0:10.0.6-1.el6.centos

Dependency Updated:
  xulrunner.i686 0:10.0.6-1.el6.centos

Complete!

Aṣẹ ti o wa loke yoo beere ìmúdájú ṣaaju fifi eyikeyi package sori ẹrọ rẹ. Ti o ba fẹ fi awọn idii sii laifọwọyi laisi beere eyikeyi ijẹrisi, lo aṣayan -y bi o ṣe han ninu apẹẹrẹ isalẹ.

# yum -y install firefox

Lati yọ package kuro patapata pẹlu gbogbo awọn igbẹkẹle wọn, kan ṣiṣe aṣẹ atẹle bi a ṣe han ni isalẹ.

# yum remove firefox
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package firefox.i686 0:10.0.6-1.el6.centos set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                    Arch        Version                        Repository            Size        
====================================================================================================
Removing:
 firefox                    i686        10.0.6-1.el6.centos            @updates              23 M

Transaction Summary
====================================================================================================
Remove        1 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : firefox-10.0.6-1.el6.centos.i686                                                                                                                          1/1

Removed:
  firefox.i686 0:10.0.6-1.el6.centos

Complete!

Ni ọna kanna aṣẹ ti o wa loke yoo beere ìmúdájú ṣaaju yiyọ package kan kuro. Lati mu tọrisi ijẹrisi kan ṣafikun aṣayan -y bi o ṣe han ni isalẹ.

# yum -y remove firefox

Jẹ ki a sọ pe o ni ẹya ti igba atijọ ti package MySQL ati pe o fẹ ṣe imudojuiwọn rẹ si ẹya iduroṣinṣin tuntun. Kan ṣiṣe aṣẹ atẹle ni yoo ṣe ipinnu gbogbo awọn ọran igbẹkẹle laifọwọyi ati fi sii wọn.

# yum update mysql
Loaded plugins: fastestmirror
Dependencies Resolved

============================================================================================================
 Package            Arch                Version                    Repository                    Size
============================================================================================================
Updating:
 vsftpd             i386                2.0.5-24.el5_8.1           updates                       144 k

Transaction Summary
============================================================================================================
Install       0 Package(s)
Upgrade       1 Package(s)

Total size: 144 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : vsftpd                                                                     1/2
  Cleanup        : vsftpd                                                                     2/2

Updated:
  vsftpd.i386 0:2.0.5-24.el5_8.1

Complete!

Lo iṣẹ atokọ lati wa package pataki pẹlu orukọ. Fun apẹẹrẹ lati wa package ti a pe ni openssh, lo pipaṣẹ.

# yum list openssh
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.neu.edu.cn
 * epel: mirror.neu.edu.cn
 * extras: mirror.neu.edu.cn
 * rpmforge: mirror.nl.leaseweb.net
 * updates: mirror.nus.edu.sg
Installed Packages
openssh.i386                                       4.3p2-72.el5_6.3                                                                      installed
Available Packages                                 4.3p2-82.el5                                                                          base

Lati ṣe wiwa rẹ diẹ sii deede, ṣalaye orukọ package pẹlu ẹya wọn, bi o ba mọ. Fun apẹẹrẹ lati wa ẹya kan pato openssh-4.3p2 ti package, lo aṣẹ.

# yum list openssh-4.3p2

Ti o ko ba ranti orukọ gangan ti package, lẹhinna lo iṣẹ iṣawari lati wa gbogbo awọn idii ti o wa lati baamu orukọ ti package ti o sọ. Fun apẹẹrẹ, lati wa gbogbo awọn idii ti o baamu ọrọ naa.

# yum search vsftpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.neu.edu.cn
 * epel: mirror.neu.edu.cn
 * extras: mirror.neu.edu.cn
 * rpmforge: mirror.nl.leaseweb.net
 * updates: ftp.iitm.ac.in
============================== Matched: vsftpd ========================
ccze.i386 : A robust log colorizer
pure-ftpd-selinux.i386 : SELinux support for Pure-FTPD
vsftpd.i386 : vsftpd - Very Secure Ftp Daemon

Sọ pe iwọ yoo fẹ lati mọ alaye ti package ṣaaju fifi sii. Lati gba alaye ti package kan sọ aṣẹ ni isalẹ.

# yum info firefox
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.neu.edu.cn
 * epel: mirror.neu.edu.cn
 * extras: mirror.neu.edu.cn
 * rpmforge: mirror.nl.leaseweb.net
 * updates: ftp.iitm.ac.in
Available Packages
Name       : firefox
Arch       : i386
Version    : 10.0.6
Release    : 1.el5.centos
Size       : 20 M
Repo       : updates
Summary    : Mozilla Firefox Web browser
URL        : http://www.mozilla.org/projects/firefox/
License    : MPLv1.1 or GPLv2+ or LGPLv2+
Description: Mozilla Firefox is an open-source web browser, designed for standards
           : compliance, performance and portability.

Lati ṣe atokọ gbogbo awọn idii ti o wa ni ibi ipamọ data Yum, lo pipaṣẹ isalẹ.

# yum list | less

Lati ṣe atokọ gbogbo awọn idii ti a fi sori ẹrọ lori eto kan, kan ọrọ ni isalẹ aṣẹ, yoo han gbogbo awọn idii ti a fi sii.

# yum list installed | less

Yum pese iṣẹ ti lo lati wa iru package ti faili kan pato jẹ ti. Fun apẹẹrẹ, ti o ba fẹ lati mọ orukọ ti package ti o ni /etc/httpd/conf/httpd.conf.

# yum provides /etc/httpd/conf/httpd.conf
Loaded plugins: fastestmirror
httpd-2.2.3-63.el5.centos.i386 : Apache HTTP Server
Repo        : base
Matched from:
Filename    : /etc/httpd/conf/httpd.conf

httpd-2.2.3-63.el5.centos.1.i386 : Apache HTTP Server
Repo        : updates
Matched from:
Filename    : /etc/httpd/conf/httpd.conf

httpd-2.2.3-65.el5.centos.i386 : Apache HTTP Server
Repo        : updates
Matched from:
Filename    : /etc/httpd/conf/httpd.conf

httpd-2.2.3-53.el5.centos.1.i386 : Apache HTTP Server
Repo        : installed
Matched from:
Other       : Provides-match: /etc/httpd/conf/httpd.conf

Lati wa iye awọn ti awọn idii ti a fi sori ẹrọ lori ẹrọ rẹ ni awọn imudojuiwọn wa, lati ṣayẹwo lo pipaṣẹ wọnyi.

# yum check-update

Lati jẹ ki eto rẹ di imudojuiwọn pẹlu gbogbo aabo ati awọn imudojuiwọn package alakomeji, ṣiṣe aṣẹ atẹle. Yoo fi sori ẹrọ gbogbo awọn abulẹ tuntun ati awọn imudojuiwọn aabo si eto rẹ.

# yum update

Ni Lainos, nọmba awọn idii ti wa ni akojọpọ si ẹgbẹ kan pato. Dipo fifi awọn idii kọọkan pẹlu yum, o le fi ẹgbẹ kan pato sii ti yoo fi gbogbo awọn idii ti o jọmọ ti o jẹ ti ẹgbẹ sii. Fun apẹẹrẹ lati ṣe atokọ gbogbo awọn ẹgbẹ to wa, kan sọ atẹle atẹle.

# yum grouplist
Installed Groups:
   Administration Tools
   DNS Name Server
   Dialup Networking Support
   Editors
   Engineering and Scientific
   FTP Server
   Graphics
   Java Development
   Legacy Network Server
Available Groups:
   Authoring and Publishing
   Base
   Beagle
   Cluster Storage
   Clustering
   Development Libraries
   Development Tools
   Eclipse
   Educational Software
   KDE (K Desktop Environment)
   KDE Software Development

Lati fi sori ẹrọ ẹgbẹ package kan pato, a lo aṣayan bi a fi sii ẹgbẹ. Apere fun apẹẹrẹ, lati fi “Database MySQL sii”, kan ṣiṣẹ pipaṣẹ isalẹ.

# yum groupinstall 'MySQL Database'
Dependencies Resolved

=================================================================================================
Package								Arch      Version			 Repository        Size
=================================================================================================
Updating:
 unixODBC                           i386      2.2.11-10.el5      base              290 k
Installing for dependencies:
 unixODBC-libs                      i386      2.2.11-10.el5      base              551 k

Transaction Summary
=================================================================================================
Install       1 Package(s)
Upgrade       1 Package(s)

Total size: 841 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : unixODBC-libs	1/3
  Updating       : unixODBC         2/3
  Cleanup        : unixODBC         3/3

Dependency Installed:
  unixODBC-libs.i386 0:2.2.11-10.el5

Updated:
  unixODBC.i386 0:2.2.11-10.el5

Complete!

Lati ṣe imudojuiwọn eyikeyi awọn idii ẹgbẹ ti o ti fi sii tẹlẹ, kan ṣiṣe aṣẹ wọnyi bi o ṣe han ni isalẹ.

# yum groupupdate 'DNS Name Server'

Dependencies Resolved
================================================================================================================
 Package			Arch	        Version				Repository           Size
================================================================================================================
Updating:
 bind                           i386            30:9.3.6-20.P1.el5_8.2          updates              981 k
 bind-chroot                    i386            30:9.3.6-20.P1.el5_8.2          updates              47 k
Updating for dependencies:
 bind-libs                      i386            30:9.3.6-20.P1.el5_8.2          updates              864 k
 bind-utils                     i386            30:9.3.6-20.P1.el5_8.2          updates              174 k

Transaction Summary
================================================================================================================
Install       0 Package(s)
Upgrade       4 Package(s)

Total size: 2.0 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : bind-libs            1/8
  Updating       : bind                 2/8
  Updating       : bind-chroot          3/8
  Updating       : bind-utils           4/8
  Cleanup        : bind                 5/8
  Cleanup        : bind-chroot          6/8
  Cleanup        : bind-utils           7/8
  Cleanup        : bind-libs            8/8

Updated:
  bind.i386 30:9.3.6-20.P1.el5_8.2                  bind-chroot.i386 30:9.3.6-20.P1.el5_8.2

Dependency Updated:
  bind-libs.i386 30:9.3.6-20.P1.el5_8.2             bind-utils.i386 30:9.3.6-20.P1.el5_8.2

Complete!

Lati paarẹ tabi yọ eyikeyi ẹgbẹ ti a fi sori ẹrọ tẹlẹ lati inu eto, kan lo pipaṣẹ isalẹ.

# yum groupremove 'DNS Name Server'

Dependencies Resolved

===========================================================================================================
 Package                Arch              Version                         Repository          Size
===========================================================================================================
Removing:
 bind                   i386              30:9.3.6-20.P1.el5_8.2          installed           2.1 M
 bind-chroot            i386              30:9.3.6-20.P1.el5_8.2          installed           0.0

Transaction Summary
===========================================================================================================
Remove        2 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : bind                                                   1/2
warning: /etc/sysconfig/named saved as /etc/sysconfig/named.rpmsave
  Erasing        : bind-chroot                                            2/2

Removed:
  bind.i386 30:9.3.6-20.P1.el5_8.2                                        bind-chroot.i386 30:9.3.6-20.P1.el5_8.2

Complete!

Lati ṣe atokọ gbogbo awọn ibi ipamọ Yum ti o ṣiṣẹ ninu eto rẹ, lo aṣayan atẹle.

# yum repolist

repo id                     repo name                                            status
base                        CentOS-5 - Base                                      enabled:  2,725
epel                        Extra Packages for Enterprise Linux 5 - i386         enabled:  5,783
extras                      CentOS-5 - Extras                                    enabled:    282
mod-pagespeed               mod-pagespeed                                        enabled:      1
rpmforge                    RHEL 5 - RPMforge.net - dag                          enabled: 11,290
updates                     CentOS-5 - Updates                                   enabled:    743
repolist: 20,824

Atẹle atẹle yoo han gbogbo agbara ati alaabo awọn ibi ipamọ yum lori eto naa.

# yum repolist all

repo id                     repo name                                            status
C5.0-base                   CentOS-5.0 - Base                                    disabled
C5.0-centosplus             CentOS-5.0 - Plus                                    disabled
C5.0-extras                 CentOS-5.0 - Extras                                  disabled
base                        CentOS-5 - Base                                      enabled:  2,725
epel                        Extra Packages for Enterprise Linux 5 - i386         enabled:  5,783
extras                      CentOS-5 - Extras                                    enabled:    282
repolist: 20,824

Lati fi sori ẹrọ package kan pato lati ibi iṣẹ ṣiṣẹ tabi ibi ipamọ alaabo, o gbọdọ lo –enablerepo aṣayan ninu aṣẹ yum rẹ. Fun apẹẹrẹ lati Fi sori ẹrọ package PhpMyAdmin 3.5.2, kan ṣiṣẹ aṣẹ naa.

# yum --enablerepo=epel install phpmyadmin

Dependencies Resolved
=============================================================================================
 Package                Arch           Version            Repository           Size
=============================================================================================
Installing:
 phpMyAdmin             noarch         3.5.1-1.el6        epel                 4.2 M

Transaction Summary
=============================================================================================
Install       1 Package(s)

Total download size: 4.2 M
Installed size: 17 M
Is this ok [y/N]: y
Downloading Packages:
phpMyAdmin-3.5.1-1.el6.noarch.rpm                       | 4.2 MB     00:25
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : phpMyAdmin-3.5.1-1.el6.noarch             1/1
  Verifying  : phpMyAdmin-3.5.1-1.el6.noarch             1/1

Installed:
  phpMyAdmin.noarch 0:3.5.1-1.el6

Complete!

IwUlO Yum n pese ikarahun aṣa nibiti o le ṣe awọn aṣẹ pupọ.

# yum shell
Loaded plugins: fastestmirror
Setting up Yum Shell
> update httpd
Loading mirror speeds from cached hostfile
 * base: mirrors.sin3.sg.voxel.net
 * epel: ftp.riken.jp
 * extras: mirrors.sin3.sg.voxel.net
 * updates: mirrors.sin3.sg.voxel.net
Setting up Update Process
>

Nipa aiyipada yum n tọju gbogbo data package ti ibi ipamọ ṣiṣẹ ni/var/kaṣe/yum/pẹlu itọsọna-kọọkan kọọkan, lati nu gbogbo awọn faili ti o wa ni ipamọ kuro lati ibi ipamọ ti o ṣiṣẹ, o nilo lati ṣiṣe aṣẹ atẹle ni deede lati nu gbogbo kaṣe naa ki o rii daju pe ko si nkankan aaye ti ko ni dandan ti nlo. A ko fẹ lati fun iṣẹjade ti aṣẹ ti o wa ni isalẹ, nitori a fẹran lati tọju data ipamọ bi o ti jẹ.

# yum clean all

Lati wo gbogbo awọn iṣowo ti o kọja ti aṣẹ yum, kan lo aṣẹ atẹle.

# yum history

Loaded plugins: fastestmirror
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    10 | root               | 2012-08-11 15:19 | Install        |    3
     9 | root               | 2012-08-11 15:11 | Install        |    1
     8 | root               | 2012-08-11 15:10 | Erase          |    1 EE
     7 | root               | 2012-08-10 17:44 | Install        |    1
     6 | root               | 2012-08-10 12:19 | Install        |    2
     5 | root               | 2012-08-10 12:14 | Install        |    3
     4 | root               | 2012-08-10 12:12 | I, U           |   13 E<
     3 | root               | 2012-08-09 13:01 | Install        |    1 >
     2 | root               | 2012-08-08 20:13 | I, U           |  292 EE
     1 | System            | 2012-08-08 17:15 | Install        |  560
history list

A ti gbiyanju lati bo gbogbo ipilẹ lati ni ilosiwaju awọn aṣẹ yum pẹlu awọn apẹẹrẹ wọn. Ti ohunkohun ba ni ibatan si awọn aṣẹ yum le ti padanu. Jọwọ mu wa nipasẹ apoti asọye wa. Nitorinaa, a tọju mimuṣe kanna da lori gbigba ti esi.