网站首页 » 网站运营 » Linux » Centos 7 Apache,php,MariaDB,FTP的卸载方法
上一篇:
下一篇:

Centos 7 Apache,php,MariaDB,FTP的卸载方法

前言

作为站长或者前端开发者,云服务器对于你来说应该不陌生了。我相信你还经常跟Centos 7 Apache,php,MariaDB,FTP等这些极常用的服务打了不少交道。包括这些服务的安装,配置和卸载。本文要分享的是如何卸载这些服务。下面我们就一步一个脚印来了解这些服务的卸载方法。

卸载

Apache 卸载

我们的第一个例子就先拿 Apache 来开刀。不管你信不信现在我就要把它从Centos里卸载掉,不要问为什么,你懂的!执行下面一行代码

# rpm -qa|grep httpd

然后终端窗口就可显示如下两条信息

httpd-2.4.6-40.el7.centos.1.x86_64
httpd-tools-2.4.6-40.el7.centos.1.x86_64

很棒,我们已经找到猎物了,下一步要做的就是有的放矢

# rpm -e httpd-2.4.6-40.el7.centos.1.x86_64

回车后竟然提示如下错误

error: Failed dependencies:
httpd-mmn = 20120211x8664 is needed by (installed) php-5.4.16-36.1.el7_2.1.x86_64

稍微懂点英文的朋友估计已经知道这是什么回事了,大概意思就是说,php 依赖了 Apache 环境。

所以我们得先把这个幕后的“黑手”干掉。

在干掉它之前,我们肯定得了解下 php 的能力几何,配置了什么装备对吧,毕竟知己知彼,百战不殆!执行命令

# rpm  -qa|grep php

终端会列出如下信息(这个会因人而异,就看你之前安装了多少扩展)

[root@niaoyun53098 ~]# rpm -qa|grep php
php-cli-5.4.16-36.1.el7_2.1.x86_64
php-pear-1.9.4-21.el7.noarch
php-mbstring-5.4.16-36.1.el7_2.1.x86_64
php-common-5.4.16-36.1.el7_2.1.x86_64
php-process-5.4.16-36.1.el7_2.1.x86_64
php-xml-5.4.16-36.1.el7_2.1.x86_64
php-gd-5.4.16-36.1.el7_2.1.x86_64
php-ldap-5.4.16-36.1.el7_2.1.x86_64
php-pdo-5.4.16-36.1.el7_2.1.x86_64
php-mysql-5.4.16-36.1.el7_2.1.x86_64
php-bcmath-5.4.16-36.1.el7_2.1.x86_64
php-5.4.16-36.1.el7_2.1.x86_64
php-odbc-5.4.16-36.1.el7_2.1.x86_64
php-xmlrpc-5.4.16-36.1.el7_2.1.x86_64

扩展这么之,我们要删掉哪一个?答案是你可以全删了,也可以只删掉刚才报错的 php-5.4.16-36.1.el7_2.1.x86_64,下面我就简单点只删掉 php-5.4.16-36.1.el7_2.1.x86_64 这个绊脚石。

# rpm -e php-5.4.16-36.1.el7_2.1.x86_64

这个执行完之后,你再

# rpm -qa|grep php

查看下,在列出的信息中已经不见了 php-5.4.16-36.1.el7_2.1.x86_64 的踪影了。接下来要做的就是 卸载 Apache 了。

# rpm -e httpd-2.4.6-40.el7.centos.1.x86_64

执行完后会有如下提示

warning: /etc/httpd/conf/httpd.conf saved as /etc/httpd/conf/httpd.conf.rpmsave

不用管它,现在执行下命令

# rpm  -qa|grep httpd

里面只剩下

httpd-tools-2.4.6-40.el7.centos.1.x86_64

好了,到这里已经完成了 Apache 服务的卸载。

如果你觉得上面分两步执行很麻烦,那么你可以使用下面这一行命令来一石两鸟。

# yum erase httpd

这个命令行会自动的帮你卸载 httpd 服务,如果有其实服务(如 php )依赖于 Apache 的话,也会一同被卸载。

MariaDB 卸载

为了让你更详细的了解  yum erase 这个命令行,下面我用 yum erase *(*代表服务,如:MariaDB,Apache,FTP,php) 再来举个例子,由于我用的是centos 7,所以也装了一个MariaDB 数据库,所以就拿它来当这次的小白鼠吧。

下面是 yum erase mariadb 命令的 执行记录

[root@niaoyun53098 ~]# rpm -qa|grep mariadb
mariadb-devel-5.5.47-1.el7_2.x86_64
mariadb-embedded-5.5.47-1.el7_2.x86_64
mariadb-bench-5.5.47-1.el7_2.x86_64
mariadb-server-5.5.47-1.el7_2.x86_64
mariadb-test-5.5.47-1.el7_2.x86_64
mariadb-libs-5.5.47-1.el7_2.x86_64
mariadb-embedded-devel-5.5.47-1.el7_2.x86_64
mariadb-5.5.47-1.el7_2.x86_64
[root@niaoyun53098 ~]# rpm -e mariadb-5.5.47-1.el7_2.x86_64
error: Failed dependencies:
mariadb(x86-64) = 1:5.5.47-1.el7_2 is needed by (installed) mariadb-server-1:5.5.47-1.el7_2.x86_64
mariadb(x86-64) = 1:5.5.47-1.el7_2 is needed by (installed) mariadb-test-1:5.5.47-1.el7_2.x86_64
mariadb(x86-64) = 1:5.5.47-1.el7_2 is needed by (installed) mariadb-bench-1:5.5.47-1.el7_2.x86_64
[root@niaoyun53098 ~]# yum erase mariadb-5.5.47-1.el7_2.x86_64
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.47-1.el7_2 will be erased
--> Processing Dependency: mariadb(x86-64) = 1:5.5.47-1.el7_2 for package: 1:mariadb-bench-5.5.47-1.el7_2.x86_64
--> Processing Dependency: mariadb(x86-64) = 1:5.5.47-1.el7_2 for package: 1:mariadb-test-5.5.47-1.el7_2.x86_64
--> Processing Dependency: mariadb(x86-64) = 1:5.5.47-1.el7_2 for package: 1:mariadb-server-5.5.47-1.el7_2.x86_64
--> Running transaction check
---> Package mariadb-bench.x86_64 1:5.5.47-1.el7_2 will be erased
---> Package mariadb-server.x86_64 1:5.5.47-1.el7_2 will be erased
---> Package mariadb-test.x86_64 1:5.5.47-1.el7_2 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================
Removing:
mariadb x86_64 1:5.5.47-1.el7_2 @updates 49 M
Removing for dependencies:
mariadb-bench x86_64 1:5.5.47-1.el7_2 @updates 2.6 M
mariadb-server x86_64 1:5.5.47-1.el7_2 @updates 56 M
mariadb-test x86_64 1:5.5.47-1.el7_2 @updates 124 M

Transaction Summary
===============================================================================================================================================================================================================
Remove 1 Package (+3 Dependent packages)

Installed size: 231 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Erasing : 1:mariadb-bench-5.5.47-1.el7_2.x86_64 1/4
Erasing : 1:mariadb-test-5.5.47-1.el7_2.x86_64 2/4
Erasing : 1:mariadb-server-5.5.47-1.el7_2.x86_64 3/4
warning: /var/log/mariadb/mariadb.log saved as /var/log/mariadb/mariadb.log.rpmsave
Erasing : 1:mariadb-5.5.47-1.el7_2.x86_64 4/4
Verifying : 1:mariadb-bench-5.5.47-1.el7_2.x86_64 1/4
Verifying : 1:mariadb-test-5.5.47-1.el7_2.x86_64 2/4
Verifying : 1:mariadb-server-5.5.47-1.el7_2.x86_64 3/4
Verifying : 1:mariadb-5.5.47-1.el7_2.x86_64 4/4

Removed:
mariadb.x86_64 1:5.5.47-1.el7_2

Dependency Removed:
mariadb-bench.x86_64 1:5.5.47-1.el7_2 mariadb-server.x86_64 1:5.5.47-1.el7_2 mariadb-test.x86_64 1:5.5.47-1.el7_2

Complete!
[root@niaoyun53098 ~]# rpm -qa|grep mariadb
mariadb-devel-5.5.47-1.el7_2.x86_64
mariadb-embedded-5.5.47-1.el7_2.x86_64
mariadb-libs-5.5.47-1.el7_2.x86_64
mariadb-embedded-devel-5.5.47-1.el7_2.x86_64

如果你看得够仔细的话,那会看到 yum erase * 这个命令行是如何一步一步删掉目标服务的以及如何处理删除目标服务所依赖的服务。

其它服务卸载

其实他服务的卸载跟 Apache 服务,MariaDB 服务一样,只需要选择其中的一种方法对目标服务进行卸载就可以了。

祝您好远!

  • 微信扫一扫,赏我

  • 支付宝扫一扫,赏我

声明

原创文章,不经本站同意,不得以任何形式转载,如有不便,请多多包涵!

本文永久链接:http://yunkus.com/centos7-ftp-apache-php-mariadb-uninstall/

Leave a Reply

Your email address will not be published. Required fields are marked *

评论 END