I am attempting to install LAMP server so I can work on PHP and MySQL databases locally on Ubuntu 16.04LTS.

I got through a lot of the installation and then decided I wanted to start again (see below as to why). How can I remove everything associated with LAMP server that I have just installed and start again?

I went through the following steps when installing:

sudo apt-get install tasksel

and then

sudo tasksel install lamp-server

Upon going though these steps it asked me for a mysql password, which I (probably shouldn't have) left blank.

I then installed phpmyadmin, again leaving the password blank for root.

After installation of phpmyadmin I then had to use

sudo gedit /etc/apache2/apache2.conf

And add this line:

Include /etc/phpmyadmin/apache.conf

Attempting to login to phpmyadmin threw up an error about removing the 'allownopasswords' or setting similar to that to allow me to enter with no pass.

At this point I decided to completely reinstall and use a password.

So I attempting to remove the packages I had used using some commands found here: How do I remove the LAMP stack so I can start over? & How do I remove the LAMP stack so I can start over?

I then reinstalled lamp-server, this time it showed no password entry and then I installed phpmyadmin.

Now when I goto localhost/phpmyadmin it just displays the config file, as if PHP is not installed.

I assume I am now missing some vital parts of the server.

I want to completely start afresh and install LAMP from scratch, how can I do this?

It would also be useful to know what the different passwords are for mySQL that it requests on installation, is it just 1 root user and password?


  • You can skip the "tasksel" part if you use sudo tasksel install lamp-server^ (the ^ makes it connect to the task)
    – Rinzwind
    Sep 2 '17 at 11:06
  • Thanks, but how can I remove everything already installed the first time and start again? Sep 2 '17 at 11:14
  • Related: How do I uninstall MySQL completely? Sep 2 '17 at 12:08
  • 1
    See that one ^ and re-install will not fix your issue ;-) I would ask about the problem you have and fix THAT. Learn from the problem.
    – Rinzwind
    Sep 2 '17 at 12:36
  • I am looking for an answer on how to remove everything I have just installed. Surely if I have installed lamp-server this is made up of various packages that I can remove, but how do I know what they are? This is a question I find myself asking myself a lot when installing and wanting to remove software in Ubuntu. Sep 2 '17 at 13:16

My preference is using apt/apt-get rather than tasksel.

Many times seems to fail for me + disallow simple customizations.

Destroying an entire LAMP Stack install can be a bit tricky.

You'll use apt-get purge $package to removed code + all config files.

Then use dpkg -l | grep $package to verify you've actually removed all traces of related packages.

Installing Apache-2.4.28 + PHP-5.6 covers how I install full lamp stacks for my hosting clients. Just change all occurrences of 5.6 to 7.1 to install latest PHP code.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.