Install Adminer on AlmaLinux 9: Best GUI DB Manager

Posted on

Install Adminer on AlmaLinux 9: Best GUI DB Manager

In this guide, you will learn to Install Adminer on AlmaLinux 9 with LAMP Stack (Apache, MariaDB, PHP). Adminer is a GUI database management tool. The amazing feature of this tool is that it supports all the databases such as PostgreSQL, SQLite, MySQL, MariaDB, Oracle, etc. Now you can follow the steps below to start your Install Adminer on AlmaLinux 9 installation.

To complete this guide, you must have access to your server as a non-root user with sudo privileges. To do this, you can follow a guide on Initial Server Setup with AlmaLinux 9.

Because we want to install Adminer with LAMP Stack, you need to have it on your server. For this purpose, you can follow a guide on Install LAMP Stack on AlmaLinux 9.

Also, you need a domain name that is pointed to your server’s IP address.

When you are done, follow the steps below to complete your Install Adminer on AlmaLinux 9 installation and access the Adminer default login screen.

Step 1 – Set Adminer Root Database Password

At this point, you need to log in to your MariaDB shell and set a root database password for your Adminer. Log in to your MariaDB shell with the command below:

sudo mysql -u root -p

Then, set the password for the root user with the command below:

MariaDB [(none)]> SET PASSWORD FOR 'root'@'localhost' = PASSWORD("password");

Next, flush the privileges and exit from the MariaDB shell by using the following commands:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Step 2 – Install Adminer on AlmaLinux 9

At this point, you need to visit the GitHub release page for Adminer and get the latest package.

First, create a directory for Adminer under the /var/www/html directory with the command below:

mkdir /var/www/html/adminer

Then, switch to your Adminer directory and use the following command to download the latest Adminer package on AlmaLinux 9; we downloaded the file as index.php:

# cd /var/www/html/adminer
# sudo wget -O index.php https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php

When your download is completed, set the correct permission and ownership for the file with the commands below:

# sudo chown -R apache:apache /var/www/html/adminer/
# sudo chmod -R 775 /var/www/html/adminer/

Step 3 – Configure Apache for Adminer

At this point, you need to create an Apache virtual host file for Adminer on AlmaLinux 9. To do this, you can use the following command:

sudo vi /etc/httpd/conf.d/adminer.conf

Add the following content to the file:

<VirtualHost *:80>
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/adminer/
     ServerName example.com
     DirectoryIndex index.php
     ErrorLog /var/log/httpd/adminer-error.log
     CustomLog /var/log/httpd/adminer-access.log combined

</VirtualHost>

When you are done, save and close the file.

Finally, restart Apache to apply the changes:

sudo systemctl restart httpd

Step 4 – How To Access Adminer Dashboard?

At this point, you can access your Adminer web interface by typing your domain name or IP address in your web browser followed by index.php:

http://domain-name/index.php

You will see the Adminer default login screen. You should enter the root as the username and the password that you have configured for the Adminer on AlmaLinux 9.

Adminer Login Screen

After login, you will have the Dashboard to access all the available databases.

From there, you can delete or create a database, etc.

Conclusion

Adminer is a GUI database management tool that is simple, easy to navigate, understandable, and not confusing. You have learned to Install the Latest Adminer on AlmaLinux 9 and access your Adminer Web GUI. Hope you enjoy it.

Alternative Solutions for Installing Adminer on AlmaLinux 9

While the above method provides a straightforward way to Install Adminer on AlmaLinux 9, there are alternative approaches that might be preferable depending on your specific needs and server setup. Here are two alternative solutions:

1. Using Docker:

Docker offers a containerized environment, which can simplify the deployment and management of applications like Adminer. This approach eliminates the need to manually configure Apache virtual hosts and handle file permissions.

  • Explanation: Docker containers provide isolated environments for applications, including all necessary dependencies. This eliminates conflicts and ensures consistency across different systems. Using a pre-built Adminer Docker image is a quick and easy way to get Adminer running.

  • Steps:

    1. Install Docker: If Docker isn’t already installed, install it using the official Docker documentation for AlmaLinux.

    2. Pull the Adminer Image: Use the following command to pull the official Adminer image from Docker Hub:

      sudo docker pull adminer
    3. Run the Adminer Container: Run the container, mapping port 8080 on the host machine to port 8080 inside the container (the default port Adminer listens on). You also need to link the container to your MariaDB instance. Replace <your_mariadb_container_name> with the actual name of your MariaDB container if you’re also running MariaDB in Docker; otherwise, use the host’s IP address and port.

      sudo docker run -d --name my-adminer -p 8080:8080 --link <your_mariadb_container_name>:db adminer

      If MariaDB is not in docker, try this instead. replace with the actual ip.

      sudo docker run -d --name my-adminer -p 8080:8080 adminer  ADMINER_DEFAULT_SERVER=<your_mariadb_host_ip>
    4. Access Adminer: Open your web browser and navigate to http://your_server_ip:8080. You should see the Adminer login screen.

  • Advantages: Simplified deployment, isolation, and portability.

  • Disadvantages: Requires Docker knowledge and overhead.

2. Using Nginx as a Reverse Proxy (Instead of Apache):

If you are already using Nginx as your web server, you can configure it as a reverse proxy to serve Adminer. This eliminates the need to install and configure Apache.

  • Explanation: Nginx can be configured to forward requests for a specific URL (e.g., /adminer) to the Adminer PHP file. This way, you don’t need a separate virtual host.

  • Steps:

    1. Download Adminer: Download the Adminer PHP file as described in the original article and place it in a directory accessible to Nginx (e.g., /var/www/adminer). Make sure Nginx user (usually nginx) has read access to this directory.

    2. Configure Nginx: Edit your Nginx configuration file (usually /etc/nginx/nginx.conf or /etc/nginx/conf.d/default.conf). Add a location block to proxy requests to the Adminer PHP file.

      location /adminer {
          alias /var/www/adminer/;  #Adjust the path if needed
          index index.php;
      
          location ~ .php$ {
              include /etc/nginx/fastcgi_params;
              fastcgi_pass unix:/run/php-fpm/www.sock; # Adjust this line depending on your PHP-FPM setup
              fastcgi_index index.php;
              fastcgi_param SCRIPT_FILENAME $request_filename;
          }
      }
    3. Restart Nginx: Restart the Nginx service to apply the changes:

      sudo systemctl restart nginx
    4. Access Adminer: Open your web browser and navigate to http://your_domain_name/adminer.

  • Advantages: Uses existing Nginx infrastructure, avoids Apache dependency.

  • Disadvantages: Requires Nginx configuration knowledge.

These alternative methods offer different ways to achieve the same goal: making Adminer accessible on your AlmaLinux 9 server. Choosing the best option depends on your existing infrastructure and comfort level with different technologies. No matter which method you choose, having a GUI database manager like Adminer can greatly simplify database administration tasks. These different methods for Install Adminer on AlmaLinux 9 all offer different approaches to the same end.