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源的配置文件夹

测试示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
[root@server01 ~] # yum info | more
已加载插件:fastestmirror
Repodata is over 2 weeks old. Install yum- cron ? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
  * base: mirrors.aliyun.com
  * extras: mirrors.aliyun.com
  * updates: mirrors.aliyun.com
已安装的软件包
名称    :GeoIP
架构    :x86_64
版本    :1.5.0
发布    :11.el7
大小    :2.8 M
源    :installed
来自源:anaconda
简介    : Library  for  country /city/organization  to IP address or  hostname
          : mapping
网址    :http: //www .maxmind.com /app/c
协议    : LGPLv2+ and GPLv2+ and CC-BY-SA
描述    : GeoIP is a C library that enables the user to  find  the country that
          : any IP address or  hostname  originates from. It uses a  file  based
          : database that is accurate as of June 2007 and can optionally be
          : updated on a weekly basis by installing the GeoIP-update package.
          : This database simply contains IP blocks as keys, and countries as
          : values. This database should be  more  complete and accurate than using
          : reverse DNS lookups.
          :
          : This package includes GeoLite data created by MaxMind, available from
          :http: //www .maxmind.com/
......
[root@server01 ~] # yum install -y vim-enhanced
已加载插件:fastestmirror
Repodata is over 2 weeks old. Install yum- cron ? Or run: yum makecache fast
base                                                                                                                                             | 3.6 kB  00:00:00
extras                                                                                                                                           | 3.4 kB  00:00:00
updates                                                                                                                                          | 3.4 kB  00:00:00
(1 /2 ): extras /7/x86_64/primary_db                                                                                                                 | 168 kB  00:00:00
(2 /2 ): updates /7/x86_64/primary_db                                                                                                                | 6.4 MB  00:00:01
Loading mirror speeds from cached hostfile
  * 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.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo


2、YUM本地仓库

1)挂载镜像到/mnt目录

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

2)备份yum配置文件

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

3)删除yum配置文件

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

4)编辑本地源

1
2
3
4
5
6
[root@server01 ~] # cat /etc/yum.repos.d/dvd.repo
[dvd]
name= install  dvd
baseurl= file : ///mnt
enable =1
gpgcheck=0

5)清理软件源

1
2
3
4
5
[root@server01 ~] # yum clean all
已加载插件:fastestmirror
正在清理软件源: dvd
Cleaning up everything
Cleaning up list of fastest mirrors

6)查看可用安装包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@server01 ~] # yum list
......
389-ds-base-devel.x86_64                1.3.3.1-13.el7                 dvd
GConf2-devel.i686                       3.2.6-8.el7                    dvd
GConf2-devel.x86_64                     3.2.6-8.el7                    dvd
GeoIP-devel.i686                        1.5.0-9.el7                    dvd
GeoIP-devel.x86_64                      1.5.0-9.el7                    dvd
ImageMagick-c++-devel.i686              6.7.8.9-10.el7                 dvd
ImageMagick-c++-devel.x86_64            6.7.8.9-10.el7                 dvd
ImageMagick-devel.i686                  6.7.8.9-10.el7                 dvd
ImageMagick-devel.x86_64                6.7.8.9-10.el7                 dvd
LibRaw-devel.i686                       0.14.8-5.el7.20120830git98d925 dvd
LibRaw-devel.x86_64                     0.14.8-5.el7.20120830git98d925 dvd
ModemManager-devel.i686                 1.1.0-6.git20130913.el7        dvd
ModemManager-devel.x86_64               1.1.0-6.git20130913.el7        dvd
ModemManager-glib-devel.i686            1.1.0-6.git20130913.el7        dvd
ModemManager-glib-devel.x86_64          1.1.0-6.git20130913.el7        dvd
......









本文转自Grodd51CTO博客,原文链接:http://blog.51cto.com/juispan/1942203,如需转载请自行联系原作者

相关文章
|
17天前
|
Linux C语言
linux yum安装ffmpeg 图文详解
linux yum安装ffmpeg 图文详解
38 0
|
17天前
|
Linux
linux yum 安装rar和unrar
linux yum 安装rar和unrar
57 0
|
5月前
|
Linux
解决CentOS yum安装Mysql8提示“公钥尚未安装”或“密钥已安装,但是不适用于此软件包”的问题
解决CentOS yum安装Mysql8提示“公钥尚未安装”或“密钥已安装,但是不适用于此软件包”的问题
1464 0
|
3天前
|
Linux
centos 6.5安装yum
centos 6.5安装yum
22 0
|
4天前
|
存储 Linux 网络安全
centos7使用yum网络安装
这些是使用Yum进行网络安装的基本步骤。根据你的需求,你可以重复步骤3和4来安装其他软件包。请注意,执行Yum操作需要root或具有sudo权限的用户。
16 1
|
8天前
|
应用服务中间件 nginx
yum 安装报错 No package nginx available Error:Nothing to do
yum 安装报错 No package nginx available Error:Nothing to do
22 1
|
17天前
|
关系型数据库 MySQL Linux
CentOS 7 下使用yum安装MySQL5.7.20 最简单 图文详解
CentOS 7 下使用yum安装MySQL5.7.20 最简单 图文详解
78 0
|
29天前
|
Linux
Linux: yum查看、安装、删除软件包
Linux: yum查看、安装、删除软件包
30 0
|
5月前
|
Linux
Centos8安装yum源时候出现的异常问题及解决方案(保好使)
Centos8安装yum源时候出现的异常问题及解决方案(保好使)
|
2月前
|
Linux Shell
Linux:centos yum安装指令指南
Linux:centos yum安装指令指南
174 0
Linux:centos yum安装指令指南