Ubuntu – Unable to install LAMP server

Apache2lampsoftware installation

I can't seem to install LAMP server on my Ubuntu 14.10, I have tried the methods listed below:

sudo apt-get install apache2
sudo apt-get install lamp-server^
sudo apt-get install tasksel

All methods refused to work.

The following errors were encountered…

E: Unable to locate package lamp-server^
E: Couldn't find task 'lamp-server'
E: Couldn't find any package by regex 'lamp-server^'

Also

E: Package 'apache2' has no installation candidate

What can I do?

Best Answer

  1. Make sure you have a currently supported version OS. If your OS version is not currently supported, update your software sources by following the instructions in How to install software or upgrade from an old unsupported release? and then skip steps 2-6 since they don't apply in case you have an unsupported release.
  2. Search in the Dash for Software & Updates.
  3. Click the Software & Updates icon to open a new Software & Updates window.
  4. Select the first tab called Ubuntu Software.
  5. Under the Downloadable from the Internet heading put a check mark in the first four checkboxes in the list.
  6. Authenticate with your user password to apply any changes that you have made to the software sources and close the window.

Open the terminal and type:

sudo apt-get update
sudo apt-get install tasksel  
sudo tasksel  

A Package configuration window will open. Select a task by scrolling down or pressing the down arrow key ( ) and pressing space. This will put an asterisk beside the selected task and mark it for installation. Tasks that are already installed tasks are marked by an asterisk. If you make a mistake, press space again to unselect a selected task. From the Software selection list select LAMP server (LAMP server = Linux, Apache2, MySQL, PHP) and use the Tab key to select <Ok> and then press Enter as shown in the below screenshot:

enter image description here

You may need to wait a while for the packages in the selected task to finish installing.

Alternatively run the following commands to install LAMP server:

sudo apt install tasksel  
sudo tasksel install lamp-server  
Related Question