Dotlayer
  • News
  • Startups
  • Tutorials
  • SEO
  • Marketing
  • Interviews
No Result
View All Result
Dotlayer
  • News
  • Startups
  • Tutorials
  • SEO
  • Marketing
  • Interviews
No Result
View All Result
Dotlayer
No Result
View All Result

How to Setup the LAMP (Linux Apache, MySQL, PHP) Stack on Ubuntu 18.04 LTS (Bionic Beaver)

May 2, 2018
in Tutorials
0 0
Share on FacebookShare on Twitter

The LAMP Stack, which is short for the Linux, Apache, MySQL, and PHP web technology stack is currently the most popular web hosting environment for the PHP based application.

The LAMP stack powers over 70% of all web technologies according to W3Techs, the independent web technologies usages statistics engine. In the LAMP stack, Linux is an operating system, which in this case we will be using the Ubuntu flavor of Linux, Apache is the web server developed by Apache Foundation, the latest version is version 2.0, MySQL is relational database management system used for storing data which is currently replaceable with MariaDB and PHP is the programming language, the latest version is PHP 7.

All these version come with the latest version of Ubuntu 18.04. In this article we will be going over how to install and configure the LAMP stack on a new install on Ubuntu 18.04. if you don’t have a test box, head over to Digital Ocean or any of the Cloud services providers to get a new install of Ubuntu to follow along.

Firstly, we are required to have root access to the server you are installing on, login to your Ubuntu system using GUI for Desktop and SSH for the server edition and upgrade current packages to latest version.

ssh [email protected]
sudo apt update
sudo apt upgrade

1. Installing PHP

Out of the box, Ubuntu 18.04 has PHP 7.2 as the default installation. However, you can add an additional PPA for PHP installation which includes multiple other versions of PHP. Use the apt command below to update apt cache and install PHP packages on your system.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.2

Now you install some additional PHP modules for supporting various tasks depending on what you need to do.

sudo apt install php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-xml

2. Installing Apache2

After installing PHP on your system, let’s start the installation of Apache2 in your system. Your also required to install libapache2-mod-php module to work PHP with Apache2.

sudo apt install apache2 libapache2-mod-php7.2

This command will install the Apache web server and install the PHP module that allows Apache to become the PHP application server. This module automatically allows apache to process all files that end with the extension .php.

3. Installing MySQL

Now we are at the final step of installing MySQL, In this last step we will install mysql-server packages for MySQL database. Also, install php-mysql package to use MySQL support using php. Use the following command to install it.

sudo apt install mysql-server php7.2-mysql

The installer will prompt for root password, This password will work for your MySQL root user. After installing MySQL execute the following command for initial settings of MySQL server. You will see that script will prompt for more settings than earlier MySQL versions like password validation policy etc.

sudo mysql_secure_installation

Additionally, you can also install phpMyAdmin for the administration of MySQL using web interface.

sudo apt install phpmyadmin

4. Restart MySQL and Apache Services

After installing all the services on your system. Restart MySQL and Apache service to reload any changes done manually.

sudo systemctl restart apache2.service
sudo systemctl restart mysql.service

After completing all setup. Let’s create a phpinfo.php file website document root with following content.

<?php
phpinfo();
?>

Now access this file in web browser. You will see the screen like below with all details of PHP on server.

At this point you have successfully configured web server on your Ubuntu 18.04 System. In our next article, we will be installing LAMP Stack on RHEL based systems, subscribe below to get updates on that article.

ShareTweetPin
Previous Post

How to Generate A Free Wildcard SSL Certificate with Let’s Encrypt for Your Domain on Ubuntu

Next Post

Install and Configure Redis on Ubuntu 18.04 and Speed Up WordPress Using Caching

Next Post

Install and Configure Redis on Ubuntu 18.04 and Speed Up WordPress Using Caching

You might also like

Mint Linux vs Ubuntu: Which is Right For You?

Mint Linux vs Ubuntu: Which is Right For You?

March 12, 2022
Net Neutrality: What is it and Why Should You Care?

Net Neutrality: What is it and Why Should You Care?

March 12, 2022
Solid State Drives – Why You Should Buy One Today

Solid State Drives – Why You Should Buy One Today

March 12, 2022

Machine Learning Algorithms Every Beginner Should Know

January 25, 2022
What Is the log4j Vulnerability, log4shell, an Example Step-By-Step Exploit and How to Fixed It

What Is the log4j Vulnerability, log4shell, an Example Step-By-Step Exploit and How to Fixed It

December 11, 2021
Simple Video Call integration into Website with Jitsi

Simple Video Call integration into Website with Jitsi

May 26, 2020
  • Terms of Service
  • Privacy Policy
  • Careers

© 2021 Dotlayer.com

No Result
View All Result
  • About Us
  • Advertise
  • Blog
  • Careers
  • Contact
  • Contact Us
  • Get Featured
  • Home Layout 1
  • Home Layout 2
  • Home Layout 3
  • Privacy Policy
  • Security
  • Services
  • Subscribe To Dotlayer
  • Terms of Service
  • Write For Us

© 2021 Dotlayer.com

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In