yum list kernel-debuginfo --showduplicates
## "Development Tools"
yum -y groupinstall "Development Tools"
## EPEL 源
yum -y install epel-release
## 编译环境,工具
yum -y install make cmake autoconf automake grep sed gawk curl curl-devel mysql-devel sqlite-devel wget vim zsh git subversion nmap nc tcpdump iptables iptables-services ipset NetworkManager NetworkManager-devel bind-utils telnet iproute net-tools tar zip unzip gzip bzip2 bzip2-devel tk-devel xz xz-devel p7zip pcre pcre-devel readline readline-devel gcc gcc-c++ gtk+-devel zlib-devel openssl openssl-devel pcre pcre-devel gd kernel keyutils patch perl perl-devel perl-libs python python-devel python-libs python-pip ruby ruby-devel ruby-libs lua lua-devel kernel-headers compat* cpp glibc libgomp libstdc++-devel keyutils-libs-devel libsepol-devel libselinux-devel krb5-devel libXpm* freetype freetype-devel freetype* fontconfig fontconfig-devel libjpeg* libpng* gettext gettext-devel ncurses ncurses-devel libtool* libxml2 libxml2-devel patch policycoreutils bison texinfo acpica-tools libuuid-devel glib2 glib2-devel libaio-devel yajl-devel glibc-devel glibc-devel.i686 pixman-devel bc perl-DBI mailx xorg-x11-xauth xorg-x11-server-utils xterm --skip-broken
## yum常用参数
yum check-update # 检查是否有更新
yum update -y # 更新软件包
yum provides xhost # 查询哪个rpm包提供了xhost命令
yum search telnet # 查询rpm包
yum deplist nginx # 查看nginx包依赖
yum clean all # 清除dbcache headers packages metadata
yum clean dbcache
yum clean headers
yum clean metadata
yum clean packages
# 重建yum缓存
yum clean all
yum makecache
yum makecache fast # 建立fast_mirrors缓存
rpm -qf `which ipset` # 查询ipset属于哪个rpm包
## yum常用插件
yum -y install yum-plugin-fastestmirror
---------------------
1.列出所有可更新的软件清单
命令:yum check-update
2.安装所有更新软件
命令:yum update
3.仅安装指定的软件
命令:yum install <package_name>
4.仅更新指定的软件
命令:yum update <package_name>
5.列出所有可安裝的软件清单
命令:yum list
1.用YUM安装软件包
命令:yum install <package_name>
2.用YUM删除软件包
命令:yum remove <package_name>
用YUM查询软件信息
我 们常会碰到这样的情况,想要安装一个软件,只知道它和某方面有关,但又不能确切知道它的名字。这时yum的查询功能就起作用了。你可以用yum search keyword这样的命令来进行搜索,比如我们要则安装一个Instant Messenger,但又不知到底有哪些,这时不妨用 yum search messenger这样的指令进行搜索,yum会搜索所有可用rpm的描述,列出所有描述中和messeger有关的rpm包,于 是我们可能得到gaim,kopete等等,并从中选择。
有时我们还会碰到安装了一个包,但又不知道其用途,我们可以用yum info packagename这个指令来获取信息。
1.使用YUM查找软件包
命令:yum search <keyword>
2.列出所有可安装的软件包
命令:yum list
3.列出所有可更新的软件包
命令:yum list updates
4.列出所有已安装的软件包
命令:yum list installed
5.列出所有已安装但不在 Yum Repository 內的软件包
命令:yum list extras
6.列出所指定的软件包
命令:yum list <package_name>
7.使用YUM获取软件包信息
命令:yum info <package_name>
8.列出所有软件包的信息
命令:yum info
9.列出所有可更新的软件包信息
命令:yum info updates
10.列出所有已安裝的软件包信息
命令:yum info installed
11.列出所有已安裝但不在 Yum Repository 內的软件包信息
命令:yum info extras
12.列出软件包提供哪些文件
命令:yum provides <package_name>
清除YUM缓存
yum 会把下载的软件包和header存储在cache中,而不会自动删除。如果我们觉得它们占用了磁盘空间,可以使用yum clean指令进行清除,更精确 的用法是yum clean headers清除header,yum clean packages清除下载的rpm包,yum clean all一 股脑儿端
1.清除缓存目录(/var/cache/yum)下的软件包
命令:yum clean packages
2.清除缓存目录(/var/cache/yum)下的headers
命令:yum clean headers
3.清除缓存目录(/var/cache/yum)下旧的 headers
命令:yum clean oldheaders
4.清除缓存目录(/var/cache/yum)下的软件包及旧的headers
命令:yum clean, yum clean all (= yum clean packages; yum clean oldheaders)
------------------------------------------------------------------------------------------------------------
1.确保RHEL5中已经安装了yum。
[root@lvs-master ~]# rpm -qa |grep yum
yum-metadata-parser-1.1.2-3.el5
yum-updatesd-0.9-2.el5
yum-3.2.22-26.el5
yum-security-1.1.16-13.el5
yum-rhn-plugin-0.5.4-15.el5
2.修改源配置文件 #vim /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-5-Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#released updates
[update]
name=CentOS-5-Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#packages used/produced in the build but not released
[addons]
name=CentOS-5-Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that may be useful
[extras]
name=CentOS-5-Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5-Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5-Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# vi dag.repo
[dag]
name=Dag RPM Repository for RHEL5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt
3. 导入key
#rpm --import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
4. 运行,测试
#yum update
5.#yum clean all
方法二:
# cd /etc/yum.repos.d/
#mv CentOS-Base.repo CentOS-Base.repo.bak
#wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
该文件内容如下:
[base]
name=CentOS-5 - Base
baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#released updates
[update]
name=CentOS-5 - Updates
baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
baseurl=http://centos.ustc.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
baseurl=http://centos.ustc.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#packages in testing
[testing]
name=CentOS-5 - Testing
baseurl=http://centos.ustc.edu.cn/centos/5/testing/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5