Jan 14, 2013

Install apache, php, mysql in ubuntu 10.04

Follow the steps to install apache2, php5, mysql in ubuntu 10.04. For root user sudo is not required. For other distributions of debian/ubuntu some minor changes may be there. But the procedure is same.
I am user 'arun'. So change to your username at places where 'arun' is used. All my passwords are 'abcd' including 'root' user. References are there at the end of the page; R1, R2, etc...
Order is important. Refer the references for any errors.

  • apache2: 
    • sudo apt-get install apache2
    • open browser and goto http://localhost/ "It works!"
  • php5, its apache module and php5-cli( this is to run php scripts from terminal )
    • sudo apt-get install php5 libapache2-mod-php5 php5-cli
    • vim /var/www/index.php and write <?php phpinfo(); ?>
    • Must restart apache2 ( /etc/init.d/apache2 restart ). Then go to http://localhost/index.php
  • MySQL server: ( Refer R2 for any error )
    • sudo apt-get install mysql-server
      • While installing mysql server it will ask for a 'root' password. For this tutorial I gave a common password for all the users (abcd).
    • now the only user is root. For to create a user 'arun' first login to mysql as 'root' and then create a user 'arun' there.
      • mysql -u root -p (give password)
      • For any error like the one below refer R2. 
      • ERROR 1045 (28000): Access denied for user 'arun'@'localhost' (using password: YES)
    • mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('abcd');
    • create a user arun
      • mysql> GRANT ALL PRIVILEGES ON *.* TO 'arun'@'localhost' IDENTIFIED BY 'abcd' WITH GRANT OPTION;
    • mysql> \q (quits mysql)
    • At terminal check the user $mysql -u arun -p (give password)
  • install phpmyadmin (Refer R1 if facing any problem)
    • sudo apt-get install phpmyadmin
      • check http://localhost/phpmyadmin. If 404 do the following.
        • sudo vim /etc/apache2/apache2.conf
        • at the end of the file add Include /etc/phpmyadmin/apache.conf
        • restart apache ( sudo /etc/init.d/apache2 restart )
      • check http://localhost/phpmyadmin again login with username: arun, password: abcd.
References: 

For Web Developer

  open -a "Google Chrome" --args --disable-web-security