CentOS7卸载Apachemariadbphp等方法
由于工作需要,可能要进行Apache mariadb php等服务的卸载,闲话不多说,直接上方法。
乌苏网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、响应式网站设计等网站项目制作,到程序开发,运营维护。创新互联自2013年创立以来到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联。
Apache 卸载
我们的第一个例子就先拿 Apache 来开刀。不管你信不信现在我就要把它从Centos里卸载掉,不要问为什么,你懂的!执行下面一行代码
# rpm -qa|grep httpd
然后终端窗口就可显示如下两条信息
httpd-2.4.6-40.el7.centos.1.x86_64httpd-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 phpphp-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 mariadbmariadb-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_64mariadb-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 transactionWarning: RPMDB altered outside of yum. Erasing : 1:mariadb-bench-5.5.47-1.el7_2.x86_64 1/4Erasing : 1:mariadb-test-5.5.47-1.el7_2.x86_64 2/4Erasing : 1:mariadb-server-5.5.47-1.el7_2.x86_64 3/4warning: /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/4Verifying : 1:mariadb-bench-5.5.47-1.el7_2.x86_64 1/4Verifying : 1:mariadb-test-5.5.47-1.el7_2.x86_64 2/4Verifying : 1:mariadb-server-5.5.47-1.el7_2.x86_64 3/4Verifying : 1:mariadb-5.5.47-1.el7_2.x86_64 4/4Removed: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 mariadbmariadb-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 * 这个命令行是如何一步一步删掉目标服务的以及如何处理删除目标服务所依赖的服务。
搞定,收工~领盒饭啦!!
网站题目:CentOS7卸载Apachemariadbphp等方法
标题URL:http://hbruida.cn/article/pccpgs.html