How to Install Apache2, Mysql5 and PHP5 on Debian Linux

Valic —  June 10, 2010 — 4 Comments

This guide will cover installing and updating Apache 2, MySQL 5 and PHP 5 on Debian Linux.

Step 1. To start with, its important to make sure apt-get is the latest version.

apt-get update && apt-get upgrade

* This line will update your aptitude to the latest version information and then upgrade the applications on your computer.

Step 2. Next, lets install Apache2.

apt-get install apache2

* This will install and provide basic configuration for apache2.
*  The default web directory will is /var/www and the Apache 2 configuration can be found in /etc/apache2/.

Step 3. Next, lets install PHP5 with MySQL5 (Database engine), Curl (HTTP tool):

apt-get install libapache2-mod-php5 php5-curl php5-gd php5-mysql

Step 4. Next, lets  install MySQL 5 server + the MySQL client.

apt-get install mysql-server mysql-client

* The configuration file can be found at /etc/mysql/my.cnf

Step 5. Now we need to add a Password to the ‘root’ MySQL user.

Deb:~# mysql -u root

mysql> UPDATE `mysql`.`user` SET Password = PASSWORD(‘my password’) WHERE user = ‘root’;
mysql> exit

* Remember your password, as you will use it to add MySQL users in PHPMyAdmin later

Step 6. install PHPMyAdmin.

apt-get install phpmyadmin

* This will automatically configure Apache2 for us.

Step 7. Restart apache.

/etc/init.d/apache2 restart

*  Now you will be able to log in to PHPMyAdmin:




Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

4 responses to How to Install Apache2, Mysql5 and PHP5 on Debian Linux

  1. hi
    thank you for your tutorial,but i have problem
    i have install my debian server in virtualbox and i have insatll apache2 and php and mysql and phpmyadmin in this server and restart apache2.
    my apache work fine when i test it with this link :
    but when i use this link :
    i cant see phpmyadmin i see error 404 “Not Found” where is my problem?

  2. first check in /etc/apache2/conf.d/ if phpmyadmin.conf exists.

Trackbacks and Pingbacks:

  1. How to Configure MySQL Replication on Debian | Linux Debian Tutorials - July 31, 2011

    […] you have phpMyAdmin ( you can use this tutorial )  installed on the slave you can now check if all tables/data from the master exampledb is also […]

  2. Install Suhosin PHP5 Security Protection on Debian Squeeze | Linux Debian Tutorials | Debian Squeeze Tutorials - January 3, 2012

    […] Debian Squeeze. I will also assume that you already have apache2 and php2 setup using this tutorial:How to install apache2, mysql5 and php5 on debian squeeze1. Install Suhosin on Debian Squeeze:Installation of suhosin on Debian Squeeze is simple.apt-get […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.