Hello, friends. In this post, we will help you to install the latest stable version of PHPMyAdmin on Debian 11.
If there is a tool that has helped in the management of MySQL / MariaDB data is PHPMyAdmin both professionals and students or even enthusiasts.
So, what is PHPMyAdmin?
According to the project website,
phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. phpMyAdmin supports a wide range of operations on MySQL and MariaDB. Frequently used operations (managing databases, tables, columns, columns, relations, indexes, users, permissions, etc) can be performed via the user interface, while you still can directly execute any SQL statement.
Therefore, with PHPMyAdmin we can quickly query our data and other options quickly and easily. In addition to this, we are talking about an open-source project with which we can examine its source code and even modify it.
Another advantage of using PHPMyAdmin is that as it is a project created with PHP, the only thing we need is an operating system with a web server installed. From there, we can then access it with a web device such as a computer, tablet, or mobile phone.
So, let’s get started.
By default, it is included in the official Debian 11 repositories. So installing it is very easy to do. The problem is that the versions included in the repositories are not always the most up-to-date.
So in this post, we’ll go through the whole process to get the latest stable version published on the PHPMyAdmin website.
Since this is a web application, then it is necessary to have our computer working as a web server. So, we need to install LAMP on Debian 11
Also, it is necessary to install some PHP modules such as
php libapache2-mod-php php-mysql php-mysql php-mbstring php-xml php-zip
Once we have LAMP fully installed, we can continue.
At the time of writing this post, the latest stable version of PHPMyAdmin is
5.1.1 in the future this will change. So to keep it working, in the commands replace
5.1.1 with the updated version number.
Now, from the
/tmp/ folder download PHPMyAdmin with the command
cd /tmp/ wget https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-all-languages.tar.gz
Then unzip it and move it to another location. In this case, I will move it to
sudo mv phpMyAdmin-5.1.1-all-languages /usr/share/phpmyadmin
Now create a
tmp folder dedicated to PHPMyAdmin. Then make Apache the owner of it.
sudo mkdir -p /var/lib/phpmyadmin/tmp sudo chown -R www-data:www-data /var/lib/phpmyadmin
Also, create a folder dedicated to the configuration:
sudo mkdir /etc/phpmyadmin/
Enable the PHPMyAdmin configuration by copying the sample with the configuration name that the program will recognize.
sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
This file needs to be edited to make two modifications.
sudo nano /usr/share/phpmyadmin/config.inc.php
The first is to define a passphrase that will help us to increase security.
$cfg['blowfish_secret'] = '[passphrase]';
The second is to set the path to the temporary folder we created for PHPMyAdmin. You can add this line.
$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';
Save your changes and close the editor.
Now you need to add a recommended Apache configuration for ideal access to PHPMyAdmin.
So, Create the file
sudo nano /etc/apache2/conf-enabled/phpmyadmin.conf
And add the following:
Save the changes and close the editor.
Now enable the
rewrite module and check the service status for an error.
sudo a2enmod rewrite sudo systemctl restart apache2 sudo systemctl status apache2
Optionally, but recommended, you can secure access to PHPMyAdmin by installing Let’s Encrypt certificates.
So, install Certbot and the Apache plugin.
sudo apt install certbot python3-certbot-apache
And generate the certificates as follows
sudo certbot --apache -d [your-domain]
Then, follow the interactive instructions of the tool. There you will have to define your email address and the installation will be done.
Then, restart Apache.
sudo systemctl restart apache2
Now you can access using your favorite web browser at
https://your-server/phpmyadmin/ and you will see the login screen.
So, enjoy it.
PHPMyAdmin is a sophisticated tool that allows us to manage a MariaDB instance without much trouble. It can be useful to save a lot of time in viewing the data and the many options we have to work with.
With this post, you learned how to install the latest stable version without major problems having LAMP as a base.