How To Install LAMP (Linux, Apache, MySQL, PHP) On Debian 7
What is LAMP?
LAMP is a basic server installation of open source software that is also an acronym. The acronym stands for: Linux, Apache, MySQL and PHP.
The server you install this on needs to be Debian 7. This tutorial was tested and successfully completed on VPS with Debian 7.
Step one: Update
To start, the first thing I always do is update the VPS repositories.
Great, we are ready to start installing the LAMP server on Debian 7.
Step two: Install Apache
Apache is free web server software that is very commonly used.
To install apache, all you are going to do is open terminal and run:
apt-get install apache2
And its installed! Perfect, now we are going to move onto step 3 of the LAMP install.
Step three: Install MySQL
MySQL is a advanced database system that is used to send and retrieve data. It is very commonly used on servers around the world.
To install MySQL, start off by executing the command in terminal:
apt-get install mysql-server
During this install, you will be asked to set the root password for MySQL. Set it now so you don’t have to set it later. If you miss the chance to set it, it is not a big deal. You will get another chance to set it later.
To finish the install we need to run the MySQL set up script:
It will then ask for your current root password. Type that in. It will then ask you if you would like to change your mysql root password. Since we set it earlier, there is no need to reset it. If you didn’t get to set it earlier, now is your second chance.
It will then proceed to ask you four questions. On each question it asks, just hit enter. Below is what is should look like:
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] ... Success! Cleaning up...
Once you have completed that, MySQL is fully setup and good to go! Next we install PHP to complete the LAMP install.
Step four: Install PHP
PHP is a extremely common web scripting language. Just like apache, PHP is open source.
To install PHP, run this command:
apt-get install php5 php5-mysql
After running that command, all you need to do is answer ‘Yes’ twice to install. Congratulations! You have installed the full LAMP stack on your Debian 7 server.