Installing a Secure LAMP Server in 5 Steps

sudo apt-get install apache2
LAMP’s central software package is Apache, the open-source web server. Although originally designed to run on Unix based machines, webmasters can now install Apache on Windows easily through an XAMPP based installation. In fact, most of the steps in this tutorial can be ignored by choosing to install XAMPP.
sudo apt-get install php5 libapache2-mod-php5 sudo /etc/init.d/apache2 restart
The PHP scripting language will allow webmasters to create any run almost all of the popular web publishing platforms: WordPress, Drupal and MovableType all use PHP on the backend. With hundreds of inbuilt functions, such as file system and socket management, PHP can handle most any web app with ease – from the most basic TODO list app to the largest user-submitted encyclopedia in the world.
sudo apt-get install mysql-server
gksudo gedit /etc/mysql/my.cnf
bind-address = 127.0.0.1 <-- change to IP address
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
gksudo gedit /etc/php5/apache2/php.ini
extension=mysql.so <-- uncomment (remove semicolon)
Now it’s time to install a RDMS system called MySQL. It’s a server-based database program that can hold information on your webserver, such as blog posts, forums, web stats and large amounts of textual data. After proper configuration, MySQL can scale well enough that some of the most popular websites in the world deploy it: FaceBook, Google and Wikipedia are just a few of the sites that use MySQL to power portions of their web empires.
Two requirements are needed for a basic installation. Upon configuration, MySQL must know which IP address to bind with and a root password needs to be set. After that a single line in php.ini must be changed in order for PHP to load the MySQL extenstion upon loading.
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
Fourth on the list is to install various tools and Apache mods. This includes MySQL authentication and the MySQL mod that will allow communication between MySQL and PHP5. Another tool is the web-based phpMyAdmin database app, which can be used to administrate MySQL through any popular browser. All of the command-line statements can be issued with phpMyAdmin, and many of those are simplified through use of a GUI.
sudo /etc/init.d/apache2 restart
The final step is to simply restart Apache. After loading, Apache should be able to process and serve PHP scripts that communicate with MySQL (such as WordPress and Drupal) and will load when Linux boots. Any errors encountered during this last step can be debugged and fixed by looking through the log files (usually in /var/log/apache2) and by double-checking one of the configuration files.

You!