Install Nginx Mysql Phpmyadmin Ubuntu


Install Nginx Mysql Phpmyadmin Ubuntu

1. Introduction

In today’s tutorial, we will show you how to install Nginx, MySQL, and phpMyAdmin on Ubuntu 20.04. Nginx is an open source web server that is very useful for hosting websites. MySQL is an open-source relational database management system. phpMyAdmin is a free, open source web-based tool that is used to manage MySQL databases. These components can be installed and configured to create an optimized web server for hosting websites and applications.

2. Prerequisites

Before installing the Nginx, MySQL, and phpMyAdmin on Ubuntu 20.04, there are a few things you need to prepare in advance. First of all, you should have a fresh installation of Ubuntu 20.04. Secondly, you should have a non-root user account with sudo privileges. You can create a new user with the sudo privileges by running the command below.

useradd -m -s /bin/bash -G sudo username

Then you should set a password for the new user:

passwd username

Finally, you should ensure that all the packages on your system are up to date by running the following command:

sudo apt update
sudo apt upgrade

3. Install Nginx

Nginx can be installed with the apt command. First, you need to add the Nginx repository to your system:

sudo add-apt-repository ppa:nginx/stable
sudo apt-get update

Once the repository is added, you can install Nginx with the following command:

sudo apt-get install nginx

You can start the Nginx service by running the following command:

sudo systemctl start nginx

You can verify if the Nginx is running by checking the status of the service:

sudo systemctl status nginx

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 Mon 2020-09-14 13:15:48 UTC; 15min ago
Process: 2306 ExecStart=/usr/sbin/nginx -g daemon on; master_process on (code=exited, status=0/SUCCESS)
Main PID: 2313 (nginx)
Tasks: 2 (limit: 2344)
Memory: 10.3M
CGroup: /system.slice/nginx.service
├─2313 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
└─2314 nginx: worker process

If you see “active (running)” in the output, then Nginx has been installed successfully.

4. Install MySQL

Next, you need to install MySQL. You can install MySQL server with the following command:

sudo apt-get install mysql-server

During the installation, you will be asked to set a password for the root user. Make sure to choose a secure password.

Once the installation is completed, you can start the MySQL service:

sudo systemctl start mysql

You can verify if the MySQL is running by checking the status of the service:

sudo systemctl status mysql

Output:


● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-09-14 13:15:48 UTC; 15min ago
Process: 2307 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)
Main PID: 2316 (mysqld)
Tasks: 27
Memory: 140.3M
CGroup: /system.slice/mysql.service
└─2316 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid

If you see “active (running)” in the output, then MySQL has been installed successfully.

5. Install phpMyAdmin

After installing Nginx and MySQL, you can install phpMyAdmin with the following command:

sudo apt-get install phpmyadmin

During the installation, you will be asked to select the web server you want to configure. Select Nginx, and then press OK. Next, you will be asked to choose a password for the phpMyAdmin user. Make sure to choose a secure password.

Once the installation is completed, you need to create a symbolic link for phpMyAdmin:

sudo ln -s /usr/share/phpmyadmin/ /var/www/html/

Next, you need to enable the phpMyAdmin configuration file:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/nginx/sites-enabled/phpmyadmin.conf

Finally, restart the Nginx service to apply the configuration:

sudo systemctl restart nginx

6. Conclusion

In this tutorial, we have shown you how to install Nginx, MySQL, and phpMyAdmin on Ubuntu 20.04. We hope you have found this tutorial helpful.

FAQs

Q1. How do I Install Nginx Mysql Phpmyadmin Ubuntu?

A1. Installing Nginx, MySQL, and phpMyAdmin on Ubuntu 20.04 is a relatively straightforward process. First, add the Nginx repository to your system and then install Nginx. Next, you can install MySQL from the official repository. Finally, you can install phpMyAdmin and create a symbolic link for it.

Q2. How do I Confirm the Installation of LAMP Stack on Ubuntu 20.04?

A2. To confirm the installation of the LAMP stack (Linux, Apache, MySQL, and PHP) on Ubuntu 20.04, you can run the command “php -v”. This will output the version of PHP that is installed on your system.

Q3. How do I Connect to MySQL Database Using phpMyAdmin?

A3. To connect to MySQL Database using phpMyAdmin, you will need to provide the root username and password. Once you provide the credentials, click the “Login” button to access the MySQL database.

Thank you for reading this article. You can read more about Nginx, MySQL, and phpMyAdmin on our blog.

Leave a Reply

Your email address will not be published. Required fields are marked *