Install Nginx Php Mysql Phpmyadmin Ubuntu 18.04
Introduction
In this article, we will demonstrate how to install Nginx, PHP, MySQL, and phpMyAdmin on an Ubuntu 18.04 server. Nginx is a powerful web server that can serve static or dynamic content. PHP is one of the most popular scripting languages for web development and is installed on most servers. MySQL is a powerful database server that will store all of your data. phpMyAdmin is a web-based interface that you can use to manage your MySQL databases.
Before proceeding with the installation of these packages, you should update all of your currently installed packages. You can do this by running the following command:
sudo apt update && sudo apt upgrade -y
Step 1 — Installing Nginx
The first step is to install the Nginx web server. To do this, run the following command:
sudo apt install nginx
Once the installation is complete, you can check the status of the Nginx service with the following command:
sudo systemctl status nginx
You should see the following output:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-03-26 09:32:51 UTC; 2min 24s ago
Main PID: 12586 (nginx)
Tasks: 2 (limit: 1152)
CGroup: /system.slice/nginx.service
├─12586 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─12593 nginx: worker process
The output shows that the Nginx service is running. To make sure that Nginx starts automatically when the system boots up, run the following command:
sudo systemctl enable nginx
You can also check the version of the Nginx web server by running the following command:
nginx -v
Step 2 — Installing PHP
The next step is to install PHP. To do this, run the following command:
sudo apt install php7.2-fpm php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-mysql php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl
Once the installation is complete, you can check the version of PHP by running the following command:
php -v
You should see the following output:
PHP 7.2.24-0ubuntu0.18.04.2 (cli) (built: Jul 21 2019 21:52:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
Step 3 — Installing MySQL
The next step is to install MySQL. To do this, run the following command:
sudo apt install mysql-server
Once the installation is complete, you can check the status of the MySQL service with the following command:
sudo systemctl status mysql
You should see the following output:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-03-26 09:56:52 UTC; 48min ago
Main PID: 15896 (mysqld)
Tasks: 27 (limit: 1152)
CGroup: /system.slice/mysql.service
├─15896 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
└─15939 sleep 1
If you want to make sure that MySQL starts automatically when the system boots up, you can run the following command:
sudo systemctl enable mysql
Step 4 — Configuring MySQL
Once the installation is complete, you need to secure your MySQL installation by running the mysql_secure_installation script. To do this, run the following command:
sudo mysql_secure_installation
You will be asked a few questions during this process. It is recommended that you answer “yes” to all of them.
Step 5 — Installing phpMyAdmin
The next step is to install phpMyAdmin. To do this, run the following command:
sudo apt install phpmyadmin
Once the installation is complete, you need to create a symbolic link for phpMyAdmin from the web root directory. To do this, run the following command:
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
Once the symbolic link is created, you need to create an Apache configuration file for phpMyAdmin. To do this, create the configuration file with the following command:
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Add the following lines:
Alias /phpmyadmin /usr/share/phpmyadmin
DirectoryIndex index.php
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
Restart the Apache service to apply the changes:
sudo systemctl restart apache2
Conclusion
In this article, we have demonstrated how to install Nginx, PHP, MySQL, and phpMyAdmin on an Ubuntu 18.04 server. We have also shown how to configure each of these packages to work properly. We hope you have found this article to be helpful.
FAQs
Q. How do I start and stop Nginx?
A. To start Nginx, you can run the following command:
sudo systemctl start nginx
To stop Nginx, you can run the following command:
sudo systemctl stop nginx
Q. How do I restart MySQL?
A. To restart MySQL, you can run the following command:
sudo systemctl restart mysql
Q. How do I access phpMyAdmin?
A. To access phpMyAdmin, you can open your web browser and go to http://your-server-ip/phpmyadmin. You will be prompted to enter your MySQL username and password.
Related Posts:
- Install Rails On Ubuntu Nginx Rbenv Install Rails On Ubuntu Nginx Rbenv Introduction Rails is an open-source web application framework written in Ruby. It is designed to make programming web applications easier by providing a full…
- Install Laravel Nginx Ubuntu 18.04 Install Laravel Nginx on Ubuntu 18.04 Introduction In this tutorial, we will look at how to install Laravel with Nginx on an Ubuntu 18.04 server. Laravel is a powerful PHP…
- Nginx Mariadb Phpmyadmin Php5-Fpm Debian Jessie Nginx Mariadb Phpmyadmin Php5-Fpm Debian Jessie Configuring Nginx on Debian Jessie Nginx is a web server that is used to serve both static and dynamic content to web clients. Installing…
- Lets Encrypt Nginx Ubuntu 14.04 With Nginx Conf Custom Let's Encrypt Nginx Ubuntu 14.04 with Nginx Conf Custom Introduction to Nginx Conf Custom Nginx Conf Custom is an open source solution for hosting web applications on Ubuntu 14.04. It…
- How To Ubuntu 16.04 Multiple Php Nginx How to Ubuntu 16.04 Multiple PHP Nginx Ubuntu 16.04 is a robust operating system that is commonly used for web application development. This operating system uses Nginx as the web…
- Install Phpmyadmin Nginx Ubuntu 16.04 Php 7 Install Phpmyadmin Nginx Ubuntu 16.04 Php 7 Introduction to PhpMyAdmin PhpMyAdmin is a web-based tool that enables the users to manage their MySQL databases. It also provides a graphical interface…
- Install Laravel 5.8 Nginx Php7.3 Install Laravel 5.8 Nginx Php7.3 Overview Installing Laravel 5.8 on a Nginx server running PHP 7.3 can be a tricky task. This tutorial explains how to install the popular open…
- Centos 6 Nginx Phpmyadmin Forbideen Centos 6 Nginx Phpmyadmin Forbidden Introduction CentOS 6, an open-source Linux operating system, is one of the most popular web server operating systems. It is considered to be a reliable…
- Install Phpmyadmin For Nginx Debian 8 Install Phpmyadmin For Nginx Debian 8 Introduction The Nginx web server popularly known as Nginx is a lightweight web server written in C programming language. It is an open source…
- Docker Compose Php Mysql Nginx Docker Compose Php Mysql Nginx Introduction to Docker Compose for PHP, MySQL and Nginx Docker Compose is a tool for scripting and managing the deployment of multi-container applications. It is…
- Install Phpmyadmin On Nginx Ubuntu 18.04 Install Phpmyadmin On Nginx Ubuntu 18.04 Introduction PhpMyAdmin is one of the most popular and widely used web-based database management tools available. It is used for administering, managing and maintaining…
- Linux Nginx Mysql Php Lemp Linux Nginx Mysql Php Lemp What is Linux, Nginx, MySQL, PHP (LEMP)? Linux, Nginx, MySQL, PHP (LEMP) is a software stack combination of Linux, Nginx, MySQL, and PHP, commonly referred…
- Install Nginx Phpmyadmin Ubuntu 18.04 Install Nginx Phpmyadmin Ubuntu 18.04 Introduction to Nginx, PHP, and Ubuntu Nginx is an open-source, high-performance web server written in C and used to serve static and dynamic webpages. It…
- How To Install Nginx Maridb 10 On Ubuntu 16.04 Lts How To Install Nginx Maridb 10 On Ubuntu 16.04 Lts Step 1 — Installing Nginx The first step in installing Nginx and MariaDB 10 on Ubuntu 16.04 is installing Nginx.…
- Step By Step Install Nginx And Phpmyadmin On Ubuntu Step By Step Install Nginx And Phpmyadmin On Ubuntu Introduction Setting up a web server on Ubuntu is easy and straightforward. Nginx is a popular web server for Ubuntu, and…
- Add Root Password Mysql Nginx Ubuntu 16.04 Add Root Password Mysql Nginx Ubuntu 16.04 What is a root password? In the context of computer security, a root password is a user account that is given access to…
- Setting Php Nginx Ubuntu Vps Setting Up a PHP, Nginx, and Ubuntu VPS What is a VPS? A Virtual Private Server (VPS) is a type of virtualized hosting. It works in the same way as…
- Google Cloud Ubuntu 16 Install Nginx Php Google Cloud Ubuntu 16 Install Nginx Php 1. What is Nginx? Nginx is a powerful open source web server. It is used to serve web pages to the internet and…
- Install Nginx Php Mysql Phpmyadmin Centos 7 Install Nginx Php Mysql Phpmyadmin Centos 7 A Brief Overview of Centos 7 Centos 7 is a Linux distribution based on the Redhat Enterprise Linux Server, and is a popular…
- How To Configure Cacti Nginx On Debian 9 How To Configure Cacti Nginx On Debian 9 Introduction Cacti is a powerful open source monitoring and graphing solution that combines a powerful backend database, a web interface, and an…
- Ubuntu 18.04 Nginx Php Mariadb Ubuntu 18.04 Nginx, Php, and Mariadb Understanding Ubuntu 18.04 Ubuntu 18.04 is the latest version of the popular open-source Linux distribution. It is based on Debian and is known for…
- Deploy Laravel Nginx Ubuntu 17 Deploy Laravel Nginx Ubuntu 17 Requirements for Installing Laravel 5.4 on Ubuntu 17 This article will guide you through the process of installing Laravel 5.4 on Ubuntu 17. Before we…
- How To Debian Nginx Php How To Debian Nginx Php Step 1 – Setup Your VPS The first step to setting up your web server is getting your VPS (Virtual Private Server). This is usually…
- Config Mysql Nginx In Centos Config Mysql Nginx In Centos Introduction: CentOS is a versatile Linux server operating system. It is the most widely used operating system for web servers, providing enterprises and small business…
- Docker Compose Nginx Node Js Mysql Docker Compose Nginx Node Js Mysql What is Docker Compose? Docker Compose is a utility used to deploy and manage applications created with multiple services (or containers) in a single…
- How To Install Phpmyadmin With Nginx On Windows 10 How To Install Phpmyadmin With Nginx On Windows 10 What Is Phpmyadmin? PhpMyAdmin is a popular open source tool used for managing MySQL databases, created written in PHP language. It…
- Install Database Mysql Vagrant Nginx Install Database Mysql Vagrant Nginx What is Nginx? Nginx is an open source, high-performance web and proxy server designed to serve a variety of web applications. It handles requests from…
- Install Phpmyadmin Nginx Centos 8 Install Phpmyadmin Nginx Centos 8 What is Nginx? Nginx is an open source web server that is popular due to its high performance, scalability, stability, and low resource consumption. Nginx…
- Install Nginx Php5.6 Mysql Centos 7 Install Nginx Php5.6 Mysql Centos 7 Requirements Before we get started, let us go through the system requirements to install Nginx, Php5.6 and MySQL on CentOS 7. CentOS 7 Root…
- Wordpress Nginx Ubuntu 18.04 Wordpress Nginx Ubuntu 18.04 Overview WordPress is a popular web software used by millions of people around the world. It allows users to easily create and manage websites without the…