Jump to content


Installing Apache, Php5, Mysql, and Phpmyadmin

Lamp Apache mysql php5 phpmyadmin install lamp install apache2 install mysql install php5 install phpmyadmin

  • Please log in to reply
No replies to this topic

#1 brent



  • Administrators
  • 65 posts

Posted 17 February 2013 - 05:20 PM

This guide is divided into 3 steps: installing/tesing Apache, PHP and finally MySQL.

Lets start with Apache:
1. Open the terminal (we will be using it through most of my guide) from Applications > Accessories > Terminal
2. Install apache2 using apt-get by typing the following

sudo apt-get install apache2



Now everything should be downloaded and installed automatically.
To start/stop/restart apache2 write:

sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 restart



Your www folder should be in: /var/www/ which is the main directory of your website.
If everything is OK you should see an ordinary HTML page when you type: http://localhost in your firefox browser

Installation of PHP5

sudo apt-get install php5 libapache2-mod-php5




Now we need to restart apache2.

sudo /etc/init.d/apache2 restart



Lets do a quick test of php by making a simple file

sudo nano /etc/var/www/index.php





place this in the file  

< ?php echo “Hello World”; ?>

Now run it by typing http://localhost/index.php in firefox… You should see your ” Hello World ”




Installation of MYSQL

sudo apt-get install mysql-server

Now we want to secure our MySql installation,

sudo mysql_secure_installation 


(optional) If you are running a server you should probably bind your address by editing bind-address in /etc/mysql/my.cnf and replacing its value ( by your IP address

 set your root password (although mysql should ask you about that when installing)
mysql> SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(‘xxxxxx’);

 Try running it
mysql -uroot -pxxx

where xxx is your password.


Installation of phpmyadmin

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin


Now we need to restart apache2

sudo /etc/init.d/apache2 restart



After you restart apache you will get an error saying unable to determine FQDN fully qualified domain name. Here is how to fix this Open,

sudo nano /etc/apache2/httpd.conf



and add this

ServerName localhost



save close and restart apache2 with

sudo /etc/init.d/apache2 restart



You have setup and installed lamp manually.

Also tagged with one or more of these keywords: Lamp, Apache, mysql, php5, phpmyadmin, install lamp, install apache2, install mysql, install php5, install phpmyadmin

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users