Install PHPMyAdmin on Ubuntu 20.04

Windows Articles

How to Install APK file on Android

Hello Friends! Today we bring you a simple guide on how to install an APK file in Android. What...

How to Install the Latest version of FFmpeg on Ubuntu 20.04 / Debian 10?

Knowing how to install the latest version of FFmpeg is important if you know how to work with multimedia files. So in...

How to block emails from specific senders in Outlook

Hello, how are you? Today we will talk a little about Microsoft Outlook. It is well known that its main function is...

How to Block a phone number on Android

Hello friends. In this post, we will show you how to block a phone number on Android. Have you ever wondered how...

How to install Java 15 on CentOS 8 / CentOS 7

Recently Java 15 has been released with interesting new features in the accounting field and introducing many security patches. In spite of...
angeloma
angeloma
Senior Writer and partner

For developers, the application database is important. And many projects use MySQL or MariaDB to meet this need. In this sense, an application that helps the data query and the administration of the MySQL or MariaDB instance becomes necessary. In this post, I will help you to install maybe one of the most popular ones there is, I mean PHPMyAdmin on Ubuntu 20.04

PHPMyAdmin is an open-source application created in PHP that provides the administration of a MySQL or MariaDB database from a comfortable web interface. It is simply installed on the server, we make a few small configurations and that’s it. That’s it. Without consuming many resources you will have a quality application.

So, let’s get started.

Install PHPMyAdmin on Ubuntu 20.04

1.- Install LAMP on Ubuntu 20.04

PHPMyAdmin is created in PHP, so we are talking about a web application. Therefore, it requires a correctly installed LAMP server.

How to install LAMP on Ubuntu 20.04?

Once the installation is finished, you can continue.

I also advise you to create a dedicated user for PHPMyAdmin.

2.- Installing PHPMyAdmin on Ubuntu 20.04

For now, the last official version of PHPMyAdmin is 5.0.2, so we will proceed to download it using wget.

:~$ cd /tmp/
:~$ wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.zip

Then, decompress it into another folder dedicated to PHPMyAdmin as /usr/share

:~$ sudo unzip phpMyAdmin-5.0.2-all-languages.zip -d /usr/share/

It is advisable to change the name of the folder to one more easily manipulated like this:

:~$ sudo mv /usr/share/phpMyAdmin-5.0.2-all-languages/ /usr/share/phpmyadmin

Also, create the directories that the application will use.

:~$ sudo mkdir -p /var/lib/phpmyadmin/tmp
:~$ sudo mkdir /etc/phpmyadmin/

Then, assign Apache as the owner of the PHPMyAdmin temporary folder.

:~$ sudo chown -R www-data:www-data /var/lib/phpmyadmin

The next step is to copy the default configuration and transform it into the program’s loaded configuration.

:~$ sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php

Then, you have to set a secret blowfish in the PHPMyAdmin configuration file:

:~$ sudo nano /usr/share/phpmyadmin/config.inc.php

In this case I have established the following:

$cfg['blowfish_secret'] = '0sr@dar';

In that same file, set the directory of temporary files that we have created for PHPMyAdmin:

$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';

Then, save the changes and close the file

1.- Installing PHPMyAdmin on Ubuntu 20.04
1.- Installing PHPMyAdmin on Ubuntu 20.04

Finally, create a new Virtualhost for the application:

:~$ sudo nano /etc/apache2/conf-enabled/phpmyadmin.conf

And add all this content inside:

Alias /phpmyadmin /usr/share/phpmyadmin
     <Directory /usr/share/phpmyadmin>
           Options SymLinksIfOwnerMatch
           DirectoryIndex index.php
     <IfModule mod_php5.c> 
           <IfModule mod_mime.c>
                AddType application/x-httpd-php .php 
           </IfModule>
     <FilesMatch ".+\.php$">
           SetHandler application/x-httpd-php 
     </FilesMatch>
     php_value include_path .
     php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
     php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
     php_admin_value mbstring.func_overload 0
     </IfModule>
     <IfModule mod_php.c>
          <IfModule mod_mime.c>
              AddType application/x-httpd-php .php
     </IfModule>
          <FilesMatch ".+\.php$">
             SetHandler application/x-httpd-php
          </FilesMatch>
    php_value include_path .
    php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
    php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
    php_admin_value mbstring.func_overload 0
     </IfModule>
</Directory>

#Authorize for setup 
<Directory /usr/share/phpmyadmin/setup>
      <IfModule mod_authz_core.c>
           <IfModule mod_authn_file.c>
               AuthType Basic
               AuthName "phpMyAdmin Setup"
               AuthUserFile /etc/phpmyadmin/htpasswd.setup
           </IfModule>
      Require valid-user
      </IfModule>
</Directory>

#Disallow web access to directories that don't need it

<Directory /usr/share/phpmyadmin/templates>
     Require all denied
</Directory>

<Directory /usr/share/phpmyadmin/libraries>
     Require all denied
</Directory>

<Directory /usr/share/phpmyadmin/setup/lib>
     Require all denied
</Directory>
2.- Virtualhost for PHPMyAdmin

Save the changes and close the file.

To apply this new Virtuahost, just restart Apache.

:~$ sudo systemctl restart apache2

Now open your favorite web browser and go to http://your-server/phpmyadmin and you will see the login screen.

3.- PHPMyAdmin login page on Ubuntu 20.04
3.- PHPMyAdmin login page on Ubuntu 20.04

Log in and then you can start working.

PHPMyAdmin on Ubuntu 20.04

Conclusion

PHPMyAdmin is a vital tool for many developers. It allows you to visualize MySQL or MariaDB data quickly through a well-designed graphical interface that does not consume many computer resources. Thanks to this post, you can enjoy the latest stable version of PHPMyAdmin on Ubuntu 20.04

Please share this post and join our Telegram channel.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to Install APK file on Android

Hello Friends! Today we bring you a simple guide on how to install an APK file in Android. What...

How to Install the Latest version of FFmpeg on Ubuntu 20.04 / Debian 10?

Knowing how to install the latest version of FFmpeg is important if you know how to work with multimedia files. So in...

How to block emails from specific senders in Outlook

Hello, how are you? Today we will talk a little about Microsoft Outlook. It is well known that its main function is...

How to Block a phone number on Android

Hello friends. In this post, we will show you how to block a phone number on Android. Have you ever wondered how...

How to install Java 15 on CentOS 8 / CentOS 7

Recently Java 15 has been released with interesting new features in the accounting field and introducing many security patches. In spite of...
x