linux中的软件管理

1、认识软件安装包

[abrt-addon-ccpp]-[2.1.11-19].[el7].[x86_64].rpm     --rpm结尾的适用与redhat操作系统

       ||         ||         ||       ||

    软件名称       软件版本 软件适用系统 64位

2、软件安装方式:

(1)rpm

   
-ivh name.rpm      ---安装,i ---insatll,v 显示过程,h 哈希加密
linux中的软件管理
-qa                ---显示全部已安装软件
linux中的软件管理
-e name            ---卸载
linux中的软件管理
-ivh name.rpm --force               ---强制安装,但不能忽略依赖性
linux中的软件管理
-ivh name.rpm  --nodeps --force   ---忽略依赖性并强制安装,运行过程可能出问题
linux中的软件管理
-ql name            ---查看已安装软件位置
linux中的软件管理
-qlp name.rpm       ---查看安装包位置

-qip      ---查未安装包信息
linux中的软件管理
-qi name            ---查询软件信息
linux中的软件管理
-qf filename        ---查看filename属于哪个安装包

-qp name.rpm        ---查看安装后名称
linux中的软件管理
-Kv name.rpm        ---检测安装包是否篡改

linux中的软件管理


(2)yum    ---上层软件管理工具,主要解决软件的依赖关系,方便软件安装

要使用yum安装,必须先配置yum源,及指向文件。

<1> 准备本机对应版本的iso 镜像,并且挂载在本机上

linux中的软件管理

<2>配置本机yum源指向,可以删除文件路径下的其他指向也可以不删

vim /etc/yum.repos.d/yum.repo
[rhel7.2]                   ---名字自定义
name=rhel7.2               ---对名字的描述
baseurl=file:///mnt        ---镜像位置,file表示为本地,也可以是网络镜像http,ftp...
gpgcheck=0                 ---不检测gpgkey(软件出品logo)
linux中的软件管理

<3>配置网络yum源指向(须完成上一步)

首先得安装资源共享服务
yum install httpd -y
systemctl stop firewalld  
systemctl disable firewalld
systemctl start httpd
systemctl enable httpd
linux中的软件管理

linux中的软件管理

也可以不关闭防火墙,设置http服务开机启动即可
firewall-cmd --list-all
firewall-cmd --permanent --add-service=http
firewall-cmd --reload

然后查看http服务是否开机启动

linux中的软件管理
其次建立共享目录并挂载镜像文件到共享目录
mkdir /var/www/html/rhel7.2
umount /mnt
mount rhel-server-7.1-x86_64-dvd.iso /var/www/html/rhel7.2
linux中的软件管理
测试共享目录在浏览器中输入:http://127.0.0.1/rhel7.2可以看到镜像内容
linux中的软件管理
然后修改本机yum指向
[rhel7.2]
name=rhel7.2
baseurl=file:///var/www/html/rhel7.2
gpgcheck=0
linux中的软件管理
最后为了方便,设置开机自动挂载iso
vim /etc/rc.d/rc.local
mount rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2
linux中的软件管理
chmod +x /etc/rc.d/rc.local       ---加执行权限

<4>第三方软件仓库搭建

为了方便管理,建立software文件夹和网络镜像在同一目录下
linux中的软件管理
然后和搭建yum源类似,修改指向文件即可
linux中的软件管理
经过以上步骤网络yum 源和第三方软件仓库的配置已经完成,如果要让其它主机访问该yum源,则应该修改yum源指向为设置了共享服务的这台主机,具体见下图

linux中的软件管理

<5>yum基础命令:

yum install softname     ---安装
linux中的软件管理
yum remove softname      ---不会卸载依赖文件
linux中的软件管理
yum clean all            ---清空缓存,在下一次重新加载,yum
linux中的软件管理
yum history              ---- 查看安装,更新,卸载历史
linux中的软件管理
yum list softname        ---查看软件源中是否有此软件
linux中的软件管理
yum list installd        ---查看已安装软件名称
yum list available       ---查看可以用yum安装的软件名称
linux中的软件管理
yum search softwareinfo  ---根据软件信息搜索软件名字
linux中的软件管理
yum whatprovides filename   ---在yum源中查找包含filename文件的软件包
linux中的软件管理
yum update               ---更新
linux中的软件管理
yum reinstall softname   ---重新安装
linux中的软件管理
yum info softname        ---查看软件信息
 linux中的软件管理
yum repolist all      ---列出Yum源信息
linux中的软件管理
yum groups list        ---查看软件组信息
linux中的软件管理
yum groups info softname   ---查看软件组内包含的软件
yum groups install softwaregroup   ---安装组件
yum groups remove softwaregroup    ---卸载组件
createrepo -v /../../..   ---扫描软件仓库