LAMP is the Linux, Apache, MySQL, PHP/Perl/Python stack.

Apache 2

Apache is the most popular web server and I use it for my development work. Apache 2 can be installed by running this command in the terminal.

sudo apt-get install apache2

All your files should be placed in the /var/www/ folder to be viewed from your server.

PHP5

PHP is on version 5 and can be installed by running

sudo apt-get install php5 sudo apt-get install libapache2-mod-php5 sudo /etc/init.d/apache2 restart

You can easily test whether you have correctly installed PHP by writing a simple test file.

gksudo gedit /var/www/testphp.php

This will open a text editor and here insert this line. There should be no space between < and ?. Wordpress inserts a space in between. < ?php phpinfo(); ?>

Point your browser to http://localhost/testphp.php

MySQL Server

Next install MySQL server

sudo apt-get install mysql-server

MySQL by default allows connections only from 127.0.0.1 i.e., only from your own computer. This is ok if you are developing only on your own system. If you want to access your MySQL server from a network,

gksudo gedit /etc/mysql/my.cnf

Find the line bind-address = 127.0.0.1 and comment it. Comments start with ;(semicolon).

If you want to set a different password to your MySQL server (than the default none),

mysqladmin -u root password your-new-password mysqladmin -h root@local-machine-name -u root -p password your-new-password sudo /etc/init.d/mysql restart

Install MySQL for Apache

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

After this, you have to enable the MySQL extension in your php.ini. Edit the file

gksudo gedit /etc/php5/apache2/php.ini

Here uncomment the line “;extension=mysql.so

extension=mysql.so

After this restart Apache 2

sudo /etc/init.d/apache2 restart

Python Python for Apache can be installed by installing the libapache2-mod-python package.

sudo aptitude install python sudo aptitude install libapache2-mod-python

For more help, ask us at Newbies Linux Forum