您好,欢迎来到独旅网。
搜索
您的当前位置:首页最详细的LinuxYUM命令使用教程

最详细的LinuxYUM命令使用教程

来源:独旅网
最详细的LinuxYUM命令使⽤教程

YUM(Yellow dog Updater, Modified)为多个Linux发⾏版的前端软件包管理器,例如 Redhat RHEL, CentOS & Fedora. YUM通过调⽤RPM的软件包信息让⽤户更⽅便地进⾏软件安装,升级,卸载等软件包管理操作。

这篇教程适⽤所有使⽤YUM管理软件包的Linux发⾏版,包括CentOS, RHEL or Fedora.

怎么使⽤YUM命令升级所有RPM软件包?

yum update

怎么使⽤YUM命令升级单个RPM软件包

yum update 软件名称

使⽤YUM安装RPM软件包

yum install 软件名称

使⽤YUM升级全部软件时怎么排除个别软件

假如你想升级所有软件包,但不想升级内核,就可以⽤下⾯的命令: yum --exclude=package kernel* update

怎么使⽤YUM来确定某个软件需要升级

下⾯的命令会检测 Fedora/CentOS/RHEL上的所有软件是否需要升级

check-update

使⽤YUM卸载软件

yum remove 软件名称 或者 yum erase 软件名称

使⽤YUM查看软件包相关信息

yum list可以让你获取软件包相关信息,后⾯不指定软件包名的话,它会列出所有软件包的信息。 yum list 软件名称

使⽤yum了解软件的主要功能

⽐如你想知道httpd这个软件是⼲吗的,可以输⼊下⾯的的命令: yum provides httpd[root@ zhetenger ~]# yum provides nginxLoaded plugins: priorities

nginx-.0.5-3.el6.i686 : A high performance web server and reverse proxy serverRepo : epel

使⽤YUM查找软件包

如果你不知道某个软件包的全称,这个命令就⾮常有⽤了,它会根据你提供的关键词在RPM的软件包数据库⾥搜索相适配的软件包。⽐⽅说我想找 samba这个软件的全称,我只需要输⼊下⾯的命令即可: yum search samba然后会显⽰下⾯的信息:

Loaded plugins: priorities

============================== N/S Matched: samba ==============================ncid-samba.noarch : NCID samba module sends caller ID information to windows : machines

php-pear-Auth-samba.noarch : Samba support for php-pear-Authsamba-client.i686 : Samba client programs

samba-common.i686 : Files used by both Samba servers and clientssamba-doc.i686 : Documentation for the Samba suite

samba-swat.i686 : The Samba SMB server Web configuration programsamba-winbind.i686 : Samba winbind

samba-winbind-clients.i686 : Samba winbind clients

samba-winbind-krb5-locator.i686 : Samba winbind krb5 locatorsamba4.i686 : The Samba4 CIFS and AD client and server suitesamba4-devel.i686 : Developer tools for Samba librariessamba4-libs.i686 : Samba libraries

sblim-cmpi-samba.i686 : SBLIM WBEM-SMT Samba

sblim-cmpi-samba-devel.i686 : SBLIM WBEM-SMT Samba - Header Development Filessblim-cmpi-samba-test.i686 : SBLIM WBEM-SMT Samba - Testcase Filesctdb.i686 : A Clustered Database based on Samba's Trivial Database (TDB)

php-pear-File-SMBPasswd.noarch : Class for managing SAMBA style password filessamba.i686 : Server and Client software to interoperate with Windows machinessamba-domainjoin-gui.i686 : Domainjoin GUI使⽤YUM查看软件包的基本信息

>[ ~]# yum info sambaLoaded plugins: prioritiesInstalled PackagesName : sambaArch : i686Version : 3.5.0Release : 25.el6Size : 7 M

Repo : installedFrom repo : base

Summary : Server and Client software to interoperate with Windows machinesURL :

License : GPLv3+ and LGPLv3+Description :

: Samba is the suite of programs by which a lot of PC-related : machines share files, printers, and other information (such as : lists of available files and printers). The Windows NT, OS/2, and : Linux operating systems support this natively, and add-on packages : can enable the same thing for DOS, Windows, VMS, UNIX of all : kinds, MVS, and more. This package provides an SMB/CIFS server : that can be used to provide network services to SMB/CIFS clients. : Samba uses NetBIOS over TCP/IP (NetBT) protocols and does NOT : need the NetBEUI (Microsoft Raw NetBIOS frame) protocol.

怎么清除YUM缓存和下载包⽂件

每安装⼀个软件包,YUM都是先下载⼀个RPM软件包然后再安装,安装完后并不会⾃动删除。时间长了,这些⽂件占很多空间的。所以,需要定时清理: yum clean all

怎么使⽤YUM安装本地RPM包

如果你想要⾃⼰创建⼀个RPM软件包,你你可以⽤YUM来确定存在哪些依赖关系: yum localinstall 软件名称.rpm

使⽤YUM升级本地RPM软件包

如果你想升级⼀个本地RPM软件包,可以⽤下⾯的命令: yum localupdate update-package.rpm

确定RPM包依赖哪些组件

如果你想⾃⼰源码安装软件,了解安装的软件包依赖哪些软件⾮常有必要的。deplist可以让你知道软件包依赖哪些组件,这些组件的全称是什么。 yum deplist 软件名称

查看YUM的版本信息

yum -v

使⽤YUM安装软件包到chroot环境(chroot)

你可以使⽤下⾯的命令把软件安装到chroot: yum --installroot=/path/to/chroot/

使⽤YUM启⽤已存在的软件源

如果你安装了第三⽅的软件源,你需要先启⽤该软件源才能从其安装软件,输⼊下⾯的命令启⽤EPEL软件源: yum --enablerepo=epel install

rsnapshot

使⽤YUM禁⽤软件源

如果你安装了第三⽅软件源但不想从其安装软件,可以⽤下⾯的命令禁⽤: yum --disablerepo=epel install 软件名称

YUM软件集合

YUM软件集合是指多个共同协作的软件统称,⽐如“Development Tools”(开发⼯具)。 下⾯介绍下怎么⽤yum groupinstall命令来查看/安装/卸载yum软件集合

安装yum软件集合

yum groupinstall 'Development Tools'

卸载yum软件集合

yum groupremove 'Development Tools'

升级yum软件集合

yum groupupdate 'Development Tools'

查看yum软件集合信息

yum groupinfo 'Development Tools'

查看有哪些软件集合

yum grouplist | more

使⽤YUM输出已安装软件包列表

该命令适⽤所有使⽤YUM为软件管理器的linux版本,如CentOS, Fedora, RHEL: yum list installedGeoIP.i686 .4.8-.el6 @epel

MAKEDEV.i686 3.24-6.el6 installedapr.i686 .3.9-5.el6_2 @updatesapr-util.i686 .3.9-3.el6_0. installedapr-util-ldap.i686 .3.9-3.el6_0. installedaspell.i686 2:0.60.6-2.el6 installedaudit-libs.i686 2.2-2.el6 @baseauthconfig.i686 6..2-0.el6 @baseavahi-libs.i686 0.6.25-.el6 @base

basesystem.noarch 0.0-4.el6 installedbash.i686 4..2-9.el6_2 @base

bind.i686 32:9.8.2-0.0.rc.el6_3.6 @updatesbind-libs.i686 32:9.8.2-0.0.rc.el6_3.6 @updatesbinutils.i686 2.20.5.0.2-5.34.el6 @basebzip2.i686 .0.5-7.el6_0 installedbzip2-libs.i686 .0.5-7.el6_0 installedca-certificates.noarch 200.63-3.el6_.5 @basecentos-indexhtml.noarch 6-.el6.centos installedcentos-release.i686 6-3.el6.centos.9 @basechkconfig.i686 .3.49.3-2.el6 @basecompat-mysql5.i686 5..-.el6.remi @remi转⾃

Getting Started

1. Download and Install Oracle Linux

2. Download and copy the appropriate yum configuration file in place, by running the following commands as root:Oracle Linux 4, Update 6 or Newer

# cd /etc/yum.repos.d # mv Oracle-Base.repo Oracle-Base.repo.disabled # wget http://public-yum.oracle.com/public-yum-el4.repo

Oracle Linux 5

# cd /etc/yum.repos.d # wget http://public-yum.oracle.com/public-yum-el5.repo

Oracle Linux 6

# cd /etc/yum.repos.d # wget http://public-yum.oracle.com/public-yum-ol6.repo

Oracle VM 2

# cd /etc/yum.repos.d # wget http://public-yum.oracle.com/public-yum-ovm2.repo

3. Enable the appropriate repository by editing the yum configuration file

Open the yum configuration file in a text editor

Locate the section in the file for the repository you plan to from, e.g. [el4_u6_base]Change enabled=0 to enabled=1

4. Begin using yum, for example:yum listyum install

You may be prompted to confirm the import of the Oracle OSS GPG key.

Oracle Linux有两种内核:兼容Red Hat Linux的内核(使⽤RHEL源代码编译)和Oracle⾃⼰的Unbreakable Enterprise内核。Oracle声明Unbreakable Enterprise内核兼容RHEL,Oracle中间件和经过RHEL认证的第三⽅应⽤程序可以不经过修改的在Unbreakable Enterprise内核上运⾏。

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- dcrkj.com 版权所有 赣ICP备2024042791号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务