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/app | Ubuntu Linux and Apache 2 with PHP |
Root privileges required | Yes |
Difficulty | Easy (rss) |
Estimated completion time | 10m |
Procedure to install Adminer on Ubuntu 20.04 Linux server
- Update your Ubuntu server running sudo apt update && sudo apt upgrade
- Make sure Apache server installed and configured on Ubuntu
- Install Adminer by typing the sudo apt install adminer command.
- Enable configuration, run: sudo a2enconf adminer
- 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
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/libphp7.4.so <FilesMatch ".+\.ph(ar|p|tml)$"> SetHandler application/x-httpd-php </FilesMatch> <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 </FilesMatch> # Deny access to files without filename (e.g. '.php') <FilesMatch "^\.ph(ar|p|ps|tml)$"> Require all denied </FilesMatch> # 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 </Directory> </IfModule>
Configuring Adminer
To activate adminer app run any one of the following a2enconf command
sudo a2enconf adminer.conf
## OR ##
sudo a2enconf adminer
Outputs:
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
</Directory>
Test the installation
You can access the Adminer app using the following URL format:
https://your-server-name/adminer/
https://your-server-ip/adminer/
https://server1.cyberciti.biz/adminer/
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:
A note about firewall configuration
Say Apache/adminer is running on the host having IP 10.105.28.9 address and database server is at 172.16.3.1:3306, then allow access using the ufw (type command on mysql/mariadb server):
sudo ufw allow from 10.105.28.9 to 172.16.3.1 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:
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;
Log in session
Adminer in action
Conclusion
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.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 1 comment... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hi
FYI: I see no reference to either MySQL or MariaDB being installed. Otherwise, thank you.