程序包管理  
    内核功能:进程管理   内存管理  网络协议栈  驱动程序    
   
    包管理器  : 打包  ,包管理 (安装,升级,卸载,查询及校验) 
        deb     debian    (debina 包管理器)
        rpm     redhat   (redhat package manager)    
            rpm is package manager     

    使用源码编译安装,无法使用包管理器进行管理。


    程序包的组成部分    
        二进制程序:    /bin  /sbin  /usr/bin   /usr/sbin    
        库文件:           /lib64  /usr/lib64    
        配置文件:       /etc    
        帮助文件:       manual  info   readme  install    
   
    包管理器    
        打包:        一个单一的归档文件中    
        安装:        把对应的文件种类放到对应的目录    
        卸载:        删除对应的程序    
        升级:        替换老板本程序    
        查询:       
        校验:       来源的合法性,包的完整性    
   
    rpm包:       
        rpmbulid:        基于specs文件 ,specs文件为打包方法的说明。   
        
        分包机制:      将一个应用程序,各种功能根据须要打包成多个安装包。  
        
        命名机制:    
            版本名命机制:  主版本号.次版本号.发行修正号  

                                            4.2.4
            包命名机制:      包名-版本号-RPM包发行修正号.架构.rpm    
                                     bash-4.2.4-1.el7.x86_64.rpm    
                                     bash-devel-4.2.4-1.el7.x86_64.rpm    
           
        包和包之间: 有可能存在依赖关系    
       
        rpm数据库位置: /var/lib/rpm/    
       
        如何获取rpm包    
            1.发行版提供的程序包    
            2.Fedora-EPEL    
            3.项目的官方站点    
            4.搜索引擎 
                           http://rpmfind.net    
                           http://rpm.pbone.net    
                           http://pkgs.org

        查看光盘的rpm包

mkdir /media/cdrom   
mount -r /dev/cdrom /media/cdrom
cd /media/cdrom/Packages/           #发行版光盘包所在的目录,光盘目录下Packages/ 
ls | wc -l

   
rpm 命令    
        每个rpm包都提供一个或多个capabilities    
       
        INSTALLING, UPGRADING, AND REMOVING PACKAGES:    
        rpm {-i|--install} [install-options] PACKAGE_FILE ...                      安装    
       
        rpm -ivh  PACKAGES      安装程序包并显示安装进度条

        rpm -ivh     rpm 

                -v               Print verbose information
                -i,--install
                -h, --hash    

例如:

rpm -ivh php-5.4.16-23.el7_0.3.x86_64.rpm           #提示安装失败

会提示依赖包检测失败,必须先安装依赖的包 才能安装,或者使用--nodeps 参数忽略依赖,安装的程序会不能使用

rpm -ivh php-common-5.4.16-23.el7_0.3.x86_64.rpm     #同样安装失败,依赖libzip
rpm -ivh  libzip-0.10.1-8.el7.x86_64.rpm

Linux包管理 rpm yum

可以同时安装两个包 或者多个包

例如,一次安装三个包

rpm -ivh php-cli-5.4.16-23.el7_0.3.x86_64.rpm php-common-5.4.16-23.el7_0.3.x86_64.rpm php-5.4.16-23.el7_0.3.x8686_64.rpm php-5.4.16-23.el7_0.3.x86_64.rpm

Linux包管理 rpm yum

        rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...                升级    
        rpm {-F|--freshen} [install-options] PACKAGE_FILE ...    
       
        rpm –Uvh        如果有旧版程序包,则升级 ,如果没有,则安装    
        rpm –Fvh         如果有旧版程序包,则升级 ,如果没有,则不安装    
       
        rpm {-e|--erase} [--allmatches] [--nodeps] [—noscripts]             卸载    
           [--notriggers] [--test] PACKAGE_NAME ...    

例: 删除之前安装的php-5.4.16      

查询之前安装的php

rpm -qa | grep php

删除php-5.4.16 ,删除可以不带详细信息 ,如果不带-v参数,没有任何显示。

rpm -ev php

在次查询是否删除

rpm -qa | grep php

Linux包管理 rpm yum


        -v         显示进度条    
        -vv       显示debugging安装信息

        
        [install-options]    
        --nodeps            忽略依赖关系    
        --replacepkgs    重装程序包    
        --test                   仅测试程序包    
        --oldpackage     降级    
        --force                 强制

        QUERYING AND VERIFYING PACKAGES:                                        查询  
        rpm {-q|--query} [select-options] [query-options]    
        rpm {-V|--verify} [select-options] [verify-options]    
       
        rpm –qa                                    查询安装的全部包    
        rpm -qf /path/to/somefile       查询此处的文件是哪个程序包安装生产的    
        rpm –qp                                    查询未安装的程序包安装后生产的文件    
        rpm –qc                                     查询指定程序包安装生成的配置文件    
        rpm –qd                                    查询指定程序包安装生成的帮助文件    
        rpm –qi                                     查询指定程序包安装生成的相关信息    
        rpm –ql                                     查询指定程序包安装生成的所有文件的列表    
        rpm –qR                                    查询指定程序包安装依赖关系    
            --provides                             查询指定程序包安装自已提供的功能    
        rpm -q –scripts                         查询指定程序包的相关的脚本    
                preinstall                          安装前脚本    
                postinstall                        安装后脚本    
                preuninstall                      卸载前脚本    
                postuninstall                    卸载后脚本    

rpm -qf /etc/httpd/conf.d/php.conf

php-5.4.16-23.el7_0.3.x86_64

rpm -qc php

/etc/httpd/conf.d/php.conf
/etc/httpd/conf.modules.d/10-php.conf

rpm -qi php

Name        : php
Version     : 5.4.16
Release     : 23.el7_0.3
Architecture: x86_64
Install Date: 2015年09月14日 星期一 15时15分46秒
Group       : Development/Languages
Size        : 4595894
License     : PHP and Zend and BSD
Signature   : RSA/SHA256, 2014年10月31日 星期五 22时24分33秒, Key ID 24c6a8a7f4a80eb5
Source RPM  : php-5.4.16-23.el7_0.3.src.rpm
Build Date  : 2014年10月31日 星期五 21时07分27秒
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.php.net/
Summary     : PHP scripting language for creating dynamic web sites
Description :
PHP is an HTML-embedded scripting language. PHP attempts to make it
easy for developers to write dynamically generated web pages. PHP also
offers built-in database integration for several commercial and
non-commercial database management systems, so writing a
database-enabled webpage with PHP is fairly simple. The most common
use of PHP coding is probably as a replacement for CGI scripts.

The php package contains the module (often referred to as mod_php)
which adds support for the PHP language to Apache HTTP Server.

rpm -qR php

httpd-mmn = 20120211x8664
php-common(x86-64) = 5.4.16-23.el7_0.3
php-cli(x86-64) = 5.4.16-23.el7_0.3
httpd
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(CompressedFileNames) <= 3.0.4-1
libbz2.so.1()(64bit)
libcom_err.so.2()(64bit)
libcrypto.so.10()(64bit)
libcrypto.so.10(libcrypto.so.10)(64bit)
libcrypto.so.10(OPENSSL_1.0.1)(64bit)
libcrypt.so.1()(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.11)(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.15)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
libc.so.6(GLIBC_2.8)(64bit)
libdl.so.2()(64bit)
libdl.so.2(GLIBC_2.2.5)(64bit)
libgmp.so.10()(64bit)
libgssapi_krb5.so.2()(64bit)
libk5crypto.so.3()(64bit)
libkrb5.so.3()(64bit)
libm.so.6()(64bit)
libm.so.6(GLIBC_2.2.5)(64bit)
libnsl.so.1()(64bit)
libpcre.so.1()(64bit)
libresolv.so.2()(64bit)
libresolv.so.2(GLIBC_2.2.5)(64bit)
librt.so.1()(64bit)
libssl.so.10()(64bit)
libssl.so.10(libssl.so.10)(64bit)
libxml2.so.2()(64bit)
libxml2.so.2(LIBXML2_2.4.30)(64bit)
libxml2.so.2(LIBXML2_2.5.2)(64bit)
libxml2.so.2(LIBXML2_2.6.0)(64bit)
libxml2.so.2(LIBXML2_2.6.11)(64bit)
libxml2.so.2(LIBXML2_2.6.5)(64bit)
libxml2.so.2(LIBXML2_2.9.0)(64bit)
libz.so.1()(64bit)
rtld(GNU_HASH)
rpmlib(PayloadIsXz) <= 5.2-1

 

        
        rpm {-V|--verify} [select-options] [verify-options]                     校验    
        rpm -V   
        
        校验字段说明    
        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    
       
       包校验:    
        来源的合法性验证              非对称加密    
        包的完整性验证                  单向加密    
        /etc/pki/rpm-gpg/           公钥信息存放位置    
       
        rpm --import RPM-GPG-KEY-CentOS-7        导入**    
       
        rpm –K                             手动校验包

例 

rpm -qp zsh-5.0.2-7.el7.x86_64.rpm

警告:zsh-5.0.2-7.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, ** ID f4a80eb5: NOKEY
zsh-5.0.2-7.el7.x86_64

cd ..
rpm --import RPM-GPG-KEY-CentOS-7 
cd Packages
rpm -qp zsh-5.0.2-7.el7.x86_64.rpm

zsh-5.0.2-7.el7.x86_64              # 不在有警告显示

rpm -K mysql-connector-odbc-5.2.5-6.el7.x86_64.rpm

mysql-connector-odbc-5.2.5-6.el7.x86_64.rpm: rsa sha1 (md5) pgp md5 确定
 

YUM   Yellowdog Updater Modified  
        yum repositories : yum 仓库    
            文件服务器:    
                ftp:    
                http:    
                file:    
        /etc/yum.conf                              全局配置    
        /etc/yum.repos.d/*.repo            一个文件通常用于一个或一组功能相近或相关的仓库    
        /etc/yum/pluginconf.d/    
        /etc/yum/protected.d    
        /etc/yum/vars    

    定义一个仓库的指向   
        [repo_ID]   
        name=                       名字   
        baseurl=               
        #mirrorlist=                文件的repo路径   和baseurl 二选一   
        enable={1|0}                   
        gpgcheck={1|0}              校验文件   
        gpgkey=                     指定校验的key   
        cost=                          多个仓库的优先级(越小越优先)   默认1000 

[centosplus]    
name=CentOS-$releasever - Plus    
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra    
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/    
gpgcheck=1    
enabled=0    
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 

定义仓库指向的可用变量   
            $releasever            当前系统的主版本号   
            $basearch               当前系统的基本架构    

自定义源

cd /etc/yum.repos.d/
vim CentOS-aliyun.repo
[CenOS-aliyun]
name=CenOS-aliyun
#mirrorlist=
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/x86_64/
gpgcheck=1
cost=500
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 yum repolist   #查看所有的源

已加载插件:fastestmirror, langpacks
CenOS-aliyun                                                             | 3.4 kB  00:00:00    
base                                                                            | 3.6 kB  00:00:00    
extras                                                                          | 3.4 kB  00:00:00    
updates                                                                      | 3.4 kB  00:00:00    
CenOS-aliyun/primary_db                                          | 1.6 MB  00:00:01    
Loading mirror speeds from cached hostfile
 * base: mirrors.hust.edu.cn
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.aliyun.com
源标识                                          源名称                                            状态
CenOS-aliyun                              CenOS-aliyun                                53
base/7/x86_64                             CentOS-7 - Base                           8,652
extras/7/x86_64                           CentOS-7 - Extras                         181
updates/7/x86_64                        CentOS-7 - Updates                     1,322

    
使用光盘当作本地仓库

cd /etc/yum.repos.d/
vim Centos-local.repo   
[centosISO]    
name=CentOS-ISO    
#mirrorlist=
baseurl=file:///media/cdrom    
gpgcheck=1    
cost=100     
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY

 

创建本地仓库               

yum install createrepo                
createrepo /path/to/file

      
 yum 命令   
        yum [options] [command] [package ...]   
        yum  install                       安装程序   
        yum  remove                    卸载,卸载的同时会卸载依赖的包   
        yum  update                     升级   
        yum  check-update          检查是否有升级的程序   
        yum  info                          查询,不论安装或者未安装   
        yum  search                      查找包,包名查找   
        yum  search all                 查找包,信息里和名字共同查找   
        yum  list                            列出已安装的包   
                [all|installed|available]   
        yum  provides                  查询由指定文件由哪个包安装生成   
        yum  reinstall                    重新安装   
        yum  localinstall               自已下载的包安装   
        yum  downgrade              降级   
        yum  clean                        清理缓存   
        yum  makecache               生成缓存   
       
        yum grouplist                    列出所有包组   
        yum groupinfo "group"    列出包组信息   
        yum groupinstall               安装包组内全部的程序包   
        rpm groupremove            卸载包组内全部的程序   
       
        yum  repolist                      显示自定义全部的仓库列表   
        yum  repoinfo           
       
        yum  help 
       
        command is one of:   
        * install package1 [package2] [...]   
        * update [package1] [package2] [...]   
        * update-to [package1] [package2] [...]   
        * update-minimal [package1] [package2] [...]   
        * check-update   
        * upgrade [package1] [package2] [...]   
        * upgrade-to [package1] [package2] [...]   
        * distribution-synchronization [package1] [package2] [...]   
        * remove | erase package1 [package2] [...]   
        * autoremove [package1] [...]   
        * list [...]   
        * info [...]   
        * provides | whatprovides feature1 [feature2] [...]   
        * clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]   
        * makecache [fast]   
        * groups [...]   
        * search string1 [string2] [...]   
        * shell [filename]   
        * resolvedep dep1 [dep2] [...]   
           (maintained for legacy reasons only - use repoquery or yum provides)   
        * localinstall rpmfile1 [rpmfile2] [...]   
           (maintained for legacy reasons only - use install)   
        * localupdate rpmfile1 [rpmfile2] [...]   
           (maintained for legacy reasons only - use update)   
        * reinstall package1 [package2] [...]   
        * downgrade package1 [package2] [...]   
        * deplist package1 [package2] [...]   
        * repolist [all|enabled|disabled]   
        * repoinfo [all|enabled|disabled]   
         * repository-packages <enabled-repoid> <install|remove|remove-or-reinstall|remove-or-distribution-synchronization> [pack‐age2] [...]   
        * version [ all | installed | available | group-* | nogroups* | grouplist | groupinfo ]   
        * history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]   
        * load-transaction [txfile]   
        * updateinfo [summary | list | info | remove-pkgs-ts | exclude-updates | exclude-all | check-running-kernel]   
        * fssnapshot [summary | list | have-space | create | delete]   
        * fs [filters | refilter | refilter-cleanup | du]   
        * check   
        * help [command]

 

例:

yum install mysql            #安装mysql ,自动使用开源mariadb替换mysql

已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.hust.edu.cn
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.44-1.el7_1 将被 安装
--> 正在处理依赖关系 mariadb-libs(x86-64) = 1:5.5.44-1.el7_1,它被软件包 1:mariadb-5.5.44-1.el7_1.x86_64 需要
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.41-2.el7_0 将被 升级
---> 软件包 mariadb-libs.x86_64.1.5.5.44-1.el7_1 将被 更新
--> 解决依赖关系完成

依赖关系解决

=======================================================================================================
 Package                  架构               版本                            源                   大小
=======================================================================================================
正在安装:
 mariadb                  x86_64             1:5.5.44-1.el7_1                updates             8.9 M
为依赖而更新:
 mariadb-libs           x86_64             1:5.5.44-1.el7_1                updates             754 k

事务概要
=======================================================================================================
安装  1 软件包
升级           ( 1 依赖软件包)

总计:9.7 M
总下载量:8.9 M
Is this ok [y/d/N]: y
Downloading packages:
mariadb-5.5.44-1.el7_1.x86_64.rpm                                               | 8.9 MB  00:00:07    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
  正在更新    : 1:mariadb-libs-5.5.44-1.el7_1.x86_64                              1/3
  正在安装    : 1:mariadb-5.5.44-1.el7_1.x86_64                                      2/3
  清理        : 1:mariadb-libs-5.5.41-2.el7_0.x86_64                                  3/3
  验证中      : 1:mariadb-libs-5.5.44-1.el7_1.x86_64                                 1/3
  验证中      : 1:mariadb-5.5.44-1.el7_1.x86_64                                         2/3
  验证中      : 1:mariadb-libs-5.5.41-2.el7_0.x86_64                                  3/3

已安装:
  mariadb.x86_64 1:5.5.44-1.el7_1                                                                     

作为依赖被升级:
  mariadb-libs.x86_64 1:5.5.44-1.el7_1                                                                

完毕!

 

yum remove mysql          #依懒包不一定会删除

已加载插件:fastestmirror, langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.44-1.el7_1 将被 删除
--> 解决依赖关系完成

依赖关系解决

=======================================================================================================
 Package              架构                版本                             源                     大小
=======================================================================================================
正在删除:
 mariadb              x86_64              1:5.5.44-1.el7_1                 @updates               49 M

事务概要
=======================================================================================================
移除  1 软件包

安装大小:49 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在删除    : 1:mariadb-5.5.44-1.el7_1.x86_64                                        1/1
  验证中      : 1:mariadb-5.5.44-1.el7_1.x86_64                                         1/1

删除:
  mariadb.x86_64 1:5.5.44-1.el7_1                                                                     

完毕!

yum search mysql              #查找源中名字中带mysql的包

已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.hust.edu.cn
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.aliyun.com
========================================= N/S matched: mysql ==========================================
MySQL-python.x86_64 : An interface to MySQL
akonadi-mysql.x86_64 : Akonadi MySQL backend support
apr-util-mysql.x86_64 : APR utility library MySQL DBD driver
dovecot-mysql.x86_64 : MySQL back end for dovecot
freeradius-mysql.x86_64 : MySQL support for freeradius
libdbi-dbd-mysql.x86_64 : MySQL plugin for libdbi
mysql-connector-java.noarch : Official JDBC driver for MySQL
mysql-connector-odbc.x86_64 : ODBC driver for MySQL
perl-DBD-MySQL.x86_64 : A MySQL interface for Perl
php-mysql.x86_64 : A module for PHP applications that use MySQL databases
php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
qt-mysql.i686 : MySQL driver for Qt's SQL classes
qt-mysql.x86_64 : MySQL driver for Qt's SQL classes
qt3-MySQL.i686 : MySQL drivers for Qt 3's SQL classes
qt3-MySQL.x86_64 : MySQL drivers for Qt 3's SQL classes
redland-mysql.x86_64 : MySQL storage support for Redland
rsyslog-mysql.x86_64 : MySQL support for rsyslog
mariadb.x86_64 : A community developed branch of MySQL
mariadb-devel.i686 : Files for development of MariaDB/MySQL applications
mariadb-devel.x86_64 : Files for development of MariaDB/MySQL applications
mariadb-libs.i686 : The shared libraries required for MariaDB/MySQL clients
mariadb-libs.x86_64 : The shared libraries required for MariaDB/MySQL clients

  名称和简介匹配 only,使用“search all”试试。

 

yum grouplist           #查看全部的grouplist ,好像和安装的时候选择的安装方式差不多

已加载插件:fastestmirror, langpacks
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.hust.edu.cn
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.aliyun.com
Available environment groups:
   最小安装
   基础设施服务器
   计算节点
   文件及打印服务器
   基本网页服务器
   虚拟化主机
   带 GUI 的服务器
   GNOME 桌面
   KDE Plasma Workspaces
   开发及生成工作站
可用组:
   传统 UNIX 兼容性
   兼容性程序库
   图形管理工具
   安全性工具
   开发工具
   控制台互联网工具
   智能卡支持
   科学记数法支持
   系统管理
   系统管理工具
完成

yum clean         #清除缓存  ,后面要带参数, 执行失败

已加载插件:fastestmirror, langpacks
错误:清理命令需要参数:headers, packages, metadata, dbcache, plugins, expire-cache, rpmdb, all

yum clean all         #清除全部缓存

已加载插件:fastestmirror, langpacks
正在清理软件源: CenOS-aliyun base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors

yum makecache           #重新生成缓存

已加载插件:fastestmirror, langpacks
CenOS-aliyun                                                             | 3.4 kB  00:00:00    
base                                                                            | 3.6 kB  00:00:00    
extras                                                                          | 3.4 kB  00:00:00    
updates                                                                         | 3.4 kB  00:00:00    
(1/16): CenOS-aliyun/prestodelta                                 | 5.9 kB  00:00:00    
(2/16): CenOS-aliyun/primary_db                                 | 1.6 MB  00:00:01    
(3/16): base/7/x86_64/group_gz                                   | 154 kB  00:00:00    
(4/16): CenOS-aliyun/filelists_db                                   | 812 kB  00:00:02    
(5/16): extras/7/x86_64/filelists_db                               | 247 kB  00:00:00    
(6/16): extras/7/x86_64/prestodelta                             |  12 kB  00:00:00    
(7/16): extras/7/x86_64/primary_db                              |  74 kB  00:00:00    
(8/16): extras/7/x86_64/other_db                                  | 263 kB  00:00:00    
(9/16): base/7/x86_64/other_db                                     | 2.2 MB  00:00:06    
(10/16): updates/7/x86_64/prestodelta                          | 196 kB  00:00:00    
(11/16): updates/7/x86_64/filelists_db                           | 2.3 MB  00:00:04    
(12/16): updates/7/x86_64/primary_db                          | 3.3 MB  00:00:06    
(13/16): CenOS-aliyun/other_db                                     |  14 MB  00:00:18    
(14/16): base/7/x86_64/filelists_db                                 | 6.0 MB  00:00:25    
(15/16): updates/7/x86_64/other_db                              |  20 MB  00:00:23    
(16/16): base/7/x86_64/primary_db                                | 5.1 MB  00:02:30    
Determining fastest mirrors
 * base: mirrors.hust.edu.cn
 * extras: mirrors.zju.edu.cn
 * updates: mirrors.pubyun.com
元数据缓存已建立

 cp freeradius-3.0.4-6.el7.x86_64.rpm /tmp/     #复制一个包到/tmp目录下
 cd /tmp/                                    
 yum localinstall freeradius-3.0.4-6.el7.x86_64.rpm   #用localinstall安装,自动使用yum解决依赖关系。

已加载插件:fastestmirror, langpacks
正在检查 freeradius-3.0.4-6.el7.x86_64.rpm: freeradius-3.0.4-6.el7.x86_64
freeradius-3.0.4-6.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 freeradius.x86_64.0.3.0.4-6.el7 将被 安装
--> 正在处理依赖关系 libnaaeap.so.0()(64bit),它被软件包 freeradius-3.0.4-6.el7.x86_64 需要
Loading mirror speeds from cached hostfile
 * base: mirrors.hust.edu.cn
 * extras: mirrors.zju.edu.cn
 * updates: mirrors.pubyun.com
--> 正在检查事务
---> 软件包 tncfhh-libs.x86_64.0.0.8.3-16.el7 将被 安装
--> 正在处理依赖关系 tncfhh = 0.8.3,它被软件包 tncfhh-libs-0.8.3-16.el7.x86_64 需要
--> 正在处理依赖关系 libxerces-c-3.1.so()(64bit),它被软件包 tncfhh-libs-0.8.3-16.el7.x86_64 需要
--> 正在处理依赖关系 libtncutil.so.0()(64bit),它被软件包 tncfhh-libs-0.8.3-16.el7.x86_64 需要
--> 正在处理依赖关系 liblog4cxx.so.10()(64bit),它被软件包 tncfhh-libs-0.8.3-16.el7.x86_64 需要
--> 正在检查事务
---> 软件包 log4cxx.x86_64.0.0.10.0-16.el7 将被 安装
---> 软件包 tncfhh.x86_64.0.0.8.3-16.el7 将被 安装
---> 软件包 tncfhh-utils.x86_64.0.0.8.3-16.el7 将被 安装
---> 软件包 xerces-c.x86_64.0.3.1.1-7.el7_1 将被 安装
--> 解决依赖关系完成

依赖关系解决

=======================================================================================================
 Package             架构          版本                    源                                     大小
=======================================================================================================
正在安装:
 freeradius          x86_64        3.0.4-6.el7             /freeradius-3.0.4-6.el7.x86_64        3.2 M
为依赖而安装:
 log4cxx             x86_64        0.10.0-16.el7           base                                  452 k
 tncfhh              x86_64        0.8.3-16.el7            base                                  680 k
 tncfhh-libs         x86_64        0.8.3-16.el7            base                                  160 k
 tncfhh-utils        x86_64        0.8.3-16.el7            base                                   33 k
 xerces-c            x86_64        3.1.1-7.el7_1           updates                               878 k

事务概要
=======================================================================================================
安装  1 软件包 (+5 依赖软件包)

总计:5.4 M
总下载量:2.2 M
安装大小:10 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): tncfhh-0.8.3-16.el7.x86_64.rpm                                  | 680 kB  00:00:01    
(2/5): log4cxx-0.10.0-16.el7.x86_64.rpm                              | 452 kB  00:00:01    
(3/5): tncfhh-libs-0.8.3-16.el7.x86_64.rpm                           | 160 kB  00:00:01    
(4/5): xerces-c-3.1.1-7.el7_1.x86_64.rpm                              | 878 kB  00:00:01    
tncfhh-utils-0.8.3-16.el7.x86_ FAILED                                         
http://mirrors.neusoft.edu.cn/centos/7.1.1503/os/x86_64/Packages/tncfhh-utils-0.8.3-16.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed to connect to 2001:da8:a807::25: Network is unreachable"
正在尝试其它镜像。
(5/5): tncfhh-utils-0.8.3-16.el7.x86_64.rpm                                     |  33 kB  00:00:00    
-------------------------------------------------------------------------------------------------------
总计                                                                   142 kB/s | 2.2 MB  00:00:15    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : log4cxx-0.10.0-16.el7.x86_64                       1/6
  正在安装    : xerces-c-3.1.1-7.el7_1.x86_64                       2/6
  正在安装    : tncfhh-utils-0.8.3-16.el7.x86_64                   3/6
  正在安装    : tncfhh-0.8.3-16.el7.x86_64                           4/6
  正在安装    : tncfhh-libs-0.8.3-16.el7.x86_64                    5/6
  正在安装    : freeradius-3.0.4-6.el7.x86_64                       6/6
  验证中      : tncfhh-utils-0.8.3-16.el7.x86_64                    1/6
  验证中      : tncfhh-0.8.3-16.el7.x86_64                            2/6
  验证中      : xerces-c-3.1.1-7.el7_1.x86_64                       3/6
  验证中      : tncfhh-libs-0.8.3-16.el7.x86_64                     4/6
  验证中      : freeradius-3.0.4-6.el7.x86_64                         5/6
  验证中      : log4cxx-0.10.0-16.el7.x86_64                         6/6

已安装:
  freeradius.x86_64 0:3.0.4-6.el7                                                                     

作为依赖被安装:
  log4cxx.x86_64 0:0.10.0-16.el7     tncfhh.x86_64 0:0.8.3-16.el7    tncfhh-libs.x86_64 0:0.8.3-16.el7
  tncfhh-utils.x86_64 0:0.8.3-16.el7 xerces-c.x86_64 0:3.1.1-7.el7_1

完毕!