一 yum指令
1. yum install 软件名
[root@gitcangku ~]# yum install vsftpd
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
gitlab_gitlab-ce/x86_64/signature | 862 B 00:00:00
gitlab_gitlab-ce/x86_64/signature | 1.0 kB 00:00:00 !!!
gitlab_gitlab-ce-source/signature | 862 B 00:00:00
gitlab_gitlab-ce-source/signature | 951 B 00:00:00 !!!
updates | 2.9 kB 00:00:00
gitlab_gitlab-ce/x86_64/primary | 3.7 MB 00:00:04
gitlab_gitlab-ce 881/881
正在解决依赖关系
--> 正在检查事务
---> 软件包 vsftpd.x86_64.0.3.0.2-29.el7_9 将被 安装
--> 解决依赖关系完成
2. yum remove 软件名
卸载软件
root@gitcangku ~]# yum remove vim
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.629-8.el7_9 将被 删除
--> 解决依赖关系完成
依赖关系解决
===========================================================================================================================================================================
Package 架构 版本 源 大小
===========================================================================================================================================================================
正在删除:
vim-enhanced x86_64 2:7.4.629-8.el7_9 @updates 2.2 M
事务概要
===========================================================================================================================================================================
移除 1 软件包
安装大小:2.2 M
是否继续?[y/N]:y
3 检查已经安装成功的软件
二 rpm指令
安装一个软件包的基本待遇
第一步: rpm包 的查询命令
第二步: rpm包 的 卸载
第三步: rpm包 的 安装
1 rpm -q
查询已安装的rpm表
rpm -qa | grep XXX
rpm -qa | less
rpm -qa
查看系统中有哪些已经安装的包
[root@gitcangku ~]# rpm -qa
grub2-2.02-0.86.el7.centos.x86_64
grub2-common-2.02-0.86.el7.centos.noarch
setup-2.8.71-11.el7.noarch
NetworkManager-tui-1.18.8-1.el7.x86_64
basesystem-10.0-7.el7.centos.noarch
authconfig-6.2.8-30.el7.x86_64
ncurses-base-5.9-14.20130511.el7_4.noarch
postfix-2.10.1-9.el7.x86_64
tzdata-2020a-1.el7.noarch
microcode_ctl-2.1-73.el7.x86_64
glibc-common-2.17-317.el7.x86_64
aic94xx-firmware-30-6.el7.noarch
nspr-4.21.0-1.el7.x86_64
biosdevname-0.7.3-2.el7.x86_64
libstdc++-4.8.5-44.el7.x86_64
dracut-config-rescue-033-572.el7.x86_64
bash-4.2.46-34.el7.x86_64
iprutils-2.4.17.1-3.el7.x86_64
pcre-8.32-17.el7.x86_64
passwd-0.79-6.el7.x86_64
zlib-1.2.7-18.el7.x86_64
btrfs-progs-4.9.1-1.el7.x86_64
xz-libs-5.2.2-1.el7.x86_64
e2fsprogs-1.42.9-19.el7.x86_64
libuuid-2.23.2-65.el7.x86_64
libsysfs-2.1.0-16.el7.x86_64
bzip2-libs-1.0.6-13.el7.x86_64
iwl105-firmware-18.168.6.1-79.el7.noarch
chkconfig-1.7.6-1.el7.x86_64
rootfiles-8.1-11.el7.noarch
readline-6.2-11.el7.x86_64
iwl5000-firmware-8.83.5.1_1-79.el7.noarch
gawk-4.0.2-4.el7_3.1.x86_64
iwl6050-firmware-41.28.5.1-79.el7.noarch
libattr-2.4.46-13.el7.x86_64
iwl3945-firmware-15.32.2.9-79.el7.noarch
libcap-2.22-11.el7.x86_64
iwl3160-firmware-25.30.13.0-79.el7.noarch
audit-libs-2.8.5-4.el7.x86_64
iwl100-firmware-39.31.5.1-79.el7.noarch
libffi-3.0.13-19.el7.x86_64
iwl5150-firmware-8.24.2.2-79.el7.noarch
iwl2000-firmware-18.168.6.1-79.el7.noarch
expat-2.1.0-12.el7.x86_64
perl-parent-0.225-244.el7.noarch
findutils-4.5.11-6.el7.x86_64
perl-podlators-2.5.1-3.el7.noarch
diffutils-3.3-5.el7.x86_64
perl-Pod-Escapes-1.04-299.el7_9.noarch
sqlite-3.7.17-8.el7_7.1.x86_64
2 rpm -qa|less
采用分页的形式查看所有的文件包,按空格翻页,按回车切换下一行
3 rpm -qa| grep python
[root@gitcangku ~]# rpm -qa| grep python
libsemanage-python-2.5-14.el7.x86_64
policycoreutils-python-2.5-34.el7.x86_64
python-chardet-2.2.1-3.el7.noarch
python-libs-2.7.5-89.el7.x86_64
python-schedutils-0.4-6.el7.x86_64
python-configobj-4.7.2-7.el7.noarch
libselinux-python-2.5-15.el7.x86_64
python-pycurl-7.19.0-19.el7.x86_64
python-slip-dbus-0.4.0-4.el7.noarch
rpm-python-4.11.3-45.el7.x86_64
audit-libs-python-2.8.5-4.el7.x86_64
python-IPy-0.75-6.el7.noarch
libxml2-python-2.9.1-6.el7_9.6.x86_64
python-kitchen-1.1.1-5.el7.noarch
python-2.7.5-89.el7.x86_64
python-decorator-3.4.0-3.el7.noarch
python-gobject-base-3.22.0-1.el7_4.1.x86_64
python-iniparse-0.4-9.el7.noarch
newt-python-0.52.15-4.el7.x86_64
python-perf-3.10.0-1160.el7.x86_64
python-linux-procfs-0.4.11-4.el7.noarch
python-slip-0.4.0-4.el7.noarch
python-urlgrabber-3.10-10.el7.noarch
dbus-python-1.1.1-9.el7.x86_64
python-firewall-0.6.3-11.el7.noarch
python-pyudev-0.15-9.el7.noarch
4 搜索文件的详细信息
[root@gitcangku ~]# rpm -qi python-chardet-2.2.1-3.el7.noarch
Name : python-chardet
Version : 2.2.1
Release : 3.el7
Architecture: noarch
Install Date: 2023年04月22日 星期六 16时19分28秒
Group : Development/Languages
Size : 1156541
License : LGPLv2
Signature : RSA/SHA256, 2019年08月23日 星期五 05时59分55秒, Key ID 24c6a8a7f4a80eb5
Source RPM : python-chardet-2.2.1-3.el7.src.rpm
Build Date : 2019年08月09日 星期五 10时04分59秒
Build Host : x86-02.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : https://github.com/chardet/chardet
Summary : Character encoding auto-detection in Python
Description :
Character encoding auto-detection in Python. As
smart as your browser. Open source.
[root@gitcangku ~]#
5 查询一个rpm中的包安装到哪里去了
[root@gitcangku ~]# rpm -ql python-chardet-2.2.1-3.el7.noarch
/usr/bin/chardetect
/usr/lib/python2.7/site-packages/chardet
/usr/lib/python2.7/site-packages/chardet-2.2.1-py2.7.egg-info
/usr/lib/python2.7/site-packages/chardet-2.2.1-py2.7.egg-info/PKG-INFO
/usr/lib/python2.7/site-packages/chardet-2.2.1-py2.7.egg-info/SOURCES.txt
/usr/lib/python2.7/site-packages/chardet-2.2.1-py2.7.egg-info/dependency_links.txt
/usr/lib/python2.7/site-packages/chardet-2.2.1-py2.7.egg-info/entry_points.txt
/usr/lib/python2.7/site-packages/chardet-2.2.1-py2.7.egg-info/top_level.txt
/usr/lib/python2.7/site-packages/chardet/__init__.py
/usr/lib/python2.7/site-packages/chardet/__init__.pyc
/usr/lib/python2.7/site-packages/chardet/__init__.pyo
/usr/lib/python2.7/site-packages/chardet/big5freq.py
/usr/lib/python2.7/site-packages/chardet/big5freq.pyc
/usr/lib/python2.7/site-packages/chardet/big5freq.pyo
/usr/lib/python2.7/site-packages/chardet/big5prober.py
/usr/lib/python2.7/site-packages/chardet/big5prober.pyc
/usr/lib/python2.7/site-packages/chardet/big5prober.pyo
/usr/lib/python2.7/site-packages/chardet/chardetect.py
/usr/lib/python2.7/site-packages/chardet/chardetect.pyc
/usr/lib/python2.7/site-packages/chardet/chardetect.pyo
/usr/lib/python2.7/site-packages/chardet/chardistribution.py
/usr/lib/python2.7/site-packages/chardet/chardistribution.pyc
/usr/lib/python2.7/site-packages/chardet/chardistribution.pyo
/usr/lib/python2.7/site-packages/chardet/charsetgroupprober.py
/usr/lib/python2.7/site-packages/chardet/charsetgroupprober.pyc
/usr/lib/python2.7/site-packages/chardet/charsetgroupprober.pyo
/usr/lib/python2.7/site-packages/chardet/charsetprober.py
/usr/lib/python2.7/site-packages/chardet/charsetprober.pyc
/usr/lib/python2.7/site-packages/chardet/charsetprober.pyo
/usr/lib/python2.7/site-packages/chardet/codingstatemachine.py
/usr/lib/python2.7/site-packages/chardet/codingstatemachine.pyc
/usr/lib/python2.7/site-packages/chardet/codingstatemachine.pyo
/usr/lib/python2.7/site-packages/chardet/compat.py
/usr/lib/python2.7/site-packages/chardet/compat.pyc
/usr/lib/python2.7/site-packages/chardet/compat.pyo
/usr/lib/python2.7/site-packages/chardet/constants.py
/usr/lib/python2.7/site-packages/chardet/constants.pyc
/usr/lib/python2.7/site-packages/chardet/constants.pyo
/usr/lib/python2.7/site-packages/chardet/cp949prober.py
6 查询一个文件属于那个包
相当于给上一个题目查出的包确定位置
[root@gitcangku ~]# rpm -qf /usr/share/doc/python-chardet-2.2.1
python-chardet-2.2.1-3.el7.noarch
7 软件包的卸载
文章来源:https://www.toymoban.com/news/detail-426800.html
三 总结
# 1 查询
rpm -qa | grep rpm包
# 2 卸载
rpm -e rpm全包名
rpm -e --nodeps rpm全包名
# 3 安装
rpm -ivh rpm包的全路径
四 示范安装
要去安装一个nagios3Nagios是一款网络监控软件,可以用来监测Linux系统的可靠性、性能和安全等服务,安装命令如下:yum install nagios3
检查是否存在,不存在就安装,安装完再检查
rpm一般装的是系统里已经存在的包
而yum是直接联网下载文章来源地址https://www.toymoban.com/news/detail-426800.html
到了这里,关于linux软件安装指令---yum和rpm的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!