There are a variety of options you have to customize your Cloud VPS. The most popular combination of software used for web servers is commonly know as the LAMP Stack. LAMP is actually an acronym consisting of the following softwares (intended to run the web server): Linux, Apache, MySQL, and PHP.
Since Debian is already installed, the L portion (Linux) of the LAMP Stack is already installed. In this guide, you can learn how to install Apache, MySQL, and PHP on Debian, to create a LAMP Stack on Debian.
Before You Begin
IMPORTANT: The following guide does not include instructions for installing the Debian OS. If you are currently running an alternative OS on a Cloud VPS, then you can easily re-OS your VPS using the tool located in your Account Management Panel (AMP). For instructions to complete a re-OS, please refer to our guide “How to Re-OS Your Cloud VPS in AMP“.
IMPORTANT: Root access to a Cloud VPS (running Debian) is required in order to complete the steps in this guide.
NOTE: It is imperative that your Debian Linux distribution is up-to-date. Follow the steps in this section to perform an update prior to installing the additional software outlined in the following sections.
- SSH into your server as the root user.
- Run the following command:apt-get update && apt-get upgrade
- You will be prompted to install the packages found, simply, type ‘y‘ and then hit Enter.
That’s it! Just wait for the command prompt to return, indicating that the updates were completed. Now, you are prepared with the latest Debian version to begin installing the software described in the following sections.
Install Apache
Apache is the HTTP daemon (application) that handles serving the website(s) you create. For more information about Apache, you can review the documentation.
Similar to how you would install Apache on other Linux distros, you can simply run a command to accomplish this. In this section, you can learn the command used to install Apache on Debian.
- SSH into your server as the root user.
- Run the following command:apt-get install apache2 apache2-doc
- You will be prompted to install the packages found, simply, type ‘y‘ and then hit Enter.
Install MySQL
MySQL is the database management system that most websites (like WordPress, Drupal, Joomla!) require for advanced functionalies. For more information about MySQL, you can review the Dev.MySQL.com documentation.
MySQL is installed in the same manner as Apache. Simply run the command specific to Debian. In this section, you can learn the process to install MySQL on Debian.
- SSH into your server as the root user.
- Run the following command:apt-get install mysql-server php5-mysql
- You will be prompted to install the packages found, simply, type ‘y‘ and then hit Enter.
IMPORTANT: During the installation of MySQL, you will be prompted to change the MySQL root user password. This is a separate root user that is strictly used for MySQL. It is strongly recommended that you reset the default MySQL root password during the installation and to use a secure password!
IMPORTANT: In order to securely setup MySQL, you should run the interactive script (as root) by following the steps below.
- Run the following command:mysql_secure_installation
- When prompted Change the root password? [Y/n], type ‘n‘ and then hit Enter, to skip this since the password was already reset during installation.
- When prompted Remove anonymous users? [Y/n], type ‘y‘ and then hit Enter.
- When prompted Disallow root login remotely? [Y/n], type ‘y‘ and hit Enter, unless your applications require remote login by the MySQL root user.
- When prompted Remove test database and access to it? [Y/n], type ‘y‘ and hit Enter.
- When prompted Reload privilege tables now? [Y/n], type ‘y‘ and hit Enter.
Upon successful configuration, the script will display the following message:
All done! If you have completed all of the above steps, your MySQL installation should now be secure.
Install PHP
PHP is one of the scripting languages that can be used by Apache to run the scripts that render your website(s). For more information about PHP, you can review official PHP.net documentation.
PHP is simply installed using a specific (to the OS) command. In this section, you can learn the command used to install PHP on Debian.
- SSH into your server as the root user.
- Run the following command to run the installation script for PHP:apt-get install php5-common libapache2-mod-php5 php5-cli
- You will be prompted to install the packages found, simply, type ‘y‘ and then hit Enter.
- Once the installation completes, you should restart Apache, for the PHP configuration to be included immediately. To do this, run the following command:service apache2 restart
Congratulations! If you have followed this entire guide, then you have just installed the necessary applications to complete a LAMP Stack. Now, it is recommended that you test each application, to ensure full functionality of your LAMP Stack.
Learn more from our Cloud Server Hosting Product Guide.
Experience full control over your server environment and deploy the best operating and management systems that fit your needs with our reliable Cloud VPS Hosting!