在 CentOS 上“卸载 LAMP”通常指卸载 Linux + Apache + MySQL/MariaDB + PHP 中的服务组件(Linux 系统本身一般不卸载)。下面按常见情况给你几种做法。
rpm -qa | grep -E "httpd|mysql|mariadb|php"
systemctl stop httpd
systemctl stop mariadb # 或 mysqld
systemctl stop php-fpm # 如果用了
yum remove httpd httpd-tools
# MariaDB
yum remove mariadb mariadb-server
# MySQL
yum remove mysql mysql-server
yum remove php php-*
yum autoremove
rm -rf /etc/httpd
rm -rf /var/www
rm -rf /var/lib/mysql
rm -rf /etc/my.cnf
rm -rf /etc/my.cnf.d
rm -rf /etc/php*
那就不能 yum remove,只能手动删:
pkill httpd
pkill mysqld
pkill php-fpm
rm -rf /usr/local/apache
rm -rf /usr/local/mysql
rm -rf /usr/local/php
rm -f /etc/init.d/httpd
rm -f /etc/init.d/mysqld
yum remove php php-*
yum remove mariadb-server
which httpd
which mysql
which php
无输出即表示已卸载。
如果你能告诉我:
我可以给你精确的一条命令卸载方案。