how to install Apache, PHP, MySQL and phpMyAdmin on Ubuntu


[o] Installing Apache

open console and execute this command

$ sudo apt-get install apache2

when its complete you can check if the Apache is working properly by open this address in your browser to "http://localhost".
if you see the text “It works!”, it means your Apache is working good.
in the end of the installation if you see a message like this
“Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName“.
you can fix that by executing the following command.

$ gksu gedit /etc/apache2/conf.d/fqdn

when Gedit opens, type “ServerName localhost” inside the file and click Save then close it.
or your can create fqdn file, edit and copy it into /etc/apache2/conf.d/


[o] Installing php5

execute the following command on your console

$ sudo apt-get install php5 libapache2-mod-php5

after it complete, you have to restart Apache so that php5 will work on Apache.
run this following command in console to restart Apache

$ sudo /etc/init.d/apache2 restart

now you can test to see if php5 works with Apache. To do this you can create a new php file inside your /var/www/ folder.

$ sudo gedit /var/www/phpinfo.php

the command above will open Gedit. Just type in the following php code, save and close the file:



open this in your browser "http://localhost/phpinfo.php"
and if you can see the phpinfo() and information about your php5 installation it means your have successfully installed php5.


[o] Installing MySQL

execute the following command in console

$ sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

at the end of the installation you will be prompted to set your root or admin password



set and confirm your root password for mysql


[o] Installing phpMyAdmin

execute the following command in your console

$ sudo apt-get install phpmyadmin

during the installation you will be asked to select the webserver that would be used to run phpMyAdmin. Select Apache2



after the installation is over execute the following command to copy the phpmyadmin folder into the /var/www/ directory.
by default it is installed in /usr/share/phpmyadmin/ directory.

$ sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin

now go to the phpMyAdmin login page by open this in your browser "http://localhost/phpmyadmin/index.php"
the username for MySQL and phpMyAdmin is “root”. the password will be what you set in Installing MySQL.



./NoGe

One Response so far.

  1. Anonymous says:

    Makasih buat tutorialnya ni bro...
    G sengaja nemu blog ini dari IRC.

    Add FB ane dong bro, If U don't mind...

    http://www.facebook.com/MuseKrenZ