当前位置: 首页 > news >正文

Linux中应用程序的安装于管理

Linux中应用程序的安装于管理

一 . rpm安装

1.挂载

光驱里面存放了很多rpm的软件包
光驱在系统中使用时,需要挂载

mount /dev/cdrom /mnt/
cd /mnt
[root@stw mnt]# ls
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
EULA             isolinux  repodata  TRANS.TBL
[root@stw mnt]# cd Packages
[root@stw Packages]# ls
389-ds-base-1.3.8.4-15.el7.x86_64.rpm
389-ds-base-libs-1.3.8.4-15.el7.x86_64.rpm
abattis-cantarell-fonts-0.0.25-1.el7.noarch.rpm
abrt-2.1.11-52.el7.centos.x86_64.rpm
......

Packages包中存放了很多rpm的软件包

2.rpm包管理命令
显示系统中以RPM方式安装的所有软件列表
rpm -qa
查看某个软件包是否安装
rpm  -q  vsftpd

或者

rpm  -qa  | grep  vsftpd
查看指定软件包的详细信息
[root@stw ~]# rpm -qi vsftpd
Name        : vsftpd
Version     : 3.0.2
Release     : 29.el7_9
Architecture: x86_64
Install Date: Mon 28 Jul 2025 11:48:19 AM CST
Group       : System Environment/Daemons
Size        : 361349
License     : GPLv2 with exceptions
Signature   : RSA/SHA256, Fri 11 Jun 2021 11:06:15 PM CST, Key ID 24c6a8a7f4a80eb5
Source RPM  : vsftpd-3.0.2-29.el7_9.src.rpm
Build Date  : Thu 10 Jun 2021 12:15:50 AM CST
Build Host  : x86-02.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : https://security.appspot.com/vsftpd.html
Summary     : Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.
显示指定软件包在当前系统中安装的所有目录和文件

(安装了vsftpd这个软件包之后会生成出来的所有目录和文件)

[root@stw ~]# rpm -ql vsftpd 
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
......
查看指定的文件或目录是哪个软件包所安装的

rpm -qf 文件或者目录名

[root@stw ~]# rpm -qf /etc/logrotate.d/vsftpd
vsftpd-3.0.2-29.el7_9.x86_64
查询未安装的rpm软件包信息

-qpi:查看指定软件包的详细信息----指定软件包的路径要明确

[root@stw ~]# rpm -qpi /mnt/Packages/vsftpd-3.0.2-25.el7.x86_64.rpm 
Name        : vsftpd
Version     : 3.0.2
Release     : 25.el7
Architecture: x86_64
Install Date: (not installed)
Group       : System Environment/Daemons
Size        : 361335
License     : GPLv2 with exceptions
Signature   : RSA/SHA256, Mon 12 Nov 2018 10:48:54 PM CST, Key ID 24c6a8a7f4a80eb5
Source RPM  : vsftpd-3.0.2-25.el7.src.rpm
Build Date  : Wed 31 Oct 2018 03:45:10 AM CST
Build Host  : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : https://security.appspot.com/vsftpd.html
Summary     : Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.

-qpl:查看该软件包准备安装的所有目标目录和文件列表(这些目标目录和文件列表还没有存在)

[root@stw ~]# rpm -qpl /mnt/Packages/vsftpd-3.0.2-25.el7.x86_64.rpm 
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
......

rpm
-i 安装 (内核的更新和安装用-i)
-v 显示详细过程
-h 以“#”显示进度
-e 卸载
-U 更新,如果该软件包未安装的话,则直接安装最新版本
-F 更新,如果未安装旧版本软件包,则放弃安装或更新
–force 强制
–nodeps 去除依赖性关系

卸载(rpm -e 软件包名称)

[root@stw ~]# rpm -e vsftpd 
[root@stw ~]# rpm -q vsftpd
package vsftpd is not installed

二 . yum安装

1.yum仓库
yum仓库必须在/etc/yum.repos.d/目录下

cd /etc/yum.repos.d/
rm -rf *
vim server.repo
[a]
name=aa
baseurl=file:///mnt/ (本地安装)
baseurl=http:// (网络安装)
enabled=1
gpgcheck=0(校验完整性,1:开启,0:关闭)

一般网络安装才需要校验
gpgcheck=1(校验完整性,1:开启,0:关闭)
gpgkey =http://加上密钥具体位置

[root@stw ~]# cd /etc/yum.repos.d/
[root@stw yum.repos.d]# ls
CentOS-Base.repo
[root@stw yum.repos.d]# rm -rf *
[root@stw yum.repos.d]# vim server.repo              //server可以自己命名

在这里插入图片描述

2.yum命令
安装软件包(yum -y install 软件包名)
[root@stw yum.repos.d]# yum -y install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
a                                                        | 3.6 kB     00:00     
Package matching httpd-2.4.6-88.el7.centos.x86_64 already installed. Checking for update.
Nothing to do
卸载软件包(yum -y remove 软件包名)
[root@stw yum.repos.d]# yum -y remove httpd
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-99.el7.centos.1 will be erased
--> Finished Dependency Resolution
a                                                        | 3.6 kB     00:00     Dependencies Resolved================================================================================Package      Arch          Version                       Repository       Size
================================================================================
Removing:httpd        x86_64        2.4.6-99.el7.centos.1         @updates        9.4 MTransaction Summary
================================================================================
Remove  1 PackageInstalled size: 9.4 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionErasing    : httpd-2.4.6-99.el7.centos.1.x86_64                           1/1 Verifying  : httpd-2.4.6-99.el7.centos.1.x86_64                           1/1 Removed:httpd.x86_64 0:2.4.6-99.el7.centos.1                                          Complete!
安装软件包组(yum -y groupinstall "软件包组 " )
[root@stw yum.repos.d]# yum -y groupinstall "Development Tools"
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Maybe run: yum groups mark install (see man yum)
No packages in any requested group available to install or update
卸载软件包组(yum -y group remove “软件包组”)
[root@stw yum.repos.d]# yum -y groupremove "Development Tools"
列出所有已安装的和可用的软件包(yum list)
列出所有已安装的和可用的软件包组(yum group list)
更新软件包(yum update 软件包)
查看yum仓库是否配置成功(yum repolist)
[root@stw yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id                                repo name                          status
a                                      aa                                 4,021
repolist: 4,021

三 . dns安装

dnf的使用方法基本上和yum一致(使用前要用yum网络安装dnf)
dnf -y install
dnf -y remove
dnf -y update

[root@stw yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0   8376      0 --:--:-- --:--:-- --:--:--  8410
[root@stw yum.repos.d]# rpm -q dnf
package dnf is not installed
[root@stw yum.repos.d]# yum -y install dnf
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package dnf.noarch 0:4.0.9.2-2.el7_9 will be installed
--> Finished Dependency ResolutionDependencies Resolved================================================================================Package      Arch            Version                     Repository       Size
================================================================================
Installing:dnf          noarch          4.0.9.2-2.el7_9             extras          357 kTransaction Summary
================================================================================
Install  1 PackageTotal download size: 357 k
Installed size: 1.6 M
Downloading packages:
dnf-4.0.9.2-2.el7_9.noarch.rpm                             | 357 kB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionInstalling : dnf-4.0.9.2-2.el7_9.noarch                                   1/1 Verifying  : dnf-4.0.9.2-2.el7_9.noarch                                   1/1 Installed:dnf.noarch 0:4.0.9.2-2.el7_9                                                  Complete!
[root@stw yum.repos.d]# rpm -q dnf
dnf-4.0.9.2-2.el7_9.noarch
现在可以使用dnf
[root@stw yum.repos.d]# dnf -y install vsftpd
aa                                               78 MB/s | 4.8 MB     00:00    
CentOS-7 - Base - mirrors.aliyun.com            0.0  B/s |   0  B     00:00    
CentOS-7 - Updates - mirrors.aliyun.com         0.0  B/s |   0  B     00:00    
CentOS-7 - Extras - mirrors.aliyun.com          0.0  B/s |   0  B     00:00    
Dependencies resolved.
================================================================================Package         Arch            Version                 Repository        Size
================================================================================
Installing:vsftpd          x86_64          3.0.2-29.el7_9          updates          173 kTransaction Summary
================================================================================
Install  1 PackageTotal download size: 173 k
Installed size: 353 k
Downloading Packages:
vsftpd-3.0.2-29.el7_9.x86_64.rpm                1.4 MB/s | 173 kB     00:00    
--------------------------------------------------------------------------------
Total                                           1.4 MB/s | 173 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing        :                                                        1/1 Installing       : vsftpd-3.0.2-29.el7_9.x86_64                           1/1 Running scriptlet: vsftpd-3.0.2-29.el7_9.x86_64                           1/1 Verifying        : vsftpd-3.0.2-29.el7_9.x86_64                           1/1 Installed:vsftpd-3.0.2-29.el7_9.x86_64                                                  Complete!
http://www.dtcms.com/a/302109.html

相关文章:

  • Java面试宝典:Spring Boot
  • 基于BEKK-GARCH模型的参数估计、最大似然估计以及参数标准误估计的MATLAB实现
  • 【Linux学习】(12)环境变量
  • 自定义spring-boot-starter
  • STM32F4—电源管理器
  • 网络安全笔记
  • 图像处理第三篇:初级篇(续)—— 照明的理论知识
  • Springboot社区养老保险系统小程序
  • 基础算法思想——分治
  • 服务器防护教程 - 宝塔篇
  • 大模型应用开发1-认识大模型
  • 【Linux】编辑器vim和编译器gcc/g++
  • go‑cdc‑chunkers:用 CDC 实现智能分块 强力去重
  • mp快速入门
  • AI在编程、测试、数据分析等领域的前沿应用(技术报告)
  • 深度思考和搜索研究 最新的GSPO强化学习算法
  • 第六届金头脑杯夏季巅峰挑战:以智慧之名,点亮幼儿成长之路
  • RV1126B-P机器视觉应用AIoT及边缘计算算力达2.0支持 HDR 、 3DNR
  • Java设计模式之<建造者模式>
  • Go 语言面试题
  • window显示驱动开发—Direct3D 11 视频播放改进
  • WPF,按钮透明背景实现MouseEnter
  • 二级域名分发源码最新开源版
  • 使用Ettus USRP X440对雷达和EW系统进行原型验证
  • 【实时Linux实战系列】基于实时Linux的智能家居系统设计
  • 电脑开机不显示网卡的原因
  • LLM学习笔记5——InstructGPT
  • 用AI压缩音视频,如何让尺寸更紧凑?
  • ADB+Python控制(有线/无线) Scrcpy+按键映射(推荐)
  • 云原生作业(haproxy)