How to install Adminer on Ubuntu 20.04 LTS

last updated in Categories , , ,

How do I install Adminer on Ubuntu 20.04 LTS for database management over the web?

Adminer (formerly known as phpMinAdmin) is an open-source and free web-based database management tool. It is written in PHP. As compared to phpMyAdmin, it is a lightweight application with strong security and user experience in mind. This tutorial describes how to install Adminer on Ubuntu 20.04 LTS Linux server for MySQL or MariaDB.
Tutorial requirements
Operating system/appUbuntu Linux and Apache 2 with PHP
Root privileges requiredYes
DifficultyEasy (rss)
Estimated completion time10m
Table of contents


Procedure to install Adminer on Ubuntu 20.04 Linux server

  1. Update your Ubuntu server running sudo apt update && sudo apt upgrade
  2. Make sure Apache server installed and configured on Ubuntu
  3. Install Adminer by typing the sudo apt install adminer command.
  4. Enable configuration, run: sudo a2enconf adminer
  5. Log in and start accessing database using https://your-domain/adminer/ URL.

Obviously, you need Apache or any other web server installed. Here is how to install Apache 2 on Ubuntu 20.04 LTS. Now that Apache web server installed and running let us get our hands dirty by installing Adminer.

Installing Adminer

First update the system using the apt command/apt-get command and then install Adminer software:
sudo apt update
sudo apt upgrade
sudo apt install adminer

How to install Adminer on Ubuntu 20.04 Linux using apt command
Please note that apart from Apache PHP required to run Adminer. Hence, apt installed PHP and automatically configured it too. For other web servers, you need to perform manual configurations. Use the cat command to verify that PHP 7.4 module is enabled:
a2query -m php7.4
php7.4 (enabled by maintainer script)
cat /etc/apache2/mods-enabled/php7.4.{load,conf}

Config files:

# Conflicts: php5
# Depends: mpm_prefork
LoadModule php7_module /usr/lib/apache2/modules/
<FilesMatch ".+\.ph(ar|p|tml)$">
    SetHandler application/x-httpd-php
<FilesMatch ".+\.phps$">
    SetHandler application/x-httpd-php-source
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Require all denied
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(ar|p|ps|tml)$">
    Require all denied
# Running PHP scripts in user directories is disabled by default
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        php_admin_flag engine Off

Configuring Adminer

To activate adminer app run any one of the following a2enconf command
sudo a2enconf adminer.conf
## OR ##
sudo a2enconf adminer


Enabling conf adminer.
To activate the new configuration, you need to run:
  systemctl reload apache2

Now all you have to do is restart or reload the Apache 2 server, enter:
sudo systemctl reload apache2
The default config file is located at /etc/apache2/conf-enabled/adminer.conf and viewed using the cat command:
sudo cat /etc/apache2/conf-enabled/adminer.conf

# Adminer on Ubuntu 20.04 #
Alias /adminer /etc/adminer
<Directory /etc/adminer>
	Require all granted
	DirectoryIndex conf.php

Test the installation

You can access the Adminer app using the following URL format:

Adminer running on Ubuntu 20.04
Now all you have to do is provide database type (MySQl, PGSQL), server IP/hostname, database username/password, and database name to login and manage the database:
adminer mysql login

A note about firewall configuration

Say Apache/adminer is running on the host having IP address and database server is at, then allow access using the ufw (type command on mysql/mariadb server):
sudo ufw allow from to port 3306 proto tcp comment 'allow mysql access for Adminer/Apache IP'
See UFW on Ubuntu 20.04 LTW page for detailed information. Next, you need to make sure database permissions and password are correct, otherwise admire would not be able to connect to your database server. In other words, create an admin user for admirer as follows (again type these on on your mysql/mariadb server). The syntax is:

## IF ADMINER/Apache server IP IS, THEN CREATE log IN USER named vivek ##
CREATE USER 'vivek'@'' IDENTIFIED BY 'Super_Secret_PassWord_Here';

Log in session

Installed Adminer on Ubuntu 20.04 and Logged in using vivek user
Adminer in action


In this tutorial, you learned how to install Adminer on Ubuntu 20.04 LTS Linux server. I strongly suggest that you run Adminer over HTTPS-based session (see “How To Secure Apache with mod_md Let’s Encrypt on Ubuntu 20.04 LTS“) and password protect your domain or /adminer/ URL for security reasons. See Adminer website here for more info.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.


Leave a Comment