How To Setup LAMP Server On Ubuntu / Linux Mint
One of the earlier posts showed how to setup XAMPP on Linux Mint/Ubuntu system.
This is great for setting a test web setup but instead of relying on a single XAMPP package, each of the individual components can also be installed separately namely Apache, MySQL and PHP.
This is especially applicable when building an Ubuntu server as a LAMP (Linux, Apache, MySQL, PHP) setup to host websites or web apps.
To setup a LAMP stack on Ubuntu / Linux Mint system :
1. First make sure to get the latest updates for the system by opening Terminal and typing :
[cc lang=”bash”]
sudo apt-get update
[/cc]
2. Next, it is time to setup Apache web server :
[cc lang=”bash”]
sudo apt-get install apache2
[/cc]
3. For setting up MySQL database services :
[cc lang=”bash”]
sudo apt-get install mysql-server
[/cc]
Follow the on-screen instructions and enter a root password during MySQL installation. Then to enable PHP support for MySQL:
[cc lang=”bash”]
sudo apt-get install php5-mysql
[/cc]
4. Finally for setting up PHP :
[cc lang=”bash”]
sudo apt-get install php5 php-pear
[/cc]
At this point, the LAMP server is setup. Simply reload the Apache web server by typing :
[cc lang = “bash”]
sudo service apache2 reload
[/cc]
Enter http://localhost in browser, the following page should come up indicating web server is running :
Now, to validate that PHP is setup correctly and LAMP server is working as expected, go to the default web server directory (/var/www) and create a file named info.php
[cc lang=”bash”]
sudo nano /var/www/info.php
[/cc]
In it, enter the following PHP code and save the file :
Now, access this by typing http://localhost/info.php
This will load the PHP info page displaying the configuration settings and also basically validating that PHP is now being served correctly by the Apache webserver.
All done.
Happy installing!


