1.介绍软件包安装方式
rpm包安装:
rpm是个软件包管理工具,通过.rpm后缀来操作
-i #安装
-q #查询
-l #列出软件包下的文件
-e #卸载
-h, #软件包安装的时候列出哈希标记 (和 -v 一起使用效果更好)
-v, #提供更多的详细信息输出
rpm的痛点:需要依赖
python
[root@shell Packages]# ls -l |grep nginx
-rw-rw-r--. 1 root root 23376 11月 12 2018 pcp-pmda-nginx-4.1.0-4.el7.x86_64.rpm
[root@shell Packages]# rpm -ivh pcp-pmda-nginx-4.1.0-4.el7.x86_64.rpm
错误:依赖检测失败:
perl(LWP::UserAgent) 被 pcp-pmda-nginx-4.1.0-4.el7.x86_64 需要
perl-PCP-PMDA = 4.1.0-4.el7 被 pcp-pmda-nginx-4.1.0-4.el7.x86_64 需要
[root@shell Packages]# rpm -ivh perl-PCP-PMDA-4.1.0-4.el7.x86_64.rpm
错误:依赖检测失败:
libpcp.so.3()(64bit) 被 perl-PCP-PMDA-4.1.0-4.el7.x86_64 需要
libpcp.so.3(PCP_3.0)(64bit) 被 perl-PCP-PMDA-4.1.0-4.el7.x86_64 需要
libpcp.so.3(PCP_3.21)(64bit) 被 perl-PCP-PMDA-4.1.0-4.el7.x86_64 需要
libpcp.so.3(PCP_3.22)(64bit) 被 perl-PCP-PMDA-4.1.0-4.el7.x86_64 需要
libpcp_pmda.so.3()(64bit) 被 perl-PCP-PMDA-4.1.0-4.el7.x86_64 需要
libpcp_pmda.so.3(PCP_PMDA_3.0)(64bit) 被 perl-PCP-PMDA-4.1.0-4.el7.x86_64 需要
pcp-libs = 4.1.0-4.el7 被 perl-PCP-PMDA-4.1.0-4.el7.x86_64 需要
[root@shell Packages]#
一般组合:
rpm -ivh .rpm后缀 #安装
python
[root@shell ~]# rpm -ivh nginx-1.20.1-9.el7.x86_64.rpm
错误:依赖检测失败:
nginx-filesystem = 1:1.20.1-9.el7 被 nginx-1:1.20.1-9.el7.x86_64 需要
[root@shell ~]# rpm -ivh nginx-1.20.1-9.el7.x86_64.rpm nginx-filesystem-1.20.1-9.el7.noarch.rpm openssl11-libs-1.1.1k-2.el7.x86_64.rpm centos-indexhtml-7-9.el7.centos.noarch.rpm gperftools-libs-2.6.1-1.el7.x86_64.rpm
准备中... ################################# [100%]
软件包 gperftools-libs-2.6.1-1.el7.x86_64 已经安装
软件包 centos-indexhtml-7-9.el7.centos.noarch 已经安装
软件包 openssl11-libs-1:1.1.1k-5.el7.x86_64 (比 openssl11-libs-1:1.1.1k-2.el7.x86_64 还要新) 已经安装
软件包 nginx-filesystem-1:1.20.1-10.el7.noarch (比 nginx-filesystem-1:1.20.1-9.el7.noarch 还要新) 已经安装
软件包 nginx-1:1.20.1-10.el7.x86_64 (比 nginx-1:1.20.1-9.el7.x86_64 还要新) 已经安装
file /usr/sbin/nginx from install of nginx-1:1.20.1-9.el7.x86_64 conflicts with file from package nginx-1:1.20.1-10.el7.x86_64
file /usr/share/man/man3/nginx.3pm.gz from install of nginx-1:1.20.1-9.el7.x86_64 conflicts with file from package nginx-1:1.20.1-10.el7.x86_64
rpm -qa 名字
python
[root@shell ~]# rpm -qa nginx
nginx-1.20.1-10.el7.x86_64
rpm -ql 名字 #列出安装nginx时创建的文件
python
[root@shell ~]# rpm -ql nginx
/etc/logrotate.d/nginx
/etc/nginx/fastcgi.conf
/etc/nginx/fastcgi.conf.default
/etc/nginx/fastcgi_params
/etc/nginx/fastcgi_params.default
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/mime.types.default
/etc/nginx/nginx.conf
/etc/nginx/nginx.conf.default
/etc/nginx/scgi_params
/etc/nginx/scgi_params.default
/etc/nginx/uwsgi_params
/etc/nginx/uwsgi_params.default
/etc/nginx/win-utf
/usr/bin/nginx-upgrade
/usr/lib/systemd/system/nginx.service
/usr/lib64/nginx/modules
/usr/sbin/nginx
/usr/share/doc/nginx-1.20.1
/usr/share/doc/nginx-1.20.1/CHANGES
/usr/share/doc/nginx-1.20.1/README
/usr/share/doc/nginx-1.20.1/README.dynamic
/usr/share/doc/nginx-1.20.1/UPGRADE-NOTES-1.6-to-1.10
/usr/share/licenses/nginx-1.20.1
/usr/share/licenses/nginx-1.20.1/LICENSE
/usr/share/man/man3/nginx.3pm.gz
/usr/share/man/man8/nginx-upgrade.8.gz
/usr/share/man/man8/nginx.8.gz
/usr/share/nginx/html/404.html
/usr/share/nginx/html/50x.html
/usr/share/nginx/html/en-US
/usr/share/nginx/html/icons
/usr/share/nginx/html/icons/poweredby.png
/usr/share/nginx/html/img
/usr/share/nginx/html/index.html
/usr/share/nginx/html/nginx-logo.png
/usr/share/nginx/html/poweredby.png
/usr/share/nginx/modules
/usr/share/vim/vimfiles/ftdetect/nginx.vim
/usr/share/vim/vimfiles/ftplugin/nginx.vim
/usr/share/vim/vimfiles/indent/nginx.vim
/usr/share/vim/vimfiles/syntax/nginx.vim
/var/lib/nginx
/var/lib/nginx/tmp
/var/log/nginx
/var/log/nginx/access.log
/var/log/nginx/error.log
rpm -e 命名的名字#卸载
python
[root@shell ~]# rpm -qa tree
tree-1.6.0-10.el7.x86_64
[root@shell ~]# rpm -e tree
[root@shell ~]# rpm -qa tree
which nginx 一般搭配yum provides 使用 #查看软件属于那个包中
python
[root@shell ~]# which nginx
/usr/sbin/nginx
[root@shell ~]# rpm -qa /usr/sbin/nginx
[root@shell ~]# yum provides /usr/sbin/nginx
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: mirror.01link.hk
1:nginx-1.20.1-10.el7.x86_64 : A high performance web server and reverse proxy server
源 :epel
匹配来源:
文件名 :/usr/sbin/nginx
1:nginx-1.20.1-10.el7.x86_64 : A high performance web server and reverse proxy server
源 :@epel
匹配来源:
文件名 :/usr/sbin/nginx
yum软件包管理(在线,一般生产环境使用):
python
[root@shell Packages]# yum install -y tree
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: mirror.01link.hk
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
正在解决依赖关系
--> 正在检查事务
---> 软件包 tree.x86_64.0.1.6.0-10.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
========================================================================================================
Package 架构 版本 源 大小
========================================================================================================
正在安装:
tree x86_64 1.6.0-10.el7 base 46 k
事务概要
========================================================================================================
安装 1 软件包
总下载量:46 k
安装大小:87 k
Downloading packages:
tree-1.6.0-10.el7.x86_64.rpm | 46 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : tree-1.6.0-10.el7.x86_64 1/1
验证中 : tree-1.6.0-10.el7.x86_64 1/1
已安装:
tree.x86_64 0:1.6.0-10.el7
完毕!
provides 命令或者文件路径 :查询软件包名
python
[root@shell ~]# yum provides rz
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: mirror.nju.edu.cn
epel/x86_64/filelists_db | 12 MB 00:00:01
extras/7/x86_64/filelists_db | 303 kB 00:00:00
updates/7/x86_64/filelists_db | 14 MB 00:00:01
lrzsz-0.12.20-36.el7.x86_64 : The lrz and lsz modem communications programs
源 :base
匹配来源:
文件名 :/usr/bin/rz
lrzsz-0.12.20-36.el7.x86_64 : The lrz and lsz modem communications programs
源 :@anaconda
匹配来源:
文件名 :/usr/bin/rz
编译安装:
参考大佬链接:https://www.cnblogs.com/mclind/p/16972857.html