[[email protected] rh]# pwd
/opt/rh
[[email protected] rh]# ls
rhel-server-6.4-x86_64-dvd.iso
[[email protected] rh]#mkdir /mnt/cdrom
[[email protected] dev]# mount -v -t iso9660 -o loop /opt/rh/rhel-server-6.4-x86_64-dvd.iso /mnt/cdrom/
mount: going to use the loop device /dev/loop0
/opt/rh/rhel-server-6.4-x86_64-dvd.iso on /mnt/cdrom type iso9660 (rw,loop=/dev/loop0)
[[email protected] yum.repos.d]# vim rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
清除原有缓存
[[email protected] cdrom]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel-source
Cleaning up Everything
获取yum列表
验证yum配置是否成功
[[email protected] cdrom]# yum makecache
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel-source | 3.9 kB 00:00 ...
rhel-source/group_gz | 204 kB 00:00 ...
rhel-source/filelists_db | 3.7 MB 00:00 ...
rhel-source/primary_db | 3.1 MB 00:00 ...
rhel-source/other_db | 1.5 MB 00:00 ...
Metadata Cache Create
验证yum配置是否成功
[[email protected] cdrom]# yum grouplist | grep Server
Network Infrastructure Server
Print Server
Web Server
Backup Server
Directory Server
Identity Management Server
Network Storage Server
Server Platform
Server Platform Development
Systems Management Messaging Server support
查找软件包
yum list available #列出可供安装的软件包
yum list installed #列出已安装的软件包
yum list extras #列出不是通过仓库安装的软件包
yum list *vorbis*#列出标题包含vorbis的软件包
yum list updates #列出可以更新的软件包
yum info wordpress #wordpress软件包说明
yum info word* #以word开头的软件包说明
yum search mp3 #查找包含字符串mp3的软件包
安装软包
yum install wordpress
yum groupinstall XFCE #安装整套XFCE桌面软件包
更新软件包
yum check-update #列出所有可更新的软件包
yum list updates openoffice* #查找openoffice*的更新
yum update #更新所有可更新的软件包
删除软件包
yum remove beagle #删除beagle 软件包
yum remove xscreen* 删除xscreen开头的软件包
yum groupremove XFCE 删除XFCE的组内的所有软件包
清除软件包
yum clean packages #清除遗留在缓存里的包文件
yum clean metadata #清除遗留在缓存里的元数据
yum clean headers #清除遗留在缓存里的头文件
yum clean all #清除元数据,头文件和包文件
rpm安装软妹包
rpm -ivh rpmforge-release-*.rpm
rpm -ivh http://ftp************.rpm
rpm升级软件包
rpm -Uhv *.rpm
删除软件包
rpm -e rpmforge-release
rpm -e --nodeps rpmforge-release
查询rpm包相关信息
rpm -q rsync #版本信息
rpm -qp ***.rpm #获取当前目录下rpm包的相关信息
rpm -qa|less #列出系统中已安装的所有软件包
rpm -qf /etc/sysctl.conf #检查系统里某个文件以查看该文件属于哪个软件包
rpm -qi rpmforge-release #列出已安装软件包的标准信息信息
rpm -qlp *.rpm |less #列出rpm文件的内容
rpm -q --scripts kernel |less #列出已安装的rpm包自带的安装前和安装后脚本