In this tutorial guide we will be learning how to install and configure PHPMyAdmin on Ubuntu 21.10 9 (Impish indri).
PHPMyAdmin is free and open source administration tool for MySQL and Mariadb database server. PHPMyAdmin assist users who are not well conversant with the command line because PHPMyAdmin is user friendly because of its user interface presence. Still you can perform database tasks such as creating users, running transactions, creating databases etc.
How to Install Apache, MYSQL, PHP on Ubuntu 20.04
How to setup Ubuntu 20.04 Server for the first time
- Have a user with sudo privileges
- Ubuntu server up and running
- Strong internet connections
Table of Contents
- Update your system repositories
- Install MySQL, Apache and PHP (LAMP)
- Install PHPMyAdmin
- Configure password for MySQL
1. Update System Repositories
The first thing you must always do to any Linux operating system is to update its repositories to reflect on daily changes done to the system. Let us update ours and move on to the next step.
$ sudo apt update $ sudo apt upgrade -y
When both update and upgrade is complete, we can move to install LAMP stack on our system. Let’s begin
2. Install Linux, Apache, MySQL and PHP (LAMP)
LAMP stand for Linux, Apache, MySQL and PHP. It is installed together to help servers host dynamic websites written in PHP.
Let’s begin with Apache webserver. Use the following to install Apache and update our firewall rules to allow Http traffic pass.
$ sudo apt install apache2 -y
We are installing Apache because PHPMyAdmin requires it to run its operations. When installation is complete then we can move to adjust our firewall settings to allow HTTP traffic accordingly. Let us check the status of our firewall with the following command;
$ sudo ufw app list
You will see the following output
# Available applications: Apache Apache Full Apache Secure OpenSSH
Allow only Apache traffic on port 80. Do the following in order to allow traffic from Apache.
$ sudo ufw allow in 'Apache'
Now we can check the status to verify that indeed Apache had been allowed
$ sudo ufw status
I am getting the status that it is inactive, if in case you get this error please enable the ufw like this;
$ ufw enable
Check the status again, this time round it will show the following on your terminal;
$ Status: active To Action From -- ------ ---- Apache ALLOW Anywhere Apache (v6) ALLOW Anywhere (v6)
You can see that Apache is now allowed to pass traffic. Please check the status by tying the following on the browser.
If you get an Apache figure on your browser you are good to go.
Installing MySQL is straight forward, use the following code on your terminal;
$ sudo apt install mysql-server
When installation is complete do secure mysql with the folllowing code;
$ sudo mysql_secure_installation
This will ask you to confirm different prompts. Confirm to be sure that MySQL is installed;
$ sudo mysql
To run PHP it depends on different dependencies like php-mysql for connection with mysql database and libapache2-mod-php. To install this dependencies we do the following;
$ sudo apt install php libapache2-mod-php php-mysql
Confirm if indeed PHP installation was successful with the following command;
You will get the following output.
PHP 8.0.8 (cli) (built: Oct 26 2021 11:42:42) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.8, Copyright (c) Zend Technologies with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies
Having completed the following we need now to install PHPMyAdmin
3. Install PHPMyAdmin
We can install PHPMyAdmin now but first you need to install the following dependencies;
$ sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
Press Y to allow installation to continue. Select Apache and press enter
Next choose password for your phpmyadmin and press enter.
After installation is complete you can restart the Apache2 server for the changes to take place.
$ sudo systemctl restart apache2
Lastly check your installation if it is going through with the following command;
Congratulation you have installed PHPMyAdmin on your system. You can now continue administering database with the help of user interface. Check PHPmyAdmin documentation for further information.