软件管理yum

2013年3月3日



YUM



一、yum工具的配置文件



[root@desktop7 rpm]# cat /etc/yum.conf


[main]


cachedir=/var/cache/yum


keepcache=0


debuglevel=2


logfile=/var/log/yum.log


distroverpkg=redhat-release


tolerant=1


exactarch=1


obsoletes=1


gpgcheck=1


plugins=1


bugtracker_url=http://bugs.centos.org/yum5bug



# Note: yum-RHN-plugin doesn't honor this.


metadata_expire=1h



installonly_limit = 5



# PUT YOUR REPOS HERE OR IN separate files named file.repo


# in /etc/yum.repos.d


[root@desktop7 rpm]#




二、yum下载源定义文件



[root@desktop7 rpm]# cat /etc/yum.repos.d/


bak/      dvd.repo


 


[root@desktop7 rpm]# cat /etc/yum.repos.d/dvd.repo


[media]


name=CentOS Media


baseurl=ftp://192.168.0.254/pub/centos5.8/


gpgcheck=0


enabled=1


gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5


[root@desktop7 rpm]#



[root@desktop7 rpm]# cat /etc/yum.repos.d/bak/


cat: /etc/yum.repos.d/bak/: Is a directory



[root@desktop7 rpm]# cat /etc/yum.repos.d/bak/


CentOS-Base.repo       CentOS-Vault.repo      rpmforge-testing.repo


CentOS-Debuginfo.repo  ftplianjie.repo        


CentOS-Media.repo      rpmforge.repo


         


[root@desktop7 rpm]# cat /etc/yum.repos.d/bak/ftplianjie.repo


[fengzhao001]


name=fengzhao


baseurl=ftp://192.168.0.254/pub/centos5.8/CentOS/


enabled=1


gpgcheck=0



[root@desktop7 rpm]# rm -rf /etc/yum.repos.d/bak/ftplianjie.repo


[root@desktop7 rpm]# cat /etc/yum.repos.d/bak/ftplianjie.repo


cat: /etc/yum.repos.d/bak/ftplianjie.repo: No such file or directory


[root@desktop7 rpm]#



三、清除YUM缓存



[root@desktop7 yum.repos.d]# yum clean all


Loaded plugins: fastestmirror, security


Cleaning up Everything


Cleaning up list of fastest mirrors


[root@desktop7 yum.repos.d]#



四、操作软件包



1、列出软件包



[root@desktop7 yum.repos.d]# yum list |more


Loaded plugins: fastestmirror, security


Loading mirror speeds from cached hostfile


Installed Packages


GConf2.i386                                2.14.0-9.el5                installed


GConf2.x86_64                              2.14.0-9.el5                installed


GConf2-devel.x86_64                        2.14.0-9.el5                installed


ImageMagick.i386                           6.2.8.0-12.el5              installed


ImageMagick.x86_64                         6.2.8.0-12.el5              installed


MAKEDEV.x86_64                             3.23-1.2                    installed


NetworkManager.i386                        1:0.7.0-13.el5              installed


NetworkManager.x86_64                      1:0.7.0-13.el5              installed


NetworkManager-glib.i386                   1:0.7.0-13.el5              installed


NetworkManager-glib.x86_64                 1:0.7.0-13.el5              installed


NetworkManager-gnome.x86_64                1:0.7.0-13.el5              installed


ORBit2.i386                                2.14.3-5.el5                installed


ORBit2.x86_64                              2.14.3-5.el5                installed


ORBit2-devel.x86_64                        2.14.3-5.el5                installed


OpenIPMI.x86_64                            2.0.16-12.el5               installed


OpenIPMI-libs.x86_64                       2.0.16-12.el5               installed


PyQt.x86_64                                3.16-4                      installed


PyXML.x86_64                               0.8.4-6.el5                 installed


SDL.x86_64                                 1.2.10-9.el5                installed


SDL_gfx.x86_64                             2.0.24-1.el5.rf             installed


SysVinit.x86_64                            2.86-17.el5                 installed


Virtualization-en-US.noarch                5.8-1.el5.centos            installed


Xaw3d.x86_64                               1.5E-10.1                   installed


a2ps.x86_64                                4.13b-57.2.el5              installed


--More--



2、列出软件包群组



[root@desktop7 yum.repos.d]# yum grouplist


Loaded plugins: fastestmirror, security


Setting up Group Process


Determining fastest mirrors


media                                                       | 1.3 kB     00:00     


media/primary                                               | 1.2 MB     00:00     


media/group                                                 | 1.1 MB     00:00     


Installed Groups:


   Administration Tools


   Dialup Networking Support


   Editors


   GNOME Desktop Environment


   Graphical Internet


   Graphics


   KVM


   Legacy Network Server


   Mail Server


   Network Servers


   Office/Productivity


   Printing Support


   Server Configuration Tools


   Sound and Video


   System Tools


   Text-based Internet


   Web Server


   X Window System


Available Groups:


   Authoring and Publishing


   Base


   Cluster Storage


   Clustering


   DNS Name Server


   Development Libraries


   Development Tools


   Eclipse


   Engineering and Scientific


   FTP Server


   GNOME Software Development


   Games and Entertainment


   Java Development


   KDE (K Desktop Environment)


   KDE Software Development


   Legacy Software Development


   Legacy Software Support


   MySQL Database


   News Server


   OpenFabrics Enterprise Distribution


   PostgreSQL Database


   Windows File Server


   X Software Development


   Xen


Done


[root@desktop7 yum.repos.d]#                  



3、安装已下载的软件包



[root@desktop7 ~]# yum install quagga.x86_64


Loaded plugins: fastestmirror, security


Loading mirror speeds from cached hostfile


Setting up Install Process


Resolving Dependencies


--> Running transaction check


---> Package quagga.x86_64 0:0.98.6-5.el5_5.2 set to be updated


--> Finished Dependency Resolution



Dependencies Resolved



================================================================================


 Package         Arch            Version                   Repository      Size


================================================================================


Installing:


 quagga          x86_64          0.98.6-5.el5_5.2          media          1.1 M



Transaction Summary


================================================================================


Install       1 Package(s)


Upgrade       0 Package(s)



Total download size: 1.1 M


Is this ok [y/N]: y


Downloading Packages:


quagga-0.98.6-5.el5_5.2.x86_64.rpm                       | 1.1 MB     00:00     


Running rpm_check_debug


Running Transaction Test


Finished Transaction Test


Transaction Test Succeeded


Running Transaction


  Installing     : quagga                                                   1/1



Installed:


  quagga.x86_64 0:0.98.6-5.el5_5.2                                              



Complete!


[root@desktop7 ~]#



4安装已下载的软件组包



[root@desktop7 yum.repos.d]# yum groupinstall News Server


Loaded plugins: fastestmirror, security


Loading mirror speeds from cached hostfile


Setting up Group Process


Loading mirror speeds from cached hostfile


Warning: Group News does not exist.


Warning: Group Server does not exist.


No packages in any requested group available to install or update


[root@desktop7 yum.repos.d]#




5、查找信息



[root@desktop7 yum.repos.d]# yum info media


Loaded plugins: fastestmirror, security


Loading mirror speeds from cached hostfile


media                                                                    3595/3595


Error: No matching Packages to list


[root@desktop7 yum.repos.d]#



6、移除软件包



[root@desktop7 ~]# yum remove quagga.x86_64


Loaded plugins: fastestmirror, security


Setting up Remove Process


Resolving Dependencies


--> Running transaction check


---> Package quagga.x86_64 0:0.98.6-5.el5_5.2 set to be erased


--> Finished Dependency Resolution



Dependencies Resolved



================================================================================


 Package        Arch           Version                  Repository         Size


================================================================================


Removing:


 quagga         x86_64         0.98.6-5.el5_5.2         installed         4.0 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


Finished Transaction Test


Transaction Test Succeeded


Running Transaction


  Erasing        : quagga                                                   1/1



Removed:


  quagga.x86_64 0:0.98.6-5.el5_5.2                                              



Complete!


[root@desktop7 ~]#


你可能感兴趣的:(软件管理yum)