LINUX – MASS- REMOVE HOW TO REMOVE LAMPSTACK (To start fresh) OR ANY OTHER PROGRAMS COMPLETELY- ALSO HOW TO INSTALL LAMP
This article goes with this article: How to remove an app completely
NOTE: im not responsible for any damages
Caution: USE AT YOUR OWN RISK (really like trying this rarely works, its really annoying to try and uninstall lamp)
MAKE A BACKUP OF EVERYTHING (take a snapshot if you have a VM)
First run this to see what apps will be purge/removed.
# dpkg -l | egrep “sql|apache|php”
Make sure you want to truely delete everything there. THen cross your fingers and read my NOTE and caution like 10 more times.
This will remove with purge every program, then run autoremove after to clean up in between each purge.
METHOD1 – purge and autoremove (after each purge) – need to hit Y to confirm every move
# for i in `dpkg -l | egrep “sql|apache|php” | awk ‘{print $2}’`; do echo REMOVEING $i; apt-get purge $i; apt-get autoremove; sleep 1; done;
At the end run:
# apt-get install -f
# apt-get clean
apt-get clean so that you can try and install it again
Keep hitting Y, Note it might delete alot more then you need.
METHOD2 – purge and autoremove (after each purge) – Y is hit automatically with -y option
If you are sick of hitting Y (becareful this will hit yes for you):
# for i in `dpkg -l | egrep “sql|apache|php” | awk ‘{print $2}’`; do echo REMOVEING $i; apt-get -y purge $i; apt-get -y autoremove; sleep 1; done;
At the end run:
# apt-get install -f
# apt-get clean
apt-get clean so that you can try and install it again
METHOD3 – just purge for each found package – need to hit Y to confirm every move
(THIS IS THE SAFEST ROUTE)
IF autoremove is trying to install everything back up again:
# for i in `dpkg -l | egrep “sql|apache|php” | awk ‘{print $2}’`; do echo REMOVEING $i; apt-get purge $i; sleep 1; done;
When thats finished run:
# apt-get autoremove
Also
# apt-get install -f
# apt-get clean
apt-get clean so that you can try and install it again
METHOD4 – just purge for each found package – Y is hit automatically with -y option
IF autoremove is trying to install everything back up again (auto hit Yes):
# for i in `dpkg -l | egrep “sql|apache|php” | awk ‘{print $2}’`; do echo REMOVEING $i; apt-get -y purge $i; sleep 1; done;
When thats finished run:
# apt-get autoremove
Also
# apt-get install -f
# apt-get clean
apt-get clean so that you can try and install it again
METHOD5 – just remove, no purge (I wouldnt run this as LAMP has many settings files) but for other software this might be useful
Remove removes the app but not settings and other stuff
# for i in `dpkg -l | egrep “sql|apache|php” | awk ‘{print $2}’`; do echo REMOVEING $i; apt-get -y remove $i; sleep 1; done;
When thats finished run:
# apt-get autoremove
Also
# apt-get install -f
# apt-get clean
apt-get clean so that you can try and install it again
TO INSTALL LAMP ON DEBIAN 7
############################
https://www.digitalocean.com/community/articles/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian
apt-get update
apt-get install apache2
apt-get install mysql-server
mysql_secure_installation
REMOVE TEST DB & ACCESS TO IT, AND RELAOD PRIVILEGES TABLE NOW
apt-get install php5 php-pear php5-mysql
service apache2 restart
TO INSTALL LAMP ON DEBIAN 6
###############################
https://www.digitalocean.com/community/articles/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian
apt-get update
apt-get install apache2
apt-get install mysql-server
mysql_secure_installation
REMOVE TEST DB & ACCESS TO IT, AND RELAOD PRIVILEGES TABLE NOW
apt-get install php5 php-pear php5-suhosin php5-mysql
service apache2 restart
INSTALL LAMP EASY ON DEBIAN
###########################
apt-get install apache2
apt-get install mysql-server
mysql_secure_installation
REMOVE TEST DB & ACCESS TO IT, AND RELAOD PRIVILEGES TABLE NOW
apt-get install php5 php-pear
apt-get install php5-mysql
service apache2 restart
TEST INSTALL
############
vi /var/www/info.php
PUT THIS CODE:
<?php
phpinfo();
?>
Then Save and Exit.
Then go to http://IPorHOSTNAME/info.php and you should see a PHP information page with lots of stats.
OTHER METHODS TO REMOVE LAMP
#############################
Scoping some forums i see these other methods:
http://askubuntu.com/questions/50101/how-do-i-remove-the-lamp-stack-so-i-can-start-over
NOTE: I dont like erasing or installing with apt-get huge lines of string, if you mess up a single prorgam or you dont have a certain program the whole command doesnt run, so instead run them one by one like I did
METHOD1
######
# sudo apt-get purge mysql-server apache2 php5
That will remove the “big-boy” packages, which should take care of most cases.
You can find this information in the documentation, specifically this section on how to start over:
To remove the LAMP stack remove the following packages:
Note: This assumes you have no other programs that require any of these packages. You might wish to simulate this removal first, and only remove the packages that don’t cause removal of something desired.
# sudo apt-get remove apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.0 mysql-common mysql-server mysql-server-5.0 php5-common php5-mysql
To also remove the debconf data, use the purge option when removing. To get rid of any configurations you may have made to apache, manually remove the /etc/apache2 directory once the packages have been removed.
Don’t use tasksel to remove packages, bad things can happen, this is covered in this bug report.
The rest of the documentation covers how you would reinstall apache and all the stuff you’ll need to get going again.
METHOD2
########
# sudo apt-get purge libapache2-mod-auth-mysql phpmyadmin
# sudo apt-get purge mysql-server mysql-server-5.1 mysql-server-core-5.1
# sudo apt-get purge apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common libapache2-mod-php5
# sudo apt-get autoremove
METHOD3
#######
# sudo apt-get purge apache2 php5-cli apache2-mpm-prefork apache2-utils apache2.2-common \
libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl \
libnet-daemon-perl libplrpc-perl libpq5 mysql-client mysql-common mysql-server \
php5-common php5-mysql phpmyadmin \
&& sudo apt-get autoremove