[CentOS 7系列]YUM安装(上)

前端之家收集整理的这篇文章主要介绍了[CentOS 7系列]YUM安装(上)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、YUM工具

命 令 作 用
yum list 列出可用安装包
yum search packet-name 搜索
yum install [-y] packet-name 安装包
yum grouplist 查看可能批量安装的列表
yum groupinstall [-y] group-name 批量安装包
yum remove [-y] packet-name 卸载包
yum update [-y] packet-name 升级
yum provides "/*/file" 查看特定文件属于哪个软件包
ls /etc/yum.repos.d yum源的配置文件

测试示例:

[root@server01~]#yuminfo|more
已加载插件:fastestmirror
Repodataisover2weeksold.Installyum-cron?Orrun:yummakecachefast
Loadingmirrorspeedsfromcachedhostfile
*base:mirrors.aliyun.com
*extras:mirrors.aliyun.com
*updates:mirrors.aliyun.com
已安装的软件包
名称:GeoIP
架构:x86_64
版本:1.5.0
发布:11.el7
大小:2.8M
源:installed
来自源:anaconda
简介:Libraryforcountry/city/organizationtoIPaddressorhostname
:mapping
网址:http://www.maxmind.com/app/c
协议:LGPLv2+andGPLv2+andCC-BY-SA
描述:GeoIPisaClibrarythatenablestheusertofindthecountrythat
:anyIPaddressorhostnameoriginatesfrom.Itusesafilebased
:databasethatisaccurateasofJune2007andcanoptionallybe
:updatedonaweeklybasisbyinstallingtheGeoIP-updatepackage.
:ThisdatabasesimplycontainsIPblocksaskeys,andcountriesas
:values.Thisdatabaseshouldbemorecompleteandaccuratethanusing
:reverseDNSlookups.
:
:ThispackageincludesGeoLitedatacreatedbyMaxMind,availablefrom
:http://www.maxmind.com/
......
[root@server01~]#yuminstall-yvim-enhanced
已加载插件:fastestmirror
Repodataisover2weeksold.Installyum-cron?Orrun:yummakecachefast
base|3.6kB00:00:00
extras|3.4kB00:00:00
updates|3.4kB00:00:00
(1/2):extras/7/x86_64/primary_db|168kB00:00:00
(2/2):updates/7/x86_64/primary_db|6.4MB00:00:01
Loadingmirrorspeedsfromcachedhostfile
*base:mirrors.aliyun.com
*extras:mirrors.aliyun.com
*updates:mirrors.aliyun.com
正在解决依赖关系
-->正在检查事务
--->软件包vim-enhanced.x86_64.2.7.4.160-1.el7_3.1将被安装
-->正在处理依赖关系vim-common=2:7.4.160-1.el7_3.1,它被软件包2:vim-enhanced-7.4.160-1.el7_3.1.x86_64需要
......
-->解决依赖关系完成
......

完毕!
[root@server01~]#ls/etc/yum.repos.d
CentOS-Base.repoCentOS-Debuginfo.repoCentOS-Media.repoCentOS-Vault.repo
CentOS-CR.repoCentOS-fasttrack.repoCentOS-Sources.repo


2、YUM本地仓库

1)挂载镜像到/mnt目录

[root@server01~]#mount/dev/cdrom/mnt
mount:/dev/sr0写保护,将以只读方式挂载

2)备份yum配置文件

[root@server01~]#cp-r/etc/yum.repos.d/etc/yum.repos.d.bak

3)删除yum配置文件

[root@server01~]#rm-f/etc/yum.repos.d/*

4)编辑本地源

[root@server01~]#cat/etc/yum.repos.d/dvd.repo
[dvd]
name=installdvd
baseurl=file:///mnt
enable=1
gpcheck=0

5)清理软件源

[root@server01~]#yumcleanall
已加载插件:fastestmirror
正在清理软件源:dvd
Cleaningupeverything
Cleaninguplistoffastestmirrors

6)查看可用安装包

[root@server01~]#yumlist
......
389-ds-base-devel.x86_641.3.3.1-13.el7dvd
GConf2-devel.i6863.2.6-8.el7dvd
GConf2-devel.x86_643.2.6-8.el7dvd
GeoIP-devel.i6861.5.0-9.el7dvd
GeoIP-devel.x86_641.5.0-9.el7dvd
ImageMagick-c++-devel.i6866.7.8.9-10.el7dvd
ImageMagick-c++-devel.x86_646.7.8.9-10.el7dvd
ImageMagick-devel.i6866.7.8.9-10.el7dvd
ImageMagick-devel.x86_646.7.8.9-10.el7dvd
LibRaw-devel.i6860.14.8-5.el7.20120830git98d925dvd
LibRaw-devel.x86_640.14.8-5.el7.20120830git98d925dvd
ModemManager-devel.i6861.1.0-6.git20130913.el7dvd
ModemManager-devel.x86_641.1.0-6.git20130913.el7dvd
ModemManager-glib-devel.i6861.1.0-6.git20130913.el7dvd
ModemManager-glib-devel.x86_641.1.0-6.git20130913.el7dvd
......

猜你在找的CentOS相关文章