6.26 7.1-7.5

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了6.26 7.1-7.5相关的知识,希望对你有一定的参考价值。

7.1 安装软件包的三种方法

 

1 rpm(红帽子公司包管理系统)工具

操作简单,不需要太多设置,类似windowsexe

2 yum工具

一种用python开发的工具,操作的也是rpm包,支持自动安装依赖的包

3 源码包

即用编程语言写的源代码,需要使用编译器将其编译成可执行文件,操作难度较大

 

7.2 rpm包介绍

 

将光驱连接linux系统并挂载

1 连接光驱

技术分享图片

2 挂载光驱到目录下

[[email protected] ~]# mount /dev/cdrom /mnt

mount: /dev/sr0 写保护,将以只读方式挂载

光盘为只读,无法写数据

 

[[email protected] ~]# ls /mnt 查看光盘中的文件

CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7

EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7

EULA             isolinux  repodata  TRANS.TBL

[[email protected] Packages]# pwd

/mnt/Packages 该路径下存放了很多rpm文件

 

rpm

ypbind-1.37.1-9.el7.x86_64.rpm

包名-版本号-发布版本号-平台.后缀名(rpm

平台:

i686i586i38632位,x86_6464位;

centos7不区分3264位;

64位平台可安装64位平台或更低平台的包,低平台不能安装高平台的包;

 

7.3 rpm工具用法

 

安装rpm

[[email protected] Packages]# rpm -ivh zsh-5.0.2-28.el7.x86_64.rpm

准备中...                          ################################# [100%]

正在升级/安装...

   1:zsh-5.0.2-28.el7                 ################################# [100%]

升级rpm

[[email protected] Packages]# rpm -Uvh zsh-5.0.3-28.el7.x86_64.rpm

v:可视化

h:人性化显示

iinstall

Uupdate升级

 

卸载包

[[email protected] Packages]# rpm -e zsh

[[email protected] Packages]# 无任何提示信息则说明正常卸载

 

[[email protected] Packages]# rpm -e libpcap 由于有些服务依赖于这个包,所以无法正常卸载

错误:依赖检测失败:

         libpcap >= 14:0.8.3-6 (已安裝) ppp-2.4.5-33.el7.x86_64 需要

         libpcap.so.1()(64bit) (已安裝) ppp-2.4.5-33.el7.x86_64 需要

 

查询已安装的包

[[email protected] Packages]# rpm –qa 查询都安装了哪些包

[[email protected] Packages]# rpm -q ppp 单独查询某个包是否被安装

ppp-2.4.5-33.el7.x86_64 安装则会显示该包,否则报告未安装

 

查询指定包信息

[[email protected] Packages]# rpm -qi vim-enhanced

 

查询某个rpm包会安装的文件

[[email protected] Packages]# rpm -ql vim-enhanced

/etc/profile.d/vim.csh

/etc/profile.d/vim.sh

/usr/bin/rvim

/usr/bin/vim

/usr/bin/vimdiff

/usr/bin/vimtutor

 

根据文件绝对路径查询文件由哪个包安装

[[email protected] Packages]# rpm -qf /usr/bin/vim

vim-enhanced-7.4.160-4.el7.x86_64

 

[[email protected] Packages]# rpm -qf `which cd`

bash-4.2.46-28.el7.x86_64 cd显示的是一个纯粹的路径

[[email protected] Packages]# which cd

/usr/bin/cd

[[email protected] Packages]# which ls

alias ls='ls --color=auto'

         /usr/bin/ls ls除了路径信息外还有color等参数的信息,且为两行

[[email protected] Packages]# rpm -qf `which ls`  ``为反引号

rpm: --color=auto': 未知的选项 由于-qf后要跟纯路径,故执行失败

 

7.4 yum工具用法

 

[[email protected] 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 需要

rpm工具无法自动解决依赖关系,实际使用较麻烦

 

[[email protected] Packages]# yum install texlive

可以为用户自动解决依赖包关系

 

列出可安装哪些包

[[email protected] Packages]# yum list

zlib-static.i686                          1.2.7-17.el7                   base    

zlib-static.x86_64                        1.2.7-17.el7                   base    

zsh.x86_64                                5.0.2-28.el7                   base    

zsh-html.x86_64                           5.0.2-28.el7                   base    

zziplib.i686                              0.13.62-5.el7                  base    

zziplib.x86_64                            0.13.62-5.el7                  base    

zziplib-devel.i686                        0.13.62-5.el7                  base    

zziplib-devel.x86_64                      0.13.62-5.el7                  base    

zziplib-utils.x86_64                      0.13.62-5.el7                  base

包名称及适用平台                     版本号及平台版本号           仓库名

 

yum工具的仓库及配置文件

[[email protected] Packages]# ls /etc/yum.repos.d/ yum工具配置文件

CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo

CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo

[[email protected] yum.repos.d]# cat 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 可以通过该网址找到仓库

yum list显示的包会被放到某个容器里,即仓库

 

搜索相关的包

[[email protected] yum.repos.d]# yum search vim 搜索vim相关的包

已加载插件:fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.163.com

 * extras: mirrors.163.com

 * updates: mirrors.163.com

================================ N/S matched: vim ================================

protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers

                    : descriptions

vim-X11.x86_64 : The VIM version of the vi editor for the X Window System

vim-common.x86_64 : The common files needed by any version of the VIM editor

vim-enhanced.x86_64 : A version of the VIM editor which includes recent

                    : enhancements

vim-filesystem.x86_64 : VIM filesystem layout

vim-minimal.x86_64 : A minimal version of the VIM editor

 

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

包名或说明信息中存在匹配项就会列出这个包,属于不精确的搜索

 

搜索包名中包含vim的包

[[email protected] yum.repos.d]# yum list|grep 'vim'

vim-common.x86_64                           2:7.4.160-4.el7            @base   

vim-enhanced.x86_64                         2:7.4.160-4.el7            @base   

vim-filesystem.x86_64                       2:7.4.160-4.el7            @base   

vim-minimal.x86_64                          2:7.4.160-2.el7            @anaconda

protobuf-vim.x86_64                         2.5.0-8.el7                base    

vim-X11.x86_64                              2:7.4.160-4.el7            base    

vim-minimal.x86_64                          2:7.4.160-4.el7            base    

yum list列出所有包,管道符(|)将yum list执行的结果输出给grep ‘vim’作为grep ’vim’的输入;

匹配的字符会标红显示;

 

yum安装包

[[email protected] yum.repos.d]# yum install [-y] vim-enhanced

-y为可选项,-y即表示不再询问直接执行

 

列出可用组信息

[[email protected] yum.repos.d]# yum grouplist

已加载插件:fastestmirror

没有安装组信息文件

Maybe run: yum groups mark convert (see man yum)

Loading mirror speeds from cached hostfile

 * base: mirrors.163.com

 * extras: mirrors.163.com

 * updates: mirrors.163.com

可用的环境分组:

   最小安装

选择安装某个组时yum工具会安装该组中包含的rpm包;

可以在系统安装完成后使用yum工具安装某些组或套件;

 

安装一个组或套件

[[email protected] yum.repos.d]# yum groupinstall 'Security Tools'

当名称有空格时(Security Tools)需要‘’区分,否则报错

 

yum卸载

[[email protected] yum.repos.d]# yum remove [-y] ppp

可以帮用户将包本身及该包相关的依赖包一并卸载;

卸载依赖的包较危险,因为可能有其他应用也会依赖它;

 

yum升级包

[[email protected] yum.repos.d]# yum update [-y] 不加任何包名,默认升级系统中所有rpm包甚至包括系统本身

[[email protected] yum.repos.d]# yum update [-y] alsa-firmware-1.0.28-2.el7.noarch 升级指定的某个包

Failed to set locale, defaulting to C

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.163.com

 * extras: mirrors.163.com

 * updates: mirrors.163.com

No packages marked for update 未搜索到用于升级的包

 

根据命令搜索需要安装的包

[[email protected] yum.repos.d]# yum provides "/*/vim"

*代表通配,即中间路径不固定,匹配所有

 

7.5 yum搭建本地仓库

 

默认rpm包存在于一个网络中的某个站点,yum工具需要联网下载包

 

搭建本地仓库条件:

有光驱

有镜像文件

能正常挂载光驱

 

搭建仓库:

[[email protected] ~]# cp -r /etc/yum.repos.d /etc/yum.repos.d.bak 备份yum配置文件

[[email protected] ~]# cd /etc/yum.repos.d

[[email protected] yum.repos.d]# ls

CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo

CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo

[[email protected] yum.repos.d]# rm -rf ./* 删除目录下所有.repo文件

[[email protected] yum.repos.d]# vim dvd.repo 创建新的.repo文件

[dvd]

name=install dvd 自定义描述信息

baseurl=file:///mnt yum源的路径

enable=1 表示是否可用,1可用,0不可用

gpcheck=0 是否检测,0不检测,1检测

[[email protected] yum.repos.d]# yum clean all 清理先前的base等仓库的yum缓存

[[email protected] yum.repos.d]# yum list 列出可安装的包

yum-langpacks.noarch                      0.4.2-7.el7                    dvd     

yum-plugin-aliases.noarch                 1.1.31-42.el7                  dvd     

yum-plugin-changelog.noarch               1.1.31-42.el7                  dvd     

yum-plugin-tmprepo.noarch                 1.1.31-42.el7                  dvd     

yum-plugin-verify.noarch                  1.1.31-42.el7                  dvd     

yum-plugin-versionlock.noarch             1.1.31-42.el7                  dvd     

yum-utils.noarch                          1.1.31-42.el7                  dvd     

zenity.x86_64                             3.22.0-1.el7                   dvd     

zlib-devel.x86_64                         1.2.7-17.el7                   dvd     

zsh.x86_64                                5.0.2-28.el7                   dvd     

zziplib.x86_64                            0.13.62-5.el7                  dvd 

以上包的仓库基本为dvdbase仓库消失

[[email protected] yum.repos.d]# yum list|less 仓库名为@anaconda的为已经安装的rpm

GeoIP.x86_64                            1.5.0-11.el7                   @anaconda

NetworkManager.x86_64                   1:1.8.0-9.el7                  @anaconda

NetworkManager-libnm.x86_64             1:1.8.0-9.el7                  @anaconda

NetworkManager-team.x86_64              1:1.8.0-9.el7                  @anaconda

NetworkManager-tui.x86_64               1:1.8.0-9.el7                  @anaconda

NetworkManager-wifi.x86_64              1:1.8.0-9.el7                  @anaconda

acl.x86_64                              2.2.51-12.el7                  @anaconda

aic94xx-firmware.noarch                 30-6.el7                       @anaconda

可安装的软件包 该行以下为未安装且可安装的包

389-ds-base.x86_64                      1.3.6.1-16.el7                 dvd     

389-ds-base-libs.x86_64                 1.3.6.1-16.el7                 dvd     

ElectricFence.x86_64                    2.2.2-39.el7                   dvd     

GConf2.x86_64                           3.2.6-8.el7                    dvd

 


以上是关于6.26 7.1-7.5的主要内容,如果未能解决你的问题,请参考以下文章

6.26

6.26

6.26心得

MySQL5.6.26升级到MySQL5.7.9实战方案

6.26 win for 知识点

6.26