0

This question already has an answer here:

I want to install the whole package of apache2, MySQL, PHP and phpmyadmin at a time on my ubuntu 14.04. I want to install the package from terminal. How to do it?

marked as duplicate by David Foerster, Eric Carvalho, WinEunuuchs2Unix, Zanna, muru Dec 23 '16 at 5:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

You can accomplish this by simply typing two commands.

  • sudo apt-get install lamp-server^
  • sudo apt-get install phpmyadmin

The first one will install apache, php, and mysql all at once. including all dependencies needed for phpmyadmin, and other web-apps. Then the 2nd will install & integrate phpmyadmin.

You will be prompted by both for setting up mysql credentials & giving such credentials for phpmyadmin.

  • Thank you. It is easier. But I installed taskel first. As I didn't get this answer then. – Mostafiz Ur Rahman Dec 29 '16 at 11:07
1

Let me try and give you a good brief run down on how you can do this. Before starting do a system update:

sudo apt update && sudo apt dist-upgrade or

sudo apt-get update && sudo apt-get dist-upgrade

LAMP:

  1. Linux:
    • installation of Ubuntu
  2. Apache:
    • from the terminal run sudo apt-get install apache2 or sudo apt install apache2 if you installed Ubuntu 16.04 or higher.
    • to confirm apache is up and running:
      • open your browser of choice and go to this address in the address bar: localhost/ and if it's installed you should see the image below

enter image description here

  1. Mysql:
    • From the terminal run sudo apt-get install mysql-server or sudo apt install mysql-server if you installed Ubuntu 16.04 or higher
    • Follow the terminal instruction to add a password
    • Secure the installation by running this after the complete install:
      • sudo mysql_secure_installation
  2. php:
    • Install withsudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
      • libapache2-mod-php allows apache parse php files
    • Run this sudo systemctl restart apache2 to restart apache so its incorporates php parsing functionality, then check if its running with the next step
    • sudo systemctl status apache2, you should see the image below if its running

enter image description here

  • Now php has many more modules that you can install. To see these by running this in the terminal sudo apt-cache search php7 or sudo apt search php7

    1. phpmyadmin:
      • this can be installed with:
      • sudo apt install phpmyadmin or sudo apt-get install phpmyadmin. This will install the official package, but if this doesn't work get it from here.
      • extract and drop it in /var/www/html. Change the folder name to _phpmyadmin__ and access it from the browser like this localhost/phpmyadmin

Now lets test your apache to see its working:

  • from terminal run: sudo vim /var/www/html/info.php, and put this in that file, or use nano if you prefer!

    <?php echo phpinfo(); ?>

Open a browser and put this [localhost/info.php] into your address bar and should see something like this:

enter image description here

Note: You can tweak your apache, mysql and php to suite your needs. This by no means all there is to setting up LAMP stack on your Ubuntu but its a start.

Source: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04

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