rpm yum技巧(笔记)
1、安装
rpm –ivh fullname.rpm
2、升级、ftp升级
rpm –Uvh fullname.rpm
rpm –i ftp://…
3、卸载
rpm –e fullname.rpm
4、通过简写或文件夹名获得rpm包的全名
rpm –qf dir
rpm –qa name
5、获得已安装的rpm包的所有的安装目录
rpm –ql fullname.rpm
6、查看当前目录下的rpm包的信息
rpm –qpi fullname.rpm
7、查看当前目录下的rpm包的所要安装的目录
rpm –qpl fullname.rpm
8、解压rpm包的内容:(没有安装,就像解压tgz包一样rpm包)
rpm2cpio fullname.rpm | cpio -div
9、强制卸载
rpm -e --allmatches fullname
yum插件
1、自动寻找最快的源
yum install -y yum-fastestmirror
用推荐几个好的centos源,每个用rhel的人你都伤不起
1、163
sudo vim /etc/yum.repos.d/CentOS-Base.repo
[BASE]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=http://mirrors.163.com/centos/5.6/os/x86_64/
enabled=1
2、ustc
sudo vim /etc/yum.repos.d/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
priority = 1
#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
3、rpmforge [有报错]
wget http://rh-mirror.linux.iastate.edu/pub/dag/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
sudo rpm -ivh pmforge-release-0.5.2-2.el5.rf.x86_64.rpm
4、epel [这个靠谱]
http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
sudo rpm -ivh epel-release-5-4.noarch.rpm
sudo rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
设置/etc/yum.repos.d/epel.repo文件中源的级别,在[epel]末尾加上 priority=11