Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question

migrated from Oct 11 '10 at 17:54

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

This isn't a programming question. It might better be asked on Super User, or possibly on the Unix & Linux Stack Exchange site at 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

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.