IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    【转载】Linux RPM Comamnd with 10 Useful Examples

    rock发表于 2014-12-10 10:18:57
    love 0

    RPM Stands for Redhat Package Manager. RPM command is used for managing rpm software packages in your linux machine. Using rpm command we can install, upgrade, remove, list packages.

    rpm-structure-2

    1. Installing RPM in System.

    Use below command to install and vsftpd RPM in system.

    # rpm -ivh vsftpd-2.3.5-2.el6.i686.rpm
    

    Sample output:

    warning: vsftpd-2.3.5-2.el6.i686.rpm: Header V3 DSA/SHA1 Signature, key ID e9bc4ae1: NOKEY
    Preparing...                ########################################### [100%]
       1:vsftpd                 ########################################### [100%]
    
    2. Update the installed RPM Package.

    If you already installed an RPM so you can simply upgrade it with new version.

    # rpm -Uvh vsftpd-2.3.5-2.el6.i686.rpm
    
    3. Check installed RPM Package.

    After installation of a package to check for proper installation, Use -q to query to installed package.

    # rpm -q vsftpd
    vsftpd-2.3.5-2.el6.i686
    
    4. List all installed RPM Package.

    The below Example lists all installed package in your system.

    # rpm -qa
    
    Example 5: Remove installed RPM Package.

    Below command will erase ( uninstall ) rpm package from your system.

    # rpm -e vsftpd
    vsftpd-2.3.5-2.el6.i686
    
    6. Get more details of RPM Package.

    This command will show you details about an RPM, like Name, version release and short descritpion.

    # rpm -qip vsftpd-2.3.5-2.el6.i686.rpm
    

    Sample output:

    warning: vsftpd-2.3.5-2.el6.i686.rpm: Header V3 DSA/SHA1 Signature, key ID e9bc4ae1: NOKEY
    Name        : vsftpd                       Relocations: (not relocatable)
    Version     : 2.3.5                             Vendor: (none)
    Release     : 2.el6                         Build Date: Thu 23 Feb 2012 07:38:59 AM IST
    Install Date: (not installed)               Build Host: localhost
    Group       : System Environment/Daemons    Source RPM: vsftpd-2.3.5-2.el6.src.rpm
    Size        : 453460                           License: GPLv2 with exceptions
    Signature   : DSA/SHA1, Fri 11 Jan 2013 06:48:45 PM IST, Key ID 8fbd1684e9bc4ae1
    URL         : http://vsftpd.devnet.ru
    Summary     : Very Secure Ftp Daemon
    Description :
    vsftpd is a Very Secure FTP daemon. It was written completely from
    scratch.
    
    7. List all files in RPM Package.

    This command will list all files inside a RPM package. This is usefull for finding importent files of RPM.

    # rpm -qlp vsftpd-2.3.5-2.el6.i686.rpm
    

    Sample Output:

    warning: vsftpd-2.3.5-2.el6.i686.rpm: Header V3 DSA/SHA1 Signature, key ID e9bc4ae1: NOKEY
    /etc/logrotate.d/vsftpd
    /etc/pam.d/vsftpd
    /etc/rc.d/init.d/vsftpd
    /etc/vsftpd
    /etc/vsftpd/ftpusers
    /etc/vsftpd/user_list
    /etc/vsftpd/vsftpd-403-serv.html
    /etc/vsftpd/vsftpd-403.html
    /etc/vsftpd/vsftpd-404.html
    /etc/vsftpd/vsftpd-browse.html
    /etc/vsftpd/vsftpd-browse_line.html
    /etc/vsftpd/vsftpd-site.conf.sample
    /etc/vsftpd/vsftpd.conf
    /etc/vsftpd/vsftpd.pasv_rules
    /etc/vsftpd/vsftpd_conf_migrate.sh
    /usr/sbin/vsftpd
    /usr/share/doc/vsftpd-2.3.5
    /usr/share/doc/vsftpd-2.3.5/AUDIT
    /usr/share/doc/vsftpd-2.3.5/BENCHMARKS
    /usr/share/doc/vsftpd-2.3.5/BUGS
    /usr/share/doc/vsftpd-2.3.5/COPYING
    /usr/share/doc/vsftpd-2.3.5/Changelog
    /usr/share/doc/vsftpd-2.3.5/Example
    /usr/share/doc/vsftpd-2.3.5/Example/HTTP_TEMPLATES
    /usr/share/doc/vsftpd-2.3.5/Example/HTTP_TEMPLATES/403-serv.html
    /usr/share/doc/vsftpd-2.3.5/Example/HTTP_TEMPLATES/403.html
    /usr/share/doc/vsftpd-2.3.5/Example/HTTP_TEMPLATES/404.html
    /usr/share/doc/vsftpd-2.3.5/Example/HTTP_TEMPLATES/browse.html
    /usr/share/doc/vsftpd-2.3.5/Example/HTTP_TEMPLATES/browse_line.html
    /usr/share/doc/vsftpd-2.3.5/Example/INTERNET_SITE
    /usr/share/doc/vsftpd-2.3.5/Example/INTERNET_SITE/README
    /usr/share/doc/vsftpd-2.3.5/Example/INTERNET_SITE/vsftpd.conf
    /usr/share/doc/vsftpd-2.3.5/Example/INTERNET_SITE/vsftpd.xinetd
    /usr/share/doc/vsftpd-2.3.5/Example/INTERNET_SITE_NOINETD
    /usr/share/doc/vsftpd-2.3.5/Example/INTERNET_SITE_NOINETD/README
    /usr/share/doc/vsftpd-2.3.5/Example/INTERNET_SITE_NOINETD/vsftpd.conf
    /usr/share/doc/vsftpd-2.3.5/Example/PER_IP_CONFIG
    /usr/share/doc/vsftpd-2.3.5/Example/PER_IP_CONFIG/README
    /usr/share/doc/vsftpd-2.3.5/Example/PER_IP_CONFIG/hosts.allow
    /usr/share/doc/vsftpd-2.3.5/Example/README
    /usr/share/doc/vsftpd-2.3.5/Example/VIRTUAL_HOSTS
    /usr/share/doc/vsftpd-2.3.5/Example/VIRTUAL_HOSTS/README
    /usr/share/doc/vsftpd-2.3.5/Example/VIRTUAL_USERS
    /usr/share/doc/vsftpd-2.3.5/Example/VIRTUAL_USERS/README
    /usr/share/doc/vsftpd-2.3.5/Example/VIRTUAL_USERS/logins.txt
    /usr/share/doc/vsftpd-2.3.5/Example/VIRTUAL_USERS/vsftpd.conf
    /usr/share/doc/vsftpd-2.3.5/Example/VIRTUAL_USERS/vsftpd.pam
    /usr/share/doc/vsftpd-2.3.5/Example/VIRTUAL_USERS_2
    /usr/share/doc/vsftpd-2.3.5/Example/VIRTUAL_USERS_2/README
    /usr/share/doc/vsftpd-2.3.5/FAQ
    /usr/share/doc/vsftpd-2.3.5/INSTALL
    /usr/share/doc/vsftpd-2.3.5/LICENSE
    /usr/share/doc/vsftpd-2.3.5/README
    /usr/share/doc/vsftpd-2.3.5/README.security
    /usr/share/doc/vsftpd-2.3.5/REWARD
    /usr/share/doc/vsftpd-2.3.5/SECURITY
    /usr/share/doc/vsftpd-2.3.5/SECURITY/DESIGN
    /usr/share/doc/vsftpd-2.3.5/SECURITY/IMPLEMENTATION
    /usr/share/doc/vsftpd-2.3.5/SECURITY/OVERVIEW
    /usr/share/doc/vsftpd-2.3.5/SECURITY/TRUST
    /usr/share/doc/vsftpd-2.3.5/SIZE
    /usr/share/doc/vsftpd-2.3.5/SPEED
    /usr/share/doc/vsftpd-2.3.5/TODO
    /usr/share/doc/vsftpd-2.3.5/TUNING
    /usr/share/doc/vsftpd-2.3.5/vsftpd.xinetd
    /usr/share/man/man5/vsftpd.conf.5.gz
    /usr/share/man/man8/vsftpd.8.gz
    /var/ftp
    /var/ftp/pub
    
    8. Search RPM to which a File Belongs.

    Using below command you can find about file to which rpm its belongs.

    # rpm -qf /etc/vsftpd/ftpusers
    vsftpd-2.3.5-2.el6.i686
    
    9. List the dependencies of RPM Package.

    This command will list all dependencies of rpm.

    # rpm -qpR vsftpd-2.3.5-2.el6.i686.rpm
    
    10. Revert RPM Package to Older Version.

    If you have accidentally upgraded your rpm to newer version, you can downgrade it again using below command.

    rpm -Uvh --oldpackage vsftpd-.el6.i686.rpm



    22-Linux-软件包管理-RPM

    分类: Linux2014-02-09 21:31 152人阅读 评论(0) 收藏 举报
    Linux软件包管理RPM

    目录(?)[+]



    管理方式

    1) 源代码
    2) RPM
    3) YUM

    源代码形式

    绝大多数开源软件都是直接以 源代码形式发布
    源代码一般会被打包成 "tar.gz" 的归档压缩文件
    程序源代码 需要编译成二进制形式后才能够运行使用
    编译流程
    1) ./configure 检查编译环境、相关库文件、配置参数, 生成makefile
    2) make 对源代码进行编译, 生成可执行文件
    3) make install 将生成的可执行文件安装到 当前计算机中
    特点
    源代码形式的软件安装过程麻烦, 但兼容性及可控性较好
    开源软件一般都会使用大量其他开源软件的功能, 因此存在大量依赖关系
    优点
    使用所系统、可定制
    缺点
    操作复杂、编译时间较长、极容易出现错误

    RPM

    Redhat Package Manager, 由Erik Troan和Marc Ewing开发而来.
    RPM通过将源代码 基于 特定平台系统 编译成 可执行文件, 并保存依赖关系,
    来简化开源软件的安装过程
    RPM设计目标
    使用简单
    使用单一软件包格式文件发布(.rpm文件)
    可升级
    追踪软件依赖关系
    基本信息查询
    软件验证功能
    支持多平台
    命名规范
    softname-version.os.platform.rpm
    如: easy2login-1.2.0-30.el6.i686.rpm
    软件名 : easy2login
    版本号 : 1.2.0-30
    系统 : Enterprise Linux 6
    平台 : i686
    基本命令
    安装软件 : rpm -i softname.rpm
    卸载软件 : rpm -e softname
    注: 没有后缀名
    升级形式安装 : rpm -U software-new.rpm
    支持通过 HTTP 和 FTP协议安装
    rpm -ivh http://www.foo.org/software.rpm
    rpm -ivh
    options
    -v : verbose, 显示相关信息
    -h : 显示进度条
    查询
    RMP会保存软件相关的很多信息
    rpm -qa : 列出所有安装的rpm软件
    rpm -qf filename : 查询目标文件属于哪个rpm包
    rpm -qi packagename : 查询指定已安装rpm软件的信息
    rpm -ql packagename : 查询指定已安装rpm软件包含的文件
    rpm -qip software.rpm : 查询rpm文件信息
    rpm -qlp software.rpm : 查询rpm文件包含的文件
    验证
    软件在传播的过程中可能会被恶意的修改,
    现在的OS都加入了对软件的验证功能
    验证一般使用非对称加密算法, 需要密钥
    导入密钥
    rpm --import RPM-GPG-KEY-CentOS-6
    验证RPM文件
    rpm -K software.rpm
    验证已安装的软件
    rpm -V software


沪ICP备19023445号-2号
友情链接