In this tutorial we will show you how to install a LAMP stack server on the Ubuntu 17.04 or Ubuntu 17.10 operating system. For those of you who do not know, LAMP is the most fully featured stack with the most popular web server configuration which includes Apache, MySQL database server and the most popular open source web programming language called PHP. All components are free and open source software and support an incredible variety of software including the WordPress blogging platform.
This article assumes that you have at least basic knowledge of Linux, to know how to use the shell, and most importantly, you will be hosting your website on your VPS. The installation is very easy. I’ll guide you through the step by step the installation of LAMP(Linux, Apache, MySQL and PHP) on Ubuntu Zesty Zapus.
Step 1. First, make sure that all packages are updated by running the following commands in the terminal.
Step 2. Install Apache on Ubuntu 17.04
We will install Apache, again using apt-get, which is the default package manager on Ubuntu. You’ll also need to install the libapache2-mod-php module to work with PHP quickly:
apt install apache2 libapache2–mod–php
Next, after installing the Apache service, run all the necessary services:
systemctl enable apache2
systemctl start apache2
To check the Apache version:
You can check if Apache is actually running, open your favorite web browser and typing in the URL is http://<your server’s IP> and if it is installed, then you will see this:
Step 3. Installing MySQL on Ubuntu 17.04
Now that we have our web server up and running, it’s time to install MySQL. MySQL is a database management system. Basically it is to organize and access to the databases that can store our website information:
apt install mysql-server php7.1-mysql
By default, MySQL is vulnerable. You can make sure mysql is secured by using the command mysql_secure_installation. You should read it and carefully under each step that will determine the root password, remove the anonymous user, disable Remote Root Login and remove Test Database and MySQL:
To log in to MySQL, use the following command (please replace root with your username if the name was changed):
mysql -u root -p
If you are using software such as WordPress, there will be many missing PHP modules that are required for a large amount of functionality. To install the required extensions use this command:
apt install –y php php–mysql php–mcrypt php–mbstring php-curl php-gd php-json php-xml
To restart the server and mysql use the following commands:
systemctl restart apache2
systemctl restart mysql
At this point you have successfully installed the LAMP stack on your server. Thank you for using this tutorial for Ubuntu (Zesty Zapus) 17.04 for installing the LAMP Stack (Linux, Apache, MySQL and PHP). For additional documentation, we recommend checking the official Apache, MySQL and PHP websites.