A LAMP stack is a synonym of LAMP server or LAMP web server. It refers to a set-up which includes Linux, Apache, MySQL (MariaDB) and PHP.
We will be using our SSD 1 Linux VPS hosting plan for this tutorial.
UPDATE THE SYSTEM
Make sure your server is fully up to date using:
# apt-get update && apt-get upgrade
To install Apache on your Debian 8 server, you need to execute the following command:
# apt-get install apache2
After the installation is complete, you should enable Apache to start on boot:
# systemctl enable apache2
Verify that Apache is running by opening a web browser and visiting your server IP address (http://server_ip). You should get the Apache welcome page like the one below:
Now let’s install MySQL. Issue the following:
# apt-get install mysql-server mysql-client
During the installation, you will be asked to enter a password for the MySQL root user. Do not enter an easy to crack password. It should contain at least 8 characters mixed with upper and down cases.
Now that MySQL is installed, we recommend you to do the MySQL secure installation by running:
Enter your root password and answer with ‘n’ when you are asked to change your MySQL root password. Below is the entire procedure that you can follow:
Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] n ... skipping. 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] y ... 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] y ... 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] y - 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] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
Enable MySQL to start on boot:
# systemctl enable mysql
You can check the status of your MySQL service by running:
# systemctl status mysql
Install PHP by running the underneath command:
# apt-get install php5 php5-mysql libapache2-mod-php5
Now, let’s make a simple PHP page test. Create a PHP info page so you can check your PHP version, modules activated etc…
Create a file, let’s call it info.php into the /var/www/html directory:
# vim /var/www/html/info.php
Paste the following into the file:
<?php phpinfo(); ?>
Restart Apache for the changes to take effect:
# systemctl restart apache2
Now, open your favorite web browser and navigate to http://your_server_ip_address/info.php . You will be welcomed by a web page similar to the one below:
Additionaly, you should install phpMyAdmin so you can administer your databases easier via the phpMyAdmin intuitive GUI.
Enter the following command:
# apt-get install phpmyadmin
During the installation procedure you will be prompted with several windows for configuring phpMyAdmin. You should select ‘Yes‘ when you get to the ‘Configure database for phpMyAdmin with dbconfig-common’ step after which a database will be installed and configured for phpMyAdmin.
Then, enter your MySQL root password as the ‘Password of the database’s administrative user’. Next, enter a password of your choice for the ‘MySQL application password for phpmyadmin’.
After this is finished, you will be prompted with a window where you can select a web server to be configured to run phpMyAdmin. Select apache2 and then select ok.
Once the installation is completed, you will be able to access phpMyAdmin by navigating your web browser to: http://your_server_ip_address/phpmyadmin. You will be welcomed by the underneath page:
You can log in using root as username and the password you have setup during the MySQL installation.
That’s it. You have successfully installed LAMP and phpMyAdmin on your Debian 8 VPS.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install the LAMP stack for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.