码迷,mamicode.com
首页 > 系统相关 > 详细

2018-03-05 阿铭Linux学习

时间:2018-03-05 22:30:20      阅读:232      评论:0      收藏:0      [点我收藏+]

标签:Linux学习

7.1 安装包的三种方法

rpm 工具
    类似Windows exe安装包,安装有固定的路径
    软件依赖包需要手动依次安装
    Redhat公司开发

yum 
    使用python 开发的
    自动安装依赖包
    在线安装,最方便

源码包
    先编译在安装

7.2 rpm包介绍

设置光驱并挂载安装镜像文件
rpm包格式,报名、版本号、发布版本号、平台

rpm -ivh rpm包文件   //安装
rpm -Uvh rpm包文件  //升级
rpm -e  包名      //卸载
rpm -qa          //查询安装的包
rpm -q 包名      //查询指定包是否安装
rpm -qi 包名     //查询指定包信息
rpm -ql 包名    //列出包安装的文件
rpm -qf 文件绝对路径   //查看一个文件是由哪个包安装的

    um-rhn-plugin-2.0.1-9.el7.noarch.rpm
    zlib-devel-1.2.7-17.el7.i686.rpm
    zlib-devel-1.2.7-17.el7.x86_64.rpm

7.3 rpm工具使用方法

    [root@aming-01 Packages]# rpm -ivh zsh-html-5.0.2-28.el7.x86_64.rpm 
    准备中...                          ################################# [100%]
    正在升级/安装...
       1:zsh-html-5.0.2-28.el7            ################################# [100%]

    [root@aming-01 Packages]# rpm -e zsh-html-5.0.2-28.el7.x86_64

    [root@aming-01 Packages]# rpm -q tree
    tree-1.6.0-10.el7.x86_64
    [root@aming-01 Packages]# rpm -qi tree
    Name        : tree
    Version     : 1.6.0
    Release     : 10.el7
    Architecture: x86_64
    Install Date: 2018年03月01日 星期四 03时31分46秒
    Group       : Applications/File
    Size        : 89505
    License     : GPLv2+
    Signature   : RSA/SHA256, 2014年07月04日 星期五 13时36分46秒, Key ID 24c6a8a7f4a80eb5
    Source RPM  : tree-1.6.0-10.el7.src.rpm
    Build Date  : 2014年06月10日 星期二 03时28分53秒
    Build Host  : worker1.bsys.centos.org
    Relocations : (not relocatable)
    Packager    : CentOS BuildSystem <http://bugs.centos.org>
    Vendor      : CentOS
    URL         : http://mama.indstate.edu/users/ice/tree/
    Summary     : File system tree viewer
    Description :
    The tree utility recursively displays the contents of directories in a
    tree-like format.  Tree is basically a UNIX port of the DOS tree
    utility.

    [root@aming-01 Packages]# rpm -ql tree
    /usr/bin/tree
    /usr/share/doc/tree-1.6.0
    /usr/share/doc/tree-1.6.0/LICENSE
    /usr/share/doc/tree-1.6.0/README
    /usr/share/man/man1/tree.1.gz

    [root@aming-01 Packages]# rpm -qf /usr/bin/vim
    vim-enhanced-7.4.160-2.el7.x86_64

    [root@aming-01 Packages]# rpm -qf `which cd`
    bash-4.2.46-28.el7.x86_64

依赖包
    [root@aming-01 Packages]# rpm -ivh texlive-2012-38.20130427_r30134.el7.x86_64.rpm
    错误:依赖检测失败:
        texlive-scheme-basic 被 texlive-2:2012-38.20130427_r30134.el7.x86_64 需要
        texlive-collection-latexrecommended 被 texlive-2:2012-38.20130427_r30134.el7.x86_64 需要
        tex-kpathsea 被 texlive-2:2012-38.20130427_r30134.el7.x86_64 需要
        tex-tetex 被 texlive-2:2012-38.20130427_r30134.el7.x86_64 需要

7.4 yum 工具用法

yum list        //列出可用rpm包
ls /etc/yum.repos.d/
yum search vim    //搜索包
yum install [-y]
yum grouplist
yum groupinstall [-y]
yum remove [-y]
yum update [-y]
yum provides "/*/vim"

    [root@aming-01 Packages]# ls /etc/yum.repos.d/
    CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
    CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
    [root@aming-01 Packages]# cat /etc/yum.repos.d/CentOS-Base.repo 
    # CentOS-Base.repo
    #
    # The mirror system uses the connecting IP address of the client and the
    # update status of each mirror to pick mirrors that are updated to and
    # geographically close to the client.  You should use this for CentOS updates
    # unless you are manually picking other mirrors.
    #
    # If the mirrorlist= does not work for you, as a fall back you can try the 
    # remarked out baseurl= line instead.
    #
    #

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

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

    #additional packages that may be useful
    [extras]
    name=CentOS-$releasever - Extras
    mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

    #additional packages that extend functionality of existing packages
    [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

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

7.5 yum 搭建本地仓库

挂载镜像到/mnt 目录
cp -r /etc/yum.repos.d /etc/yum.repos.d.bac
rm -f /etc/yum.repos.d/*

vim /etc/yum.repos.d/dvd.repo //内容如下
[dvd]
name=install dvd
baseurl=file:///mnt
enable=1
gpgcheck=0

yum clean all
yum list

2018-03-05 阿铭Linux学习

标签:Linux学习

原文地址:http://blog.51cto.com/9298822/2083232

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!