Already have Ubuntu open? In Pplware we already offer several articles that teach how to turn a Linux machine into a LAMP server (Linux + Apache + MySQL + PHP). Basically a LAMP is a set of services about Linux, which allow us to create a real Web server (Apache2 – to put content online such as websites, platforms such as WordPress, Joomla, wikis, etc.) with support for the PHP programming language and for the MySQL database service.
In one of the last tutorials we taught you how to install Apache. Today we will install MySQL and PHP.
After we install and configure Apache, we will now move on to the mySQL database management system and also to PHP.
Install and configure mySQL on Ubuntu
MySQL is most likely the most widely used database management system (DBMS) in the world and is available in various versions and for different operating systems. All that are open source platforms such as WordPress, Joomla or Drupal, use MySQL as a database.
To install MySQL in Ubuntu and derivatives must open the terminal and enter the following command
sudo apt install mysql-server
They should then run sudo command mysql_secure_installation which will set security parameters in the database management system. Choose a mySQL access password, remove users and test databases, etc.
We will now install PHP on Ubuntu and support for Apache and MySQL. Like installing Apache and MySQL, we will also use a command for php installation. To do this, simply execute the following command on the terminal:
sudo apt install php libapache2-mod-php php-mysql
And it’s done! We have the server ready and to see if everything is okay we can create a page (in /var/www/html) with the following code. Then just record as the name, for example, info.php.
If everything is operational you should see a page identical to the one shown in the following image.
That’s all for today! In a next tutorial we will teach you how to have multiple sites on a single server and with custom names. Keep your eyes open! If you have any suggestions for tutorials in Ubuntu leave in the comments.