How to Install Adminer on Ubuntu 20.04

Updated on March 30, 2022
How to Install Adminer on Ubuntu 20.04 header image


Adminer is a graphical interface using PHP that allows access to many SQL database types. Adminer also offers the interface in many languages.

Server Prerequisites

Before following this guide, you need an Ubuntu server with PHP 8.1 and Nginx web server.

This article refers to the Adminer server as

MariaDB Install

  1. MariaDB is one of the most common database platforms. To install the latest version of MariaDB, update the repository by running:

     $ curl -LsS | sudo bash
  2. Install MariaDB, a drop-in replacement for MySQL.

     $ sudo apt install mariadb-server mariadb-client -y
  3. Enable MariaDB to start on boot.

     $ sudo systemctl enable mariadb.service
  4. Secure the database. Answer all the security questions as shown.

     $ sudo mysql_secure_installation
  5. The secure installer presents you with a series of questions. To ensure an optimal and secure database, answer them as follows:

    • Switch to unix_socket authentication [Y/n] Y
    • Change the root password? [Y/n] Y
    • Remove anonymous users? [Y/n] Y
    • Disallow root login remotely? [Y/n] Y
    • Remove test database and access to it? [Y/n] Y
    • Reload privilege tables now? [Y/n] Y

Install Adminer

Adminer is a single file. To install it, create a directory and then download the latest version locally with wget:

$ mkdir /var/www/html/adminer
$ wget -O /var/www/html/adminer/index.php

Navigate to the login page for your server. For example:

Log in with your MariaDB credentials.

Secure Adminer

The Adminer page requires a username and password to gain database access but is still available for the entire world to see. To secure the site, restrict access by IP address. You can edit the Nginx config or use the Vultr Firewall.

To restrict access to the Adminer page through the Nginx config:

  1. Find your Nginx config file in /etc/nginx/sites-enabled/.

     $ ls -l /etc/nginx/sites-enabled/
  2. For example, your file might be demoweb.conf. Open it with an editor.

     $ sudo nano /etc/nginx/sites-available/demoweb.conf
  3. In the server block, add lines with the IP addresses you want to allow access to the Adminer page. The address can be a single IP address or a CIDR block.

    Each line is in the format allow IP_ADDRESS. The last line denies all other IP addresses.

     location /adminer {
        deny all;

    The example configuration above allows access from the IP address and the range from through You can use the Vultr IP Address calculator to find CIDR blocks.

  4. Save and exit the file.

  5. Test the configuration and restart Nginx:

     # nginx -t
     # service nginx restart


Adminer is a lightweight graphical administrative tool for many databases. To learn more about Adminer, PHP, and how to restrict access by IP address in Nginx, please see these resources: