Ubuntu’s latest versions is just right in the corner, if you want to take your steps in this distribution and start developing your websites you will need the help of LAMP, Linux Apache MySQL and PHP, here you will find the resources to install and have everything needed for your local website.
This tutorial is the complement of the first steps in our series of tutorials – Start your website with PHP & MySQL. You’ll need to have this services install on your PC to start programing and keep on with the chapters.
As a requirement you should have Ubuntu 16.04 or above. We’ll update the repositories with the following commands:
apt-get update apt-get upgrade
First step install Apache, who takes care of the web server function and allows to interpret HTML pages, it’s the base for the rest of components.
apt-get install apache2
To check if it’s correctly installed you should access to you localhost address:
You can also view it from another device inside your network, just typing your IP Address, if you don’t know it you can have it with the following command:
You’ll find it next to inet addr:
With out a doubt the most popular database management system is MySQL, in other distributions they have stocket MariaDB an MySQL fork. But that’s another subject. With MySQL you can create databases and connect them easily with your websites. Remember the place where you store your information is almost one of the most valuable software, you may install MySQL with the following line:
sudo apt-get install mysql-server php-mysql
During installation you will be prompted to enter the password for the user “root” this is the most important user , it’s the administrator of the entire system so it is important that you set up a good and easy password for you to remember.
Important: to make more secure your MySQL you should follow this steps.
Once the web server and the manager of the database have already installed, we install the programming language, PHP.
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
To test the installation of all components we’ll make a PHP test file, where we show our system information, create a file called info.php
In the body of the file and add the following code:
<?php phpinfo(); ?>
Once you have installed all components restart the Apache service:
service apache2 restart
Let’s try the file you just created information:
If all went well we see the next page with information on our installation and configuration:
Congratulations! You have just configured your web server!