Home  >  Article  >  Backend Development  >  Ubuntu completely uninstalls apache2, php5 and mysql

Ubuntu completely uninstalls apache2, php5 and mysql

伊谢尔伦
伊谢尔伦Original
2016-11-29 11:13:532026browse

I thought that there are a lot of commands under Ubuntu, and it’s not that troublesome as long as I find the correct command. The damn thing is, there are so many results on the Internet, and I don’t know how to create them randomly, so none of them work at all. I loaded and unloaded Apache seven or eight times. It took more than two hours.

Finally I saw someone’s method on a forum. I found that the command was a little different from others, so I gave it a try. It was really good. Method:

sudo apt-get –purge remove apache2

sudo apt-get –purge remove apache2-common

sudo apt-get –purge remove apache2-utils

sudo apt-get autoremove apache2

(–purge means not to retain the configuration file, this is absolutely indispensable)


Then sudo apt-get install apache2

PS: If it doesn’t work, just Forcefully delete everything about apache2, because I have already killed everything before executing these commands.

Delete the /etc/apache2 folder: sudo rm -r /etc/apache2

Delete the /var/www folder: sudo rm -r /var/www

Delete /etc/init.d/apache2 File: sudo rm -r /etc/init.d/apache2

Then uninstall PHP5

The method is as follows:

sudo apt-get –purge remove libapache2-mod-php5 php5 php5-gd php5-mysql

sudo apt-get autoremove php5

The following is how to uninstall MYSQL:

Enter the command in the terminal:

1 sudo apt-get autoremove –purge mysql-server-5.0

2 sudo apt-get remove mysql-server

3 sudo apt -get autoremove mysql-server
4 sudo apt-get remove mysql-common (very important)

The following sentence is to clear the residual information.

dpkg -l |grep ^rc|awk ’{print $2}’ |sudo xargs dpkg -P

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn