LAMP is short for Linux, Apache, MySQL, PHP. This tutorial shows how you can install an Apache web server on an Ubuntu 16.04 LTS (Xenial Xerus) server with PHP 7 (mod_php) and MySQL / MariaDB support and how to setup an SSL certificate with Let's encrypt. Additionally, I will install PHPMyAdmin to make MySQL administration easier. A LAMP setup is a perfect basis for CMS systems like Joomla, Wordpress or Drupal. Preliminary Note
In this tutorial, I will use the hostname server1.example.com with the IP address 192.168.1.100. These settings might differ for you, so you have to replace them where appropriate.
I recommend to use a minimal Ubuntu server setup as basis for the tutorial, that can be a virtual- or root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:
sudo su 1. Installing MySQL or MariaDB
There are currently two widely used MySQL database systems available, the>
I will show you how to install both>1.1 Install MySQL 5.7
To install MySQL 5.7, execute this command:
apt-get -y install mysql-server mysql-client
The packages mysql-server and mysql-client are so called 'meta-packages', they install always the latest MySQL version that is available from Ubuntu. Th latest version is currently MySQL 5.7.
We have set the root password for MySQL already during installation, but I would like to remove the anonymous user and test database for security reasons. Run the mysql_secure_installation command below to achieve that.
mysql_secure_installation
You will be asked these questions:
Securing the MySQL server deployment.
Enter password for user root: