Table of Contents
Installing Apache 2.2, PHP 5.2 and MySQL 5.0
Adding the Dotdeb repository
We're going to add the Dotdeb repository, which will provide the latest versions of Apache, PHP & MySQL for Debian. To do so, we need to modify the sources.list file by running the following command
nano /etc/apt/sources.list
If you get a command not found error, you first need to install the nano editor by running the following command
sudo apt-get install nano
Once you have sources.list file open, add the two following lines
deb http://packages.dotdeb.org stable all deb-src http://packages.dotdeb.org stable all
Now let's update the packet database to add those of Dotdeb. The version of Dotdeb packets being always superior to those of Debian, the Dotdeb versions will be automatically selected during the installation of Apache, PHP and MySQL.
Installing Apache2 & PHP 5
After having added the Dotdeb repository, we can move on to installing Apache and PHP:
apt-get install apache2 php5 php5-mysql
The installations doesn't normally require any intervention on your behalf. Once this is finished, put in your server's address in your web browser: you should see a message saying “It works!”, which means that Apache is working properly. Now let's test PHP by entering the following command:
echo "<?php phpinfo(); ?>" > /var/www/phpinfo.php
Then go to http://your_servers_ip/phpinfo.php: if PHP is working properly, you should see a page with the details of the configuration. If this isn't the case (for instance, if the server just sends the file with raw content: ”<?php phpinfo(); ?>”), you need to restart Apache:
apache2ctl restart
…and try the URL again.
The Dotdeb version of PHP5 is compiled with the Suhosin patch. It allows, after having installed the php5-suhosin packet, to define numerous parameters related to PHP's security. More info on the project website's documentation.
Installing MySQL
Installing MySQL is also very simple, since all you need to do is enter this command:
apt-get install mysql-server-5.0
Then you're asked to enter a password for the “root” account: you're advised to choose a sufficiently complex password with numbers, letters and special characters.
Installing a LAMP server: Give it a go!
Gandi.net provides flexible and dedicated webhosting resources that you can use to host as many domain names/websites as you wish. Our service is without any minimum contractual period and you can create a powerful server in just 10 minutes beginning at just $14 per month. For more on this, go to our hosting page at http://www.gandi.net/hosting/