wiki/运维/操作系统/Linux/笔记/22.软件管理.md
2025-01-02 10:46:09 +08:00

81 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

redhatrpm文件rpm管理器使用yum、dnf包管理器
debiandeb文件dpkg管理器使用apt包管理器
## 1、rpm详解
rpm 用的很少都是用的dnf管理器管理
1.1 包查询
```shell
rpm -q 参数1、
参数:
-a所有包
-f查看指定的文件由哪个包安装生成
-l查看指定的程序包安装后生成的所有文件
```
## 2、dnf详解
现在是dnf的天下yum代码维护困难速度差
```shell
/etc/dnf/dnf.conf #为所有仓库提供的公共配置文件
/etc/yum.repos.d/*.repo #每个仓库的配置文件
```
```shell
gpgcheck=1 #安装包前要做包的合法性和完整性校验
installonly_limit=3 #同事可以安装3个包最小值为2如果设置0或1则不限制
clean_requirements_on_remove=True #删除包的时候是否将不再使用的包删除
bast=True #升级时,自动选择安装最新版,即使缺少包的依赖
```
```shell
[仓库名]
name=仓库名
baseurl=仓库位置
enabled={1|0}
gpgcheck={1|0}
gpgkey=URL
```
## 3、dnf 常用命令
##### 3.1 显示仓库列表
```shell
dnf repolist [all|enbaled|disabled]
dnf repolist -v #显示详细仓库列表
```
##### 3.2 显示程序包
```shell
dnf list [available|installd|updates]
dnf list 包名
```
##### 3.3 安装程序包
```shell
dnf install 包名
dnf reinstall 包名
```
##### 3.4 只下载相关依赖的包,而不安装
```shell
dnf install nginx --downloadonly --downloaddir=/保存文件夹
```
##### 3.5 卸载程序包
```shell
dnf remove 包名
dnf remove 包名 --purge #删除配置文件
```
##### 3.6 查询
```shell
dnf info 包名
```
```shell
dnf search 包名
```
## 4、apt包管理器
```shell
install安装
remove卸载
purge卸载并删除配置文件
update刷新存储库索引
uograde升级所有包
autoremove自动删除不需要的包
search搜索
show显示软件包细节
list查看包
--installed已安装
--available可获得
--updates可升级
```