zoukankan      html  css  js  c++  java
  • rpm包安装

    RPM全称是“RedHatPackageManager”是由RedHat公司发发展起来的,本质是将软件源码包经过编译并且打包成rpm的格式,rpm文件包含的有二进制文件,配置文件,库文件等,同时RPM以一种数据库记录的方式将所需要的软件安装到linux系统上,优点是安装方便,缺点是只能安装在编译时默认的硬件与操作系统版本。
    1.rpm包的版本说明
    httpd-2.2.3-74.el5.centos.i386.rpm
    #以此软件为例说明
    httpd :软件名
    2.2.3 :分别表示:主版本号-次版本号-修正版本号
    74 :编译的次数
    i386 :硬件平台
    .rpm :扩展名
    httpd-2.2.3-74.el5.centos.i386.rpm
    格式:
    软件名-版本号-编译次数-支持平台-.rpm
    常见的硬件平台:
    i386 i586 i686:32位 x86_64:64位 noarck:没有硬件等级的限制
    2.rpm包的安装
    #1.rpm包的安装需要是root用户才能进行
    #2.rpm包安装后,该软件的相关信息会写入/var/lib/rpm下的数据库档案中,在版本升级,安装查询,数字签名等信息都会在这里查询
    安装时常用的选项:
    rpm -ivh package-name
    -i :安装
    -v :显示详细的安装信息
    -h :显示安装进度
    -vv :显示更详细的安装过程
    --nodeps:忽略安装时软件的依赖性,也就是强制进行安装,往往造成软件安装后不可用
    --replacepkgs :重新安装某个已经安装过的软件包,使用rpm -ivh *.rpm 时不会因个别软件包已安装过而中断
    --test:测试某个软件包是否能安装在linux环境中
    --justdb :更新软件在数据库内的信息
    --prefix 目录 :指定安装路径,一般不用该参数,rpm默认安装
    --force 强制安装
    -K :验证软件包的签名
    [root@zhu2 ~]# rpm -ivh a.rpm b.rpm c.rpm *.rpm
    #同时安装多个软件包,当分不清软件包安装的先后顺序使用
    3.rpm包的升级
    -Uvh:后面接的软件即使没有安装过,则系统将予以直接安装,后面接的软件有安装过旧版,则系统自动更新至新版. rpm -Uivh *.rpm     
    -Fvh:如果后面接的软件没有安装过,则系统不会安装该软件;
    后面接的软件有安装过旧版,则系统自动更新至新版
    4.rpm包的查看
    rpm的查询功能非常强大,查询的依据就是/var/lib/rpm目录下的数据库文件,不仅可以查询已安装的软件的信息,未安装的软件的信息也可查询。
    rpm -q name :仅查询后面接的软件名称是否安装
    rpm -qa :列出所有的已经安装在本机系统上面的所有软件名称
    rpm -qa | grep name :查询某软件是否安装
    rpm -qc name :列出该软件的配置文件(config)
    rpm -qd :列出该软件的所有说明文件,即是与man有关的档案
    rpm -qi name :列出软件的详细信息(information)
    rpm -ql name :列出软件所有的档案与目录所在的完整文件名(list)
    rpm -qf 文件名 :由后面接的文件名来找出该档案属于哪个已安装的软件(find)
    rpm -qR name :列出与该软件有依赖行的软件所包含的档案
    rpm -qpl :查找某个rpm软件包中所包含的文件

    5.rpm包删除与数据库重建
    5.1rpm包的删除
    [root@zhu1 ~]# rpm -e vsftpd
    warning: /etc/vsftpd/vsftpd.conf saved as /etc/vsftpd/vsftpd.conf.rpmsave
    [root@zhu1 ~]# rpm -q vsftpd
    package vsftpd is not installed
    # -e :删除软件
    --nodeps :强制删除
    5.2rpm包的数据库重建
    [root@zhu1 ~]# rpm --rebuilddb
    --initdb #初始化rpm包的数据库
    --rebuilddb # 重建数据库

     原文出处:http://caisangzi.blog.51cto.com/6387416/1303924

    ======================

    RPM常用查询命令

    rpm -qa   列出所有已安装的rpm软件

    rpm -qf filename  查询指定文件属于哪个rpm包

    [root@rusky Packages]# rpm -qf /etc/vsftpd/
    vsftpd-3.0.2-10.el7.x86_64

    rpm -qi packagename  查询已软件包的信息

    [root@rusky Packages]# rpm -qi vsftpd 
    Name        : vsftpd
    Version     : 3.0.2
    Release     : 10.el7
    Architecture: x86_64
    Install Date: Sun 16 Oct 2016 10:25:32 PM CST
    Group       : System Environment/Daemons
    Size        : 355788
    License     : GPLv2 with exceptions
    Signature   : RSA/SHA256, Fri 28 Aug 2015 06:15:12 PM CST, Key ID 199e2f91fd431d51
    Source RPM  : vsftpd-3.0.2-10.el7.src.rpm
    Build Date  : Mon 03 Aug 2015 08:06:28 PM CST
    Build Host  : x86-021.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.

    rpm -ql packagename  查询指定软件包包含的文件

    [root@rusky /]# rpm -ql zip
    /usr/bin/zip
    /usr/bin/zipcloak
    /usr/bin/zipnote
    /usr/bin/zipsplit
    /usr/share/doc/zip-3.0
    /usr/share/doc/zip-3.0/CHANGES
    /usr/share/doc/zip-3.0/LICENSE
    /usr/share/doc/zip-3.0/README
    /usr/share/doc/zip-3.0/README.CR
    /usr/share/doc/zip-3.0/TODO
    /usr/share/doc/zip-3.0/WHATSNEW
    /usr/share/doc/zip-3.0/WHERE
    /usr/share/doc/zip-3.0/algorith.txt
    /usr/share/man/man1/zip.1.gz
    /usr/share/man/man1/zipcloak.1.gz
    /usr/share/man/man1/zipnote.1.gz
    /usr/share/man/man1/zipsplit.1.gz

    rpm -qip software.rpm 查询rpm文件的信息

    [root@rusky Packages]# rpm -qip vsftpd-3.0.2-10.el7.x86_64.rpm 
    Name        : vsftpd
    Version     : 3.0.2
    Release     : 10.el7
    Architecture: x86_64
    Install Date: (not installed)
    Group       : System Environment/Daemons
    Size        : 355788
    License     : GPLv2 with exceptions
    Signature   : RSA/SHA256, Fri 28 Aug 2015 06:15:12 PM CST, Key ID 199e2f91fd431d51
    Source RPM  : vsftpd-3.0.2-10.el7.src.rpm
    Build Date  : Mon 03 Aug 2015 08:06:28 PM CST
    Build Host  : x86-021.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.

    rpm -qilp software.rpm  查询rpm文件包含的文件

    [root@rusky Packages]# rpm -qilp vsftpd-3.0.2-10.el7.x86_64.rpm 
    Name        : vsftpd
    Version     : 3.0.2
    Release     : 10.el7
    Architecture: x86_64
    Install Date: (not installed)
    Group       : System Environment/Daemons
    Size        : 355788
    License     : GPLv2 with exceptions
    Signature   : RSA/SHA256, Fri 28 Aug 2015 06:15:12 PM CST, Key ID 199e2f91fd431d51
    Source RPM  : vsftpd-3.0.2-10.el7.src.rpm
    Build Date  : Mon 03 Aug 2015 08:06:28 PM CST
    Build Host  : x86-021.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.
    /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@rusky Packages]# 

     将RPM包安装到指定目录下:

    #rpm -ivh --prefix=/home/lxj/java  jdk-8u60-linux-x64.rpm

    将 jdk-8u60-linux-x64.rpm 安装到 /home/lxj/java 目录下。

  • 相关阅读:
    socket 断线重连
    openwrt lan/wan口自动翻转
    单总线通讯协议
    关于Feign的Fallback处理
    Linux查找占用的端口,并杀死进程
    springCloud--admin监控使用
    解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
    Shell中[和[[的异同
    Spring Cloud中,如何解决Feign/Ribbon第一次请求失败的问题?
  • 原文地址:https://www.cnblogs.com/rusking/p/3696934.html
Copyright © 2011-2022 走看看