How to install the latest PhpMyAdmin on Ubuntu 18.04?

Windows Articles

How to get Google Opinion Rewards in any Country

Greetings! Google Opinion Rewards is a cool app, which will allow you to earn credit, to spend it on the Google Play...

How to change the hostname on Ubuntu?

This simple tutorial will teach you how to change the hostname on Ubuntu. The steps we will tell you here will work...

How to install Screaming Frog SEO Spider on Ubuntu 20.04 / 18.04?

If you are working with blogs and content creation then you should know about SEO. Or in the best case, you have...

How to Configure a Firewall in Ubuntu 20.04 / Debian 10?

There is nothing safe from hackers on the Internet, however, we can implement security measures to be more protected against an attack. With this...

Gnome 3.38 available

Gnome OS is a Linux-based operating system, which has a huge domain in the Linux forums. On September 16, 2020, developers announced...
angeloma
angeloma
Senior Writer and partner

Ubuntu 18.04 is the latest LTS version of this huge Linux distribution. So it’s no wonder it’s the one chosen for web application development. In the same way, Ubuntu has many tools for this purpose, however, many of them are not updated to its latest version and makes us miss some new features. One of these tools is PhpMyAdmin which makes it easier for beginners to use and manipulate MySQL or MariaDB data. That is why, in this post, I will show you how to install the latest PhpMyAdmin in Ubuntu 18.04. It is quite easy.

What is PhpMyAdmin?

PhpMyAdmin is a web-based open source tool that helps manipulate MySQL or MariaDB. It is written in PHP and is a free alternative to many paying customers. It supports many of the most common operations performed with these database managers. For example, manipulation and control of data, tables, user as well as export and import data.

On the other hand, PhpMyAdmin has extensive documentation that makes it easy to use. In addition, it has support for many languages so you will not have problems finding yours.

It can be said that PhpMyAdmin is a professional community support tool and is very useful to use.

So, let us start to get the latest PhpMyAdmin on Ubuntu 18.04.

Install the latest PhpMyAdmin on Ubuntu 18.04

1) Install LAMP stack

For better or worse, PhpMyAdmin is a web application. This implies that the necessary software to run a web application must be installed on our computer. That is to say, you have to install LAMP.

However, you can read our post about How to install LAMP on Ubuntu 18.04?

On the other hand, it is good to note that to install PHP and its modules, I recommend these:

:~$ sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-curl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-json

2) Download and install PhpMyAdmin on Ubuntu 18.04

Now it’s time to install PhpMyAdmin. As I mentioned at the beginning, Ubuntu has this tool in its repositories, but it’s a bit old. The best way to install it is through its website.

Open a terminal and run:

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

1.- Download and install PhpMyAdmin on Ubuntu 18.04
1.- Download and install PhpMyAdmin on Ubuntu 18.04

Then, decompress it. And move it to /usr/share/phpmyadmin.

:~$ sudo apt install unzip
:~$ unzip phpMyAdmin-4.8.5-all-languages.zip
:~$ sudo mv phpMyAdmin-4.8.5-all-languages /usr/share/phpmyadmin

PhpMyAdmin handles temporary files. It’s a good idea to create a folder to do this. Then, set the correct permission to it.

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

Then, you also need to create a configuration folder for PhpMyAdmin.

:~$ sudo mkdir /etc/phpmyadmin/

After this, create the initial PhpMyAdmin configuration file. Also, inside that file, you have to change the access password and define the temporary folder.

:~$ sudo cp /usr/share/phpmyadmin/config.sample.inc.php  /usr/share/phpmyadmin/config.inc.php
:~$ sudo nano /usr/share/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = 'your-password'; 
$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';

2.- Configuring PhpMyAdmin
2.- Configuring PhpMyAdmin

Press CTRL + O to save the changes and CTRL + X to exit.

The next step is to make a virtual host for PhpMyAdmin.

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

So, add the following:

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>

Press CTRL + O to save the changes and CTRL + X to close the file.

Restart Apache:

:~$ sudo systemctl restart apache2

Now, you can access to PhpMyAdmin using the web browser. http://server/phpmyadmin. Then, Just login with your username and password.

3.- PhpMyAdmin
3.- PhpMyAdmin

And that’s it.

Conclusion

PhpMyAdmin is a very effective tool to manage MySQL or MariaDB quickly and professionally. This type of tools, it is advisable to have always updated, because with this we will be able to take advantage of it more.

Please share this post with your friends.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to get Google Opinion Rewards in any Country

Greetings! Google Opinion Rewards is a cool app, which will allow you to earn credit, to spend it on the Google Play...

How to change the hostname on Ubuntu?

This simple tutorial will teach you how to change the hostname on Ubuntu. The steps we will tell you here will work...

How to install Screaming Frog SEO Spider on Ubuntu 20.04 / 18.04?

If you are working with blogs and content creation then you should know about SEO. Or in the best case, you have...

How to Configure a Firewall in Ubuntu 20.04 / Debian 10?

There is nothing safe from hackers on the Internet, however, we can implement security measures to be more protected against an attack. With this...

Gnome 3.38 available

Gnome OS is a Linux-based operating system, which has a huge domain in the Linux forums. On September 16, 2020, developers announced...
x