How to Install Adminer on Rocky Linux 8 or Alma Linux 8
If you’re running a lightweight database server and want a single‑file web GUI instead of the bloated phpMyAdmin, this is your quick guide for getting Adminer up and running on Rocky or Alma.
Pre‑install Checklist
1. Have PHP and a DB engine ready – Adminer needs PHP 7.2+ and either MySQL, MariaDB, PostgreSQL, SQLite, or MS SQL.
2. Make sure Apache/Nginx is serving files – The web server must be able to read your document root.
3. Turn off SELinux denial for HTTP content (or at least know how to fix it).
Step 1: Grab the Latest Adminer File
cd /tmp curl -L https://www.adminer.org/latest.php -o adminer.php
Adminer is just a single PHP file. Pulling the latest version guarantees you have the newest security fixes and feature set – older copies are a recipe for trouble.
Step 2: Move It Into Your Web Root
sudo mv adminer.php /var/www/html/adminer.php
Tip: If you want it under a sub‑directory, just change the target path (e.g., /var/www/html/db/adminer.php).
Step 3: Set Permissions Right
sudo chown root:apache /var/www/html/adminer.php sudo chmod 644 /var/www/html/adminer.php
The file must be readable by the web server user (often apache on Rocky/Alma). Giving it writable rights is a bad idea; that’s why we keep it at 644.
Step 4: Tell Apache or Nginx to Serve PHP
If you’re using Apache, make sure the mod_php module is enabled:
sudo dnf install php-fpm sudo systemctl enable --now php-fpm
Then, add a simple virtual host if you don’t already have one:
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName db.example.com
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
For Nginx, just point it at the same /var/www/html and make sure PHP‑FPM is in your location ~ \.php$ { … } block.
Step 5: Bypass SELinux Hiccups
I’ve seen this happen after a hard kernel upgrade: Adminer silently refused to load, throwing “Permission denied” errors. The fix was simple:
sudo chcon -t httpd_sys_content_t /var/www/html/adminer.php
If you prefer a permanent change, use semanage fcontext instead.
Step 6: Optional – Add Basic Auth
Adminer is great for quick debugging but not meant to be exposed publicly. Wrap it with HTTP basic auth:
sudo yum install httpd-tools sudo htpasswd -c /etc/httpd/.htpasswd admineruser
Then add an .htaccess next to adminer.php:
AuthType Basic AuthName "Restricted Adminer" AuthUserFile /etc/httpd/.htpasswd Require valid-user
Final Check
Open a browser and go to http://your-server/adminer.php. You should see the login screen for whatever database you have set up. If it asks for your DB credentials, you’re good.
That’s all there is to it—Adminer is a one‑file wonder that skips the whole “install, configure, tweak” mess of phpMyAdmin. Drop that single file in your web root, make sure PHP can read it, and you’re ready to manage databases on Rocky or Alma with minimal fuss.