安装软件包的三种方法
- rpm工具
- yum工具
- 源码包
rmp包介绍
设置光驱并挂载mount /dev/cdrom /mnt
包名-版本号-发布版本号-平台
列出包安装的文件
查询指定包是否安装
[root@g_linux01 ~]# rpm -q ppp未安装软件包 ppp [root@g_linux01 ~]# rpm -q kmodkmod-20-15.el7.x86_64
如果不知道文件路径,可以用`which cd` 形式查看
yum工具
使用rpm时,如果需要安装的包依赖很多包,会比较麻烦,使用yum会自动安装依赖包。
- yum list 显示可用rpm包
左边是包名,中间是版本信息,右边是仓库名,仓库这边显示@base、@anaconda表示已经安装。如果未安装这显示base或者anaconda,如果是updates表示已安装但是需要升级。
[root@glinux-01 ~]# yum list|head -10已加载插件:fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.tuna.tsinghua.edu.cn已安装的软件包GeoIP.x86_64 1.5.0-11.el7 @anacondaNetworkManager.x86_64 1:1.8.0-9.el7 @anacondaNetworkManager-libnm.x86_64 1:1.8.0-9.el7 @anacondaNetworkManager-team.x86_64 1:1.8.0-9.el7 @anaconda
- yum的配置文件:/etc/yum.repos.d/Centos-Base.repo 里面可以配置仓库名,
yum源地址[base] //仓库名 name=CentOS-$releasever – Base mirrorlist= //yum源地址。 #baseurl= gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7- yum search vim 搜索跟vim相关的包
[root@glinux-01 ~]# yum search vim已加载插件:fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.tuna.tsinghua.edu.cn============================================ N/S matched: vim ============================================protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptionsvim-X11.x86_64 : The VIM version of the vi editor for the X Window Systemvim-common.x86_64 : The common files needed by any version of the VIM editorvim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancementsvim-filesystem.x86_64 : VIM filesystem layoutvim-minimal.x86_64 : A minimal version of the VIM editor 名称和简介匹配 only,使用“search all”试试。
- yum list|grep vim 可以用匹配搜索
- 安装包 yum install [-y] 【包名】 (-y加这个选项会不询问是否安装)
- yum grouplist 列出可用分组
[root@glinux-01 ~]# yum grouplist已加载插件:fastestmirror没有安装组信息文件Maybe run: yum groups mark convert (see man yum)Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.tuna.tsinghua.edu.cn可用的环境分组: 最小安装 基础设施服务器 计算节点 文件及打印服务器 基本网页服务器 虚拟化主机 带 GUI 的服务器 GNOME 桌面 KDE Plasma Workspaces 开发及生成工作站可用组: 传统 UNIX 兼容性 兼容性程序库 图形管理工具 安全性工具 开发工具 控制台互联网工具 智能卡支持 科学记数法支持 系统管理 系统管理工具完成
- yum groupinstall [-y] [组名] (先将上面内容转化为英文LENG=en,再选择)
- yum remove [-y] 卸载包
- yum update [-y] 【包名】 更新包(如果不加包名,会将系统全部更新)
- yum provide "/*/vim" 搜索一个命令都有哪些包
yum本地仓库(使用本地光盘制作yum源)
创建方法:1挂载镜像到 /mnt目录(mount /dev/cdrom /mnt)
2 cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
3 rm -f /etc/yum.repos.d/*
4 vim /etc/yum.repos.d/dvd.repo//内容如下
[dvd] //仓库名字
name=install dvd baseurl=file:///mnt //本地源地址 ??(file:// /mnt)
enable=1 //本地是否可用,1可用,0不可以 gpgcheck=0 //是否检测,1检测,0不检测- yum clean all //清除缓存
- yum list