What’s LAMP stack?
A LAMP stack is a set of open supply software program (Linux, Apache, MySQL, PHP), also referred to as a Internet Stack, put in on a server to allow it to host dynamic web sites.
This information will present you how you can get a LAMP stack put in on an Ubuntu 16.04 server.
Earlier than You Start
Replace your system by operating the next command:
sudo apt-get replace && sudo apt-get improve
The primary command will replace the bundle checklist from the repositories and the second command will set up the most recent variations of all packages at the moment put in on the system. These two instructions are mixed with ‘&&’.
You can be proven an inventory of packages that will probably be upgraded. Sort y and press enter to proceed.
Step 1: Set up Apache
Apache is an open supply multi-platform internet server. It’s properly documented, and has been the most well-liked internet server on the Web since 1996.
Run the next command in your terminal to put in Apache:
sudo apt-get set up apache2
You can be proven an inventory of packages that will probably be put in together with the area wanted for them. Sort y and press enter to proceed.
Now open up your internet browser and navigate to the server’s public IP deal with.
Should you don’t know your IP deal with, run the next command:
Tip: You can too discover your server’s public IP deal with simply on the CloudCone management panel.
Should you see the default Apache2 internet web page as proven under, then the online server is accurately put in and may be accessed by means of the web.
Step 2: Set up MySQL
MySQL is an open supply relational database administration system (RDBMS) based mostly on Structured Question Language (SQL) that runs as a server offering multi-user entry to databases.
Run the next command to put in MySQL:
sudo apt-get set up mysql-server
Once more, you can be proven the checklist of packages that will probably be put in and the disk area wanted. Sort y and press enter to proceed.
You can be requested to enter a password for the MySQL ‘root’ consumer. Sort a safe password after which verify it once more on the following display screen. It’s not advisable to depart this password clean.
As soon as the set up is full, run the next command to safe the MySQL set up:
Enter the MySQL root password which you set earlier to proceed.
You can be requested whether or not you need to setup the VALIDATE PASSWORD plugin. Whereas enabling this perform will make your set up safer, it might probably trigger issues with with software program which routinely configures MySQL consumer credentials with weak passwords, such because the Ubuntu packages for phpMyAdmin. It’s completely protected to not allow this characteristic so long as you be certain that to make use of robust passwords for MySQL. Sort y and press enter to allow it, or every other key to proceed with out enabling.
Subsequent, you can be requested whether or not you need to change the password for ‘root’. Press y and hit enter to vary it, or every other key to proceed with out altering for those who’re pleased with the present password.
For remaining questions, kind y and press enter at every immediate.
Step 3: Set up PHP
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open supply general-purpose scripting language that’s particularly fitted to internet growth and may be embedded into HTML.
Run the next command to put in PHP together with some further packages for integration with Apache and MySQL:
sudo apt-get set up php libapache2-mod-php php-mcrypt php-mysql
Sort y and press enter at immediate once you’re proven the checklist of packages that will probably be put in and PHP ought to be put in in your server with none points.
Check PHP Processing
You may create a primary PHP file to make sure it’s put in correctly on the server. Run the next command to create the file:
sudo nano /var/www/html/information.php
This may create a clean file with the title ‘information.php’ on Apache’s default internet root listing.
Sort the next PHP code in it:
<?php phpinfo(); ?>
Now save and shut the file.
Tip: Press Ctrl + O and hit Enter to save lots of the file, and Ctrl + X to exit the editor.
To check whether or not the server can accurately course of the PHP file, merely go to this web page in your browser by navigating to:
It’s best to see a web page just like the next with some details about your server generated by PHP.
Be certain that to take away the file we created by operating the next command:
sudo rm /var/www/html/information.php
That’s it! Now we have efficiently put in a LAMP stack on an Ubuntu server. It’s best to be capable of host and serve a dynamic web site in your server by means of the Web.
You may You may proceed to put in and configure extra options in your server. Some common choices are:
- Create digital hosts on Apache to host a number of web sites.
- Set up phpMyAdmin to handle your MySQL database from an internet browser.
- Set up Let’s Encrypt to safe your web site with free SSL certificates.
- Set up an FTP consumer to switch recordsdata to and out of your server.