How To Install LAMP (Linux, Apache, MySQL, PHP) on Debian 6

noah Uncategorized 0 Comments

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.

Since the server comes with Debian 6 installed, all we need to pay attention to is Apache, MySQL and PHP.

Requirements
The server you install this on needs to be Debian 6. This tutorial was tested and successfully completed on VPS with Debian 6.

Step one: Update
To start, the first thing I always do is update the VPS repositories.

apt-get update

Great, we are ready to start installing the LAMP server on Debian.

Step two: Install Apache
Apache is free webserver software that is very commonly used.

To install apache, run the command:

apt-get install apache2

It’s as simple as that! Time to move onto step three in the LAMP setup.

NOTE: If it doesn’t go through and it asks you to insert a CD, please click here to fix this.

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, simply run:

apt-get install mysql-server

MySQL will now install. Next we will set up and configure MySQL. Once finished installing, run:

mysql_secure_installation

That will run the set up script. During that process it will ask you for your root password. Type it in then hit enter to submit.

It will also ask you if you would like to change your root password. This part is up to you. The next four questions we can just hit enter for. Below is what it 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…
ERROR 1008 (HY000) at line 1: Can’t drop database ‘test’; database doesn’t exist
… Failed! Not critical, keep moving…
– 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…

Perfect! The next part in the LAMP set up is PHP.

Step four: Install PHP
PHP is a extremely common web scripting language. Just like apache, PHP is open source.

Lets install PHP. Run the command:

apt-get install php5

PHP will now install. Now we’re done! You have successfully installed the LAMP stack on your Debian server!

Leave a Reply