How to install Adminer for Ubuntu 20.04 LTS

How to install the Adminer program on Ubuntu 20.04 LTS for Internet database management?

Adminer (formerly known as phpMinAdmin) is a free and open source database management tool. It’s written in PHP. Compared to phpMyAdmin, it is a light application with a high degree of security and user-friendliness. This tutorial describes the installation of Adminer on a Linux Ubuntu 20.04 LTS server for MySQL or MariaDB.

 

Procedure for installing an administrator on a Ubuntu Linux server 20.04

  1. Update the Ubuntu server where sudo apt & sudo apt update is running
  2. Make sure the Apache server is installed and configured in Ubuntu.
  3. Activate, execute the configuration: sudo a2 in adminconf
  4. Install the administrator by entering the sudo apt command install adminer

Of course, you will need to install Apache or another web server. Learn how to install Apache 2 on Ubuntu 20.04 LTS. Now that the Apache web server is installed and running, we get our hands dirty installing Adminer.

Administrator Installation

First you need to upgrade your system with the command apt/apt-get, then install Adminer:
sudo apt Upgrade
sudo apt Upgrade
sudo apt Administrator Installation
How to install Adminer for Ubuntu 20.04 LTS
Note: besides Apache PHP is needed to run Adminer. As a result apt has installed and configured PHP automatically. Other web servers require manual configuration. Use the cat command to check that the PHP 7.4 module is enabled:
a2query -m php7.4
php7.4 (enabled by the maintenance script)
cat /etc/apache2/mods-enabled/php7.4.{load,conf}
configuration files :

# Conflicts: php5
# Depends on: mpm_prefork
php7_module /usr/lib/apache2/modules/libphp7.4.so
<FilesMatch .+.ph(ar|p|tml)$>
SetHandler application/x-httpd-php

<FilesMatch .+.phps$>
SetHandler application/x-httpd-php source
# Disable access to raw php sources by default
# To enable it again, it is recommended to allow access to files
only on a specific virtual host or in the directory
# All

require # Disable access to files without filenames (e.g., “File”, “File”, “File”, “File”, “File”,” “File”, “File”,” “File”).(e.g. ‘.php’)
<FilesMatch ^.ph(ar|p|ps|tml)$>
Everyone should say no.

#
#
# To enable PHP in user folders again, DO NOT INSTALL the following lines
# (of .) in On, as these
# prevents .htaccess files from being disabled.

php_admin_flag motor Off

# Conflicts: php5
# Depends: mpm_prefork
LoadModule php7_module /usr/lib/apache2/modules/libphp7.4.so
<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 to .) Do NOT set it to On as it
# prevents .htaccess files from disabling it.

php_admin_flag engine Off

Administrative configuration

To activate the administration application, execute one of the following commands: a2enconf
sudo a2enconf adminer.conf
## OR ##
sudo a2enconf adminer
Outputs :

Activate Confederate Administrator.
To activate the new configuration, you must:
systemctl restart apache2.

All you have to do is restart the Apache 2 server, type:
sudo systemctl reboot apache2
The default configuration file is in /etc/apache2/conf-enabled/adminer.conf and can be accessed with the command cat:
cat /etc/apache2/conf-enabled/adminer.conf.

# Administrator on Ubuntu 20.04 #
alias /adminer /etc/adminer

Requires all
DirectoryIndex conf.php provided

# Adminer on Ubuntu 20.04 #
Alias /adminer /etc/adminer

Require all granted
DirectoryIndex conf.php

Test configuration

You can access the administration application using the following URL format:
https://your-server-name/adminer/
https://your-server-ip/adminer/
https://server1.cyberciti.biz/adminer/
How to install Adminer for Ubuntu 20.04 LTS
Now all you have to do is specify the database type (MySQl, PGSQL), server IP/hostname, database username/password and database name to log in and manage the database :
How to install Adminer for Ubuntu 20.04 LTS

Firewall configuration Note

Assuming that Apache/administrator is running on a host with an IP address of 10.105.28.9 and the database server is set to 172.16.3.1:3306, allow access with ufw (a command of the type on the mysql/mariadb server):
ufw allow access with 10.105.28.9 to 172.16.3.1 port 3306 proto tcp How to make ‘mysql access for Adminer/Apache IP’
Then you must make sure that the database access rights and password are correct, otherwise the admiration can not connect to your database server. In other words: Create an admin user for the ventilator as follows (to be entered on your mysql/mariadb server) The syntax is as follows:

Create the user admin’@’YOUR ADMINER SERVER IP identified by YOUR PASSWORD;
Set all personal information to *.* to admin’@’YOUR ADMINER SERVER IP with the option GRANT ;

## IF ADMINISTRATOR/Server Apache IP 10.105.28.9, CREATE A LOGIN USER named vivek ##
CREATE USER named vivek @’10.105.28.9IDENTIFIED Super_Secret_PassWord_Here;
GRANT ALL PRIVILEGES ON *.* to vivek ‘@’10.105.28.9 with GRANT OPTION;
RESTORE PRIVILEGES ;

CREATE USER ‘admin’@’YOUR-ADMINER-SERVER-IP’ IDENTIFIED BY ‘YOUR-PASSWORD’;
GRANT ALL PRIVILEGES ON *.* TO ‘admin’@’YOUR-ADMINER-SERVER-IP’ WITH GRANT OPTION;
## if ADMINER/Apache server IP is 10.105.28.9, then create log in user named vivek ##
CREATE USER ‘vivek’@’10.105.28.9’ IDENTIFIED BY ‘Super_Secret_PassWord_Here’;
GRANT ALL PRIVILEGES ON *.* TO ‘vivek’@’10.105.28.9’ WITH GRANT OPTION;
FLUSH PRIVILEGES;

Session recording

How to install Adminer for Ubuntu 20.04 LTS Administrator in action

Conclusion

In this tutorial you learned how to install Adminer on the Linux Ubuntu 20.04 server. I strongly advise the administrator to run an HTTPS session (see How to secure Apache with the Let’s Encrypt on Ubuntu 20.04 LTS mod_md) and secure your domain or /adminer/ URL with a password for security reasons. More information can be found here on the site of the administrator.

RECOMMENDATIONS

Published: Vivek gears

The author is the creator of nixCraft and an experienced system administrator, DevOps engineer and Linux/Unix shell script trainer. Receive the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly by email.