How to install LAMP(Apache, PHP, MySQL) on ubuntu

    We can install these things simply using few commands on terminal. Follow these steps
    1. Login with root user and open terminal
    root@ubuntu:/ apt-get install mysql-server mysql-client

    Enter root mysql password two times

    2. Next to install apache2

    root@ubuntu:/ apt-get install apache2

    After installation verify if your sever working correctly visit http://127.0.0.1/ in browser

    3. Next to install PHP

    root@ubuntu:/  apt-get install php5 libapache2-mod-php5

    4. After installation restart apache2

    root@ubuntu:/  /etc/init.d/apache2 restart

    5. Go to server root and check php is working fine

    root@ubuntu:/var/www# vi test.php
    type following code
    <?php
    print phpinfo();
    ?>

    :wq
    root@ubuntu:/var/www#

    Go to address http://127.0.0.1/test.php Check the output its fine done php is installed correctly

    6. Integrating mysql with PHP

    root@ubuntu:/var/www#apt-get install php5-mysql

    Note: You can install other extensions like php5-mysql to check the available extensions
    root@ubuntu:/var/www# apt-cache search php5

    7. Restart apache2 again

    root@ubuntu:/var/www# /etc/init.d/apache2 restart

    8. Install phpmyadmin

    root@ubuntu:/var/www# apt-get install phpmyadmin
    5
    Average: 5 (1 vote)