Apache is a free & widely used web server. To install it on your local system execute following command.
sudo apt-get -y install apache2
You might get following warning when starting apache web server.
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
Add following line to /etc/apache2/apache2.conf to slience the warning.
To test the installation enter http://localhost in addressbar of your browser and you should see the message It works!.
Visit Apache HTTP Server site.
PHP is one of the most easiest scripting language available for quickly writing backend code. Install php by executing following command.
sudo apt-get -y install php5 libapache2-mod-php5
By default you will not be able to save anything to /var/www. To make /var/www writable execute following command.
sudo chmod -R 755 /var/www/
To test php installation enter following snippet into /var/www/hello.php file and save it.
<?php phpinfo(); ?>
Open your browser and enter http://localhost/hello.php into address bar and you should be able to see the information about php version, environment settings and modules installed.
Visit PHP scripting language site.
MySQL is a popular open source database server commonly used along with LAMP stack. Execute following command to install it.
sudo apt-get -y install mysql-server
During installation you will be asked to set root user password of MySQL server. It's up to you whether you want to set a new password or leave it blank. Ont the side note linux root account and mysql root accounts are not related at all.
Visit MySQL database server site.
phpMyAdmin is the web interface to work with your database server. You can use phpMyAdmin to manage databases,tables. You can also export and import data into/from database. Execute following command to install phpMyAdmin program.
sudo apt-get -y install phpmyadmin
You can test phpMyAdmin installation by entering http://localhost/phpmyadmin into address bar of your browser.
Visit phpMyAdmin site.