Centos7卸载nginx及php、php-fpm方法

本文环境:Centos7、yum方式安装的nginx和php、php-fpm

之前是通过yum方式直接安装nginx和php、php-fpm,这样的好处是方便,不用一步一步去安装解决各个依赖包问题,现在情况特殊,想要卸载掉已经安装的nginx和php、php-fpm,方法如下:

  ====  查看nginx是否安装 rpm -qa | grep nginx

  ====  查找nginx安装目录:whereis nginx


先输入命令:yum remove nginx  接着屏幕上打印出以下文字:

已加载插件:fastestmirror, langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 nginx.x86_64.1.1.8.0-1.el7.ngx 将被 删除
--> 解决依赖关系完成
 
依赖关系解决
 
============================================================================================================
 Package              架构                  版本                                源                     大小
============================================================================================================
正在删除:
 nginx                x86_64                1:1.8.0-1.el7.ngx                   @nginx                889 k
 
事务概要
============================================================================================================
移除  1 软件包
 
安装大小:889 k
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在删除    : 1:nginx-1.8.0-1.el7.ngx.x86_64                                                          1/1 
警告:/etc/nginx/nginx.conf 已另存为 /etc/nginx/nginx.conf.rpmsave
  验证中      : 1:nginx-1.8.0-1.el7.ngx.x86_64                                                          1/1 
 
删除:
  nginx.x86_64 1:1.8.0-1.el7.ngx                                                                            
 
完毕!
到此,卸载nginx完毕,可以使用which nginx找一下是否卸载完全!
[root@localhost ~]# which nginx
/usr/bin/which: no nginx in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

接下来演示卸载php和php-fpm

输入命令:yum remove php 
已加载插件:fastestmirror, langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 php.x86_64.0.5.4.16-36.el7_1 将被 删除
--> 解决依赖关系完成
 
依赖关系解决
 
============================================================================================================
 Package             架构                   版本                             源                        大小
============================================================================================================
正在删除:
 php                 x86_64                 5.4.16-36.el7_1                  @updates                 4.4 M
 
事务概要
============================================================================================================
移除  1 软件包
 
安装大小:4.4 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在删除    : php-5.4.16-36.el7_1.x86_64                                                              1/1 
  验证中      : php-5.4.16-36.el7_1.x86_64                                                              1/1 
 
删除:
  php.x86_64 0:5.4.16-36.el7_1                                                                              
 
完毕!
[root@localhost ~]# yum remove php-fpm
已加载插件:fastestmirror, langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 php-fpm.x86_64.0.5.4.16-36.el7_1 将被 删除
--> 解决依赖关系完成
 
依赖关系解决
 
============================================================================================================
 Package                架构                  版本                            源                       大小
============================================================================================================
正在删除:
 php-fpm                x86_64                5.4.16-36.el7_1                 @updates                4.5 M
 
事务概要
============================================================================================================
移除  1 软件包
 
安装大小:4.5 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在删除    : php-fpm-5.4.16-36.el7_1.x86_64                                                          1/1 
  验证中      : php-fpm-5.4.16-36.el7_1.x86_64                                                          1/1 
 
删除:
  php-fpm.x86_64 0:5.4.16-36.el7_1                                                                          
 
完毕!

到此还没完全卸载,可以使用php -v查看一下
[root@localhost ~]# php -v
PHP 5.4.16 (cli) (built: Jun 23 2015 21:17:27) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[root@localhost ~]# rpm -qa|grep php
php-common-5.4.16-36.el7_1.x86_64
php-cli-5.4.16-36.el7_1.x86_64
[root@localhost ~]# rpm -e php-common-5.4.16-36.el7_1.x86_64
错误:依赖检测失败:
php-common(x86-64) = 5.4.16-36.el7_1 被 (已安裝) php-cli-5.4.16-36.el7_1.x86_64 需要
[root@localhost ~]# rpm -e php-cli-5.4.16-36.el7_1.x86_64
[root@localhost ~]# rpm -e php-common-5.4.16-36.el7_1.x86_64
[root@localhost ~]# which php
/usr/bin/which: no php in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
 
OK,全部卸载完成!
 
 
 
 
http://blog.csdn.net/caozaifei/article/details/53424758
posted @ 2018-01-25 15:52  让双脚&去腾空  阅读(5748)  评论(0编辑  收藏  举报