I want to reinstall the whole LAMP server under Debian Lenny. This means, using 'apt-get remove' is not enough, I want to remove completely all components, and start again.

I tried but files are always there so I can't make a new configuration for everything. What can I do?


migrated from stackoverflow.com Oct 11 '10 at 17:54

This question came from our site for professional and enthusiast programmers.

  • 1
    This isn't a programming question. It might better be asked on Super User, or possibly on the Unix & Linux Stack Exchange site at unix.stackexchange.com which is currently in open beta. – David Thornley Oct 11 '10 at 17:40

1 su aptitude purge 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

2 apt-get update

3 apt-get upgrade --> opt

4 apt-get install apache2 php5 libapache2-mod-php5

5 vim /var/www/apache2-default/test.php then copy the below code into the test.php

6 apt-get install mysql-server mysql-client php5-mysql

7 mysql -u root mysql> USE mysql; mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root'; mysql> FLUSH PRIVILEGES;

8 apt-get install phpmyadmin 9 vim /etc/phpmyadmin copy below line Include /etc/phpmyadmin/apache.conf 10 /etc/init.d/apache2 restart


apt-get reinstall apache2 php5 libapache2-mod-php5 mysql-server mysql-client php5-mysql phpmyadmin


If you just want to do the configuration over again, you can use dpkg-reconfigure [packagename] to re-run the initial setup scripts.

To completely start over, you'll need to purge all of the previous packages. I am not sure that purging Debian's mysql packages will delete the database data itself though, you may need to remove the folder with the mysql database files manually after purging the packages if you don't want to keep the data.

sandeep's "or" command should read apt-get install --reinstall ... but even then it won't do what you want since the --reinstall option will "upgrade" from the existing configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy