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:
- 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…
- Ubuntu 18 Enable Php Mysql Nginx Ubuntu 18 Enable Php Mysql Nginx Introduction: What Is Ubuntu? Ubuntu is an open source operating system based on the Debian GNU/Linux distribution. Built around the Linux kernel and released…
- 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…
- Install Nginx Php Mysql Ssl & Wordpress On Ubuntu 18.04 Install Nginx Php Mysql Ssl & Wordpress On Ubuntu 18.04 What is Nginx, Php, Mysql, SSL and Wordpress? Nginx is a high-performance web server that is widely used to serve…
- 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…
- Install Wordpress On Ubuntu Vps On Nginx Install Wordpress On Ubuntu VPS On Nginx What is WordPress? WordPress is an open-source, content management system (CMS) top-tier overall that is used to create powerful online presence. It powers…
- How To Install Phpmyadmin On Nginx How To Install Phpmyadmin On Nginx Introduction PhpMyAdmin is an open source software program which is used to manage MySQL and MariaDB databases. It provides a graphical interface to execute…
- 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…
- How To Login Phpmyadmin In Nginx Server Ubuntu How To Login Phpmyadmin In Nginx Server Ubuntu What is Nginx & phpMyAdmin Nginx is a web server software that is commonly used on Linux-based systems, though it works on…
- Install Mariadb Nginx Debian 9.7 Install Mariadb and Nginx on Debian 9.7 Overview of Installing MariaDB and Nginx on Debian 9.7 Installing MariaDB and Nginx on Debian 9.7 can be an essential step when setting…
- How To Install Nginx On Ubuntu 18.04 How To Install Nginx on Ubuntu 18.04 Introduction Nginx is a popular open-source web server and reverse proxy software that’s used by millions of websites. It’s the most widely used…
- Install Nginx Phpmyadmin Centos 7 Install Nginx Phpmyadmin Centos 7 What is Nginx? Nginx is a web server that is used in Linux-based operating systems such as Centos 7. It is designed to handle high-traffic…
- 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…
- Can I Install Phpmyadmin In Nginx Can I Install Phpmyadmin In Nginx? PHPmyadmin is a web-based management tool for databases such as MySQL and MariaDB. It is a popular tool for web developers and database administrators…
- Install Wordpress On Nginx Ubuntu Install Wordpress On Nginx Ubuntu Introduction WordPress is a popular open-source blogging platform and content management system (CMS). It is made to be used on the internet, and it is…
- Install Nginx And Php On Ubuntu 18.04 Install Nginx And Php On Ubuntu 18.04 Introduction In this article, we will guide you on how to install Nginx and php on Ubuntu 18.04. Nginx is a popular web…
- 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…
- Install Phpmyadmin Debian 10 Nginx Install Phpmyadmin Debian 10 Nginx What is PhpMyAdmin? PhpMyAdmin is a web-based administration tool for managing MySQL databases. It is one of the most popular applications in the Apache, Nginx,…
- Create Wordpress With Nginx Mariadb Php-Fpm 16.04 Create WordPress With Nginx Mariadb Php-Fpm 16.04 What Is WordPress? WordPress is a content management system (CMS) and a blogging platform. It allows you to easily create and manage websites…
- 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…
- 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…
- How To Install Cachet Nginx How To Install Cachet Nginx Overview Cachet is an open-source monitoring platform that is widely used by web developers, DevOps engineers, and system administrators for monitoring the performance of a…
- How To Install Nginx And Mariadb 10 How To Install Nginx And Mariadb 10 What is Nginx and MariaDB 10 Nginx is a free, open-source web server that is known for its scalability and performance. It is…
- Install Postgis Ubuntu 18.04 Nginx Install Postgis Ubuntu 18.04 Nginx What is Postgis? Postgis is a Postgres-based open source geographic information system (GIS) that enables users to store, query, and analyze spatial data stored in…
- Ubuntu Server18 How To Enable Nginx Pdo Mysql Ubuntu Server18: How to Enable Nginx Pdo Mysql As a developer, you may have heard of Nginx, PDO, and MySQL – all are essential components of web applications. Nginx is…
- 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.…
- 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…
- Install Mysql Pada Nginx Pada Ubuntu Install Mysql Pada Nginx Pada Ubuntu Overview of Nginx and Its Benefits Nginx is a web server, reverse proxy server, and mail proxy server application that is open-source and available…
- Vps Webserver Nginx Php7 Mysql Vps Webserver Nginx Php7 Mysql What Is VPS Webserver? A VPS webserver is a Virtual Private Server (VPS) that has been configured to act as a web server. A VPS…
- Apt-Get Install Nginx Php Mysql Apt-Get Install Nginx Php Mysql What is Apt-Get? Apt-Get is a powerful and innovative command line tool used by Linux-based operating systems such as Debian, Ubuntu, Linux Mint and others.…