rpm包:
RPM 全名是『 RedHat Package Manager 』简称则为 RPM。RPM 是以一种数据库记录的方式来将你所需要的套件安装到你的 Linux 主机的一套管理程序。他最大的特点就是将您要安装的套件先编译过( 如果需要的话 )并且打包好了,透过包装好的套件里头预设的数据库记录,记录这个套件要安装的时候必须要的相依属性模块( 就是你的 Linux 主机需要先存在的几个必须的套件 ),当安装在你的 Linux 主机时, RPM 会先依照套件里头的纪录数据查询 Linux 主机的相依属性套件是否满足, 若满足则予以安装,若不满足则不予安装。那么安装的时候就将该套件的信息整个写入 RPM 的数据库中,以便未来的查询、验证与反安装!这样一来的优点是:
1. 由于已经编译完成并且打包完毕,所以安装上很方便( 不需要再重新编译 );
2. 由于套件的信息都已经记录在 Linux 主机的数据库上,很方便查询、升级与反安装;
缺点是:
1. 安装的环境必须与打包时的环境需求一致或相当;
2. 需要满足套件的相依属性需求;
3. 反安装时需要特别小心,最底层的套件不可先移除,否则可能造成整个系统的问题!
程序包的组成部分:
二进制程序:/bin, /sbin,/ /usr/bin, /usr/sbin,
库文件:/lib64, /usr/lib64
配置文件:/etc
帮助文件:manual, info,
分包机制:
testapp-VERSION.tar.gz
核心包:testapp-VERSION
支包:testapp-devel-VERSION
VERSION:major.minor.release
base-4.2.4.tar.gz
rpm包的命名机制:
name-VERSION-RELEASE.ARCH.rpm
zsh-5.0.2-7.el7.x86_64.rpm zsh:包的名字 5.0.2:版本号 7.e17:这个软件包的发行商版本,本包为rhel7或者centos7上使用 x86_64:支持系统硬件平台 rpm:包的类型.rpm是编译好的二进制包,可用rpm命令直接安装;.src.rpm表示是源
bash-devel-4.2.4-1.el7.x86_64.rpm
devel:为开发版本 除此之外,还有其他的几个参数选项: noarch:说明这样的软件包可以在任何平台上安装,不需要特定的硬件平台。在任何硬件平台上都可以运行。 manual 手册文档。
RELEASE: rpm release
包和包之间:有可能存在依赖关系:
X --> Y x包是Y包安装的先决条件
[root@localhost Packages]# rpm -ivh vsftpd-3.0.2-9.el7.x86_64.rpm warning: vsftpd-3.0.2-9.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] package vsftpd-3.0.2-9.el7.x86_64 is already installed [root@localhost Packages]#
rpm数据库:/var/lib/rpm/
如何获取rpm包:
1、发行版提供的程序包;一般在光盘镜像的Packages文件夹下
2、Fedora-EPEL
3、项目的官方站点
4、搜索引擎
http://rpmfind.net
http://rpm.pbone.net
http://pkgs.org
CentOS识别光盘用的设备文件:/dev/cdrom
基于rpm命令实现程序包管理:
安装:
rpm {-i|--install} [install-options] PACKAGE_FILE ...
-i:
-v:显示详细过程,-vv, -vvv
-h:每个rpm包都提供一个或多个capabilities
--nodeps:忽略依赖关系安装
--replacepkgs:重装程序包
升级:
rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...
rpm {-F|--freshen} [install-options] PACKAGE_FILE ...
-Uvh: 如果有旧版程序包,则升级之;如果没有,则安装之;
-Fvh: 如果有旧版程序包,则升级之;如果没有,则不安装;
--nodeps
--oldpackage:降级;
--force:
卸载:
rpm {-e|--erase} [--nodeps] [--noscripts] [--notriggers] [--test] PACKAGE_NAME ...
查询:
rpm {-q|--query} [select-options] [query-options]
查询选项:
-qa: 查询本机已经安装的所有程序包;
[root@localhost Packages]# rpm -qa vsftpd vsftpd-3.0.2-9.el7.x86_64 [root@localhost Packages]#
-qf /PATH/TO/SOMEFILE: 查询此处的文件由哪个程序包安装生成;
-qc: 查询指定程序包安装生成的配置文件
[root@localhost Packages]# rpm -qc vsftpd /etc/logrotate.d/vsftpd /etc/pam.d/vsftpd /etc/vsftpd/ftpusers /etc/vsftpd/user_list /etc/vsftpd/vsftpd.conf
-qd: 查询指定的程序包安装生成的文档
[root@localhost Packages]# rpm -qd vsftpd /usr/share/doc/vsftpd-3.0.2/AUDIT /usr/share/doc/vsftpd-3.0.2/BENCHMARKS /usr/share/doc/vsftpd-3.0.2/BUGS /usr/share/doc/vsftpd-3.0.2/COPYING /usr/share/doc/vsftpd-3.0.2/Changelog /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.conf /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/hosts.allow /usr/share/doc/vsftpd-3.0.2/EXAMPLE/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/logins.txt /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2/README /usr/share/doc/vsftpd-3.0.2/FAQ /usr/share/doc/vsftpd-3.0.2/INSTALL /usr/share/doc/vsftpd-3.0.2/LICENSE /usr/share/doc/vsftpd-3.0.2/README /usr/share/doc/vsftpd-3.0.2/README.security /usr/share/doc/vsftpd-3.0.2/REWARD /usr/share/doc/vsftpd-3.0.2/SECURITY/DESIGN /usr/share/doc/vsftpd-3.0.2/SECURITY/IMPLEMENTATION /usr/share/doc/vsftpd-3.0.2/SECURITY/OVERVIEW /usr/share/doc/vsftpd-3.0.2/SECURITY/TRUST /usr/share/doc/vsftpd-3.0.2/SIZE /usr/share/doc/vsftpd-3.0.2/SPEED /usr/share/doc/vsftpd-3.0.2/TODO /usr/share/doc/vsftpd-3.0.2/TUNING /usr/share/doc/vsftpd-3.0.2/vsftpd.xinetd /usr/share/man/man5/vsftpd.conf.5.gz /usr/share/man/man8/vsftpd.8.gz
-qi: 查询指定的程序包的相关信息;
[root@localhost Packages]# rpm -qi vsftpd Name : vsftpd Version : 3.0.2 Release : 9.el7 Architecture: x86_64 Install Date: Sun 13 Sep 2015 01:41:34 PM CST Group : System Environment/Daemons Size : 351462 License : GPLv2 with exceptions Signature : RSA/SHA256, Thu 03 Apr 2014 05:54:58 AM CST, Key ID 199e2f91fd431d51 Source RPM : vsftpd-3.0.2-9.el7.src.rpm Build Date : Fri 07 Mar 2014 05:58:22 PM CST Build Host : x86-025.build.eng.bos.redhat.com Relocations : (not relocatable) Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Vendor : Red Hat, Inc. URL : https://security.appspot.com/vsftpd.html Summary : Very Secure Ftp Daemon Description : vsftpd is a Very Secure FTP daemon. It was written completely from scratch.
-ql: 查询程序包安装生成的所有文件的列表;
[root@localhost Packages]# rpm -ql vsftpd /etc/logrotate.d/vsftpd /etc/pam.d/vsftpd /etc/vsftpd /etc/vsftpd/ftpusers /etc/vsftpd/user_list /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd_conf_migrate.sh /usr/lib/systemd/system-generators/vsftpd-generator /usr/lib/systemd/system/vsftpd.service /usr/lib/systemd/system/vsftpd.target /usr/lib/systemd/system/vsftpd@.service /usr/sbin/vsftpd /usr/share/doc/vsftpd-3.0.2 /usr/share/doc/vsftpd-3.0.2/AUDIT /usr/share/doc/vsftpd-3.0.2/BENCHMARKS /usr/share/doc/vsftpd-3.0.2/BUGS /usr/share/doc/vsftpd-3.0.2/COPYING /usr/share/doc/vsftpd-3.0.2/Changelog /usr/share/doc/vsftpd-3.0.2/EXAMPLE /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.conf /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/hosts.allow /usr/share/doc/vsftpd-3.0.2/EXAMPLE/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/logins.txt /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2 /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2/README /usr/share/doc/vsftpd-3.0.2/FAQ /usr/share/doc/vsftpd-3.0.2/INSTALL /usr/share/doc/vsftpd-3.0.2/LICENSE /usr/share/doc/vsftpd-3.0.2/README /usr/share/doc/vsftpd-3.0.2/README.security /usr/share/doc/vsftpd-3.0.2/REWARD /usr/share/doc/vsftpd-3.0.2/SECURITY /usr/share/doc/vsftpd-3.0.2/SECURITY/DESIGN /usr/share/doc/vsftpd-3.0.2/SECURITY/IMPLEMENTATION /usr/share/doc/vsftpd-3.0.2/SECURITY/OVERVIEW /usr/share/doc/vsftpd-3.0.2/SECURITY/TRUST /usr/share/doc/vsftpd-3.0.2/SIZE /usr/share/doc/vsftpd-3.0.2/SPEED /usr/share/doc/vsftpd-3.0.2/TODO /usr/share/doc/vsftpd-3.0.2/TUNING /usr/share/doc/vsftpd-3.0.2/vsftpd.xinetd /usr/share/man/man5/vsftpd.conf.5.gz /usr/share/man/man8/vsftpd.8.gz /var/ftp /var/ftp/pub
-q --scripts:查询程序包相关的脚本:
preinstall: 安装前脚本
postinstall:安装后脚本
preuninstall: 卸载前脚本
postuninstall: 卸载后脚本
-p: 查询针对是未安装的程序包文件;
校验:
rpm {-V|--verify} [select-options] [verify-options]
S file Size differs
M Mode differs (includes permissions and file type)
5 digest (formerly MD5 sum) differs
D Device major/minor number mismatch
L readLink(2) path mismatch
U User ownership differs
G Group ownership differs
T mTime differs
P caPabilities differ
[root@localhost Packages]# rpm --verify vsftpd [root@localhost Packages]# rpm -ql vsftpd /etc/logrotate.d/vsftpd /etc/pam.d/vsftpd /etc/vsftpd /etc/vsftpd/ftpusers /etc/vsftpd/user_list /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd_conf_migrate.sh /usr/lib/systemd/system-generators/vsftpd-generator /usr/lib/systemd/system/vsftpd.service /usr/lib/systemd/system/vsftpd.target /usr/lib/systemd/system/vsftpd@.service /usr/sbin/vsftpd /usr/share/doc/vsftpd-3.0.2 /usr/share/doc/vsftpd-3.0.2/AUDIT /usr/share/doc/vsftpd-3.0.2/BENCHMARKS /usr/share/doc/vsftpd-3.0.2/BUGS /usr/share/doc/vsftpd-3.0.2/COPYING /usr/share/doc/vsftpd-3.0.2/Changelog /usr/share/doc/vsftpd-3.0.2/EXAMPLE /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.conf /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/hosts.allow /usr/share/doc/vsftpd-3.0.2/EXAMPLE/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README.configuration /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/logins.txt /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2 /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2/README /usr/share/doc/vsftpd-3.0.2/FAQ /usr/share/doc/vsftpd-3.0.2/INSTALL /usr/share/doc/vsftpd-3.0.2/LICENSE /usr/share/doc/vsftpd-3.0.2/README /usr/share/doc/vsftpd-3.0.2/README.security /usr/share/doc/vsftpd-3.0.2/REWARD /usr/share/doc/vsftpd-3.0.2/SECURITY /usr/share/doc/vsftpd-3.0.2/SECURITY/DESIGN /usr/share/doc/vsftpd-3.0.2/SECURITY/IMPLEMENTATION /usr/share/doc/vsftpd-3.0.2/SECURITY/OVERVIEW /usr/share/doc/vsftpd-3.0.2/SECURITY/TRUST /usr/share/doc/vsftpd-3.0.2/SIZE /usr/share/doc/vsftpd-3.0.2/SPEED /usr/share/doc/vsftpd-3.0.2/TODO /usr/share/doc/vsftpd-3.0.2/TUNING /usr/share/doc/vsftpd-3.0.2/vsftpd.xinetd /usr/share/man/man5/vsftpd.conf.5.gz /usr/share/man/man8/vsftpd.8.gz /var/ftp /var/ftp/pub [root@localhost Packages]# vi /etc/vsftpd/user_list [root@localhost Packages]# rpm --verify vsftpd S.5....T. c /etc/vsftpd/user_list
包校验:
来源合法性验正:非对称加密
完整性验正:单向加密
导入密钥:rpm --import /PATH/TO/KEY_FILE
校验:rpm -K /PATH/TO/RPM_FILE
YUM: Yellowdog Updater Modified
yum repositories:
文件服务器:
ftp://hostname/PATH/TO/REPO
http://hostname/PATH/TO/REPO
file:///PATH/TO/REPO
yum程序的配置文件:
/etc/yum.conf
定义全局配置:对所有仓库都适用的配置
/etc/yum.repos.d/*.repo
一个文件通常用于一个或一组功能相近或相关的仓库
定义一个仓库指向:
[REPO_ID]
name=
baseurl=
# mirrorlist=SCHEME://HOSTNAME/PATH/TO/MIRROR_LIST_FILE
enabled={1|0}
gpgcheck={1|0}
gpgkey=
cost=
定义仓库指向可用变量:
$releasever: 引用当前系统的主版本号;
$basearch: 当前系统的基本架构;
i386, i486, i586, i686: i386
http://mirrors.magedu.com/CentOS/$releasever/os/$basearch
yum命令:
yum [options] [command] [package ...]
命令:
安装:install
[root@localhost Packages]# rpm -e vsftpd warning: /etc/vsftpd/user_list saved as /etc/vsftpd/user_list.rpmsave [root@localhost Packages]# yum install -y vsftp Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. No package vsftp available. Error: Nothing to do [root@localhost Packages]# yum install -y vsftp* Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Examining vsftpd-3.0.2-9.el7.x86_64.rpm: vsftpd-3.0.2-9.el7.x86_64 Marking vsftpd-3.0.2-9.el7.x86_64.rpm to be installed Resolving Dependencies There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don‘t work you‘ll have to try removing/installing packages by hand (maybe package-cleanup can help). --> Running transaction check ---> Package vsftpd.x86_64 0:3.0.2-9.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================== Package Arch Version Repository Size =========================================================================== Installing: vsftpd x86_64 3.0.2-9.el7 /vsftpd-3.0.2-9.el7.x86_64 343 k Transaction Summary =========================================================================== Install 1 Package Total size: 343 k Installed size: 343 k Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : vsftpd-3.0.2-9.el7.x86_64 1/1 Verifying : vsftpd-3.0.2-9.el7.x86_64 1/1 Installed: vsftpd.x86_64 0:3.0.2-9.el7 Complete! [root@localhost Packages]#
卸载:remove
[root@localhost ~]# yum remove vsftpd -y Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Resolving Dependencies There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don‘t work you‘ll have to try removing/installing packages by hand (maybe package-cleanup can help). --> Running transaction check ---> Package vsftpd.x86_64 0:3.0.2-9.el7 will be erased --> Finished Dependency Resolution yum | 4.1 kB 00:00 yum/group_gz | 134 kB 00:00 yum/primary_db | 3.4 MB 00:00 Dependencies Resolved =========================================================================== Package Arch Version Repository Size =========================================================================== Removing: vsftpd x86_64 3.0.2-9.el7 @/vsftpd-3.0.2-9.el7.x86_64 343 k Transaction Summary =========================================================================== Remove 1 Package Installed size: 343 k Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : vsftpd-3.0.2-9.el7.x86_64 1/1 Verifying : vsftpd-3.0.2-9.el7.x86_64 1/1 Removed: vsftpd.x86_64 0:3.0.2-9.el7 Complete! [root@localhost ~]#
升级:update
[root@localhost Packages]# yum update vsftpd* -y Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Examining vsftpd-3.0.2-9.el7.x86_64.rpm: vsftpd-3.0.2-9.el7.x86_64 vsftpd-3.0.2-9.el7.x86_64.rpm: does not update installed package. No packages marked for update [root@localhost Packages]#
查询:
info
[root@localhost ~]# yum info ftp Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Installed Packages Name : ftp Arch : x86_64 Version : 0.17 Release : 66.el7 Size : 96 k Repo : installed From repo : /ftp-0.17-66.el7.x86_64 Summary : The standard UNIX FTP (File Transfer Protocol) client URL : ftp://ftp.linux.org.uk/pub/linux/Networking/netkit License : BSD with advertising Description : The ftp package provides the standard UNIX command-line FTP : (File Transfer Protocol) client. FTP is a widely used : protocol for transferring files over the Internet and for : archiving files. : : If your system is on a network, you should install ftp in : order to do file transfers.
search KEYWORD
list all|installed|availiable
provides /PATH/TO/SOMEFILE: 查询指定文件由哪个包安装生成
重新安装:reinstall
降级:downgrade
清理缓存:clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]
生动生成缓存:makecache
包组:
grouplist
groupinfo "GRP_NAME"
groupinstall "GRP_NAME"
groupremove "GRP_NAME"
仓库:
repolist [all|enabled|disabled]
repoinfo [all|enabled|disabled]
如何使用光盘当做本地仓库:
挂载光盘至某目录
定义仓库,使用file:///指明其访问路径;
创建本地仓库:
yum install createrepo
[root@localhost ~]# mount /dev/cdrom /mnt/ mount: /dev/sr0 is write-protected, mounting read-only [root@localhost ~]# mkdir -p /home/aa [root@localhost ~]# cd /mnt/ [root@localhost mnt]# ls addons images Packages RPM-GPG-KEY-redhat-release EFI isolinux release-notes TRANS.TBL EULA LiveOS repodata GPL media.repo RPM-GPG-KEY-redhat-beta [root@localhost mnt]# cp -R * /home/aa/ [root@localhost mnt]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# ll total 8 -rw-r--r--. 1 root root 358 May 15 15:19 redhat.repo -rw-r--r--. 1 root root 61 May 15 15:19 aa.repo [root@localhost yum.repos.d]# cat aa.repo [aa] name=aa baseurl=file:///home/aa/ gpgcheck=0 enable=1 [root@localhost yum.repos.d]# [root@localhost yum.repos.d]# yum install createrepo Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Package createrepo-0.9.9-23.el7.noarch already installed and latest version Nothing to do [root@localhost yum.repos.d]#
createrepo /PATH/TO/RPMFILES/
原文地址:http://canshan.blog.51cto.com/2613522/1694336