MongoDB is a NoSQL database that is a great option for those needing to store massive amounts of data for highly available, scalable applications and services. Out of the box, MongoDB is managed entirely from the command line. For some database admins, that’s a fine option but for those who prefer GUI tools to take care of database management, where do you turn for this document-based platform?
SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)
One option is Adminer, which is similar to phpMyAdmin in that it’s a simple graphical interface for administering databases. Adminer doesn’t have the most modern-looking UI, but it does make the task of working with your MongoDB databases considerably easier.
I want to show you how easy it is to get Adminer up and running on AlmaLinux.
What you’ll need
The only thing you’ll need to install Adminer on AlmaLinux is a running instance of the operating system and a user with sudo privileges.
How to install MongoDB
If your instance of AlmaLinux doesn’t already have MongoDB installed, let’s do that now. Log into your server and create a new repository file with:
sudo nano /etc/yum.repos.d/mongodb.repo
In that file, paste the following:
Save and close the file.
Install MongoDB with:
sudo dnf install mongodb-org -y
Start and enable the service with:
sudo systemctl enable --now mongod
You’re now ready to install Adminer.
How to install Adminer
First, we’ll add the necessary dependencies with the command:
dnf install httpd mariadb-server php php-mysqli php-curl php-json -y
Start and enable MariaDB with:
sudo systemctl enable --now mariadb
Secure the MariaDB installation with the command:
Make sure to set a new password for the admin user and then answer Y to the remaining questions.
Log in to the MariaDB console with:
sudo mysql -u root -p
Create a new database with:
CREATE DATABASE adminer;
Add a new user with the command:
CREATE USER 'adminer'@'localhost' IDENTIFIED BY 'PASSWORD';
Where PASSWORD is a strong/unique password.
Grant the necessary permissions with:
GRANT ALL ON adminer.* TO 'adminer'@'localhost';
Flush the permissions and exit from the database console with:
How to download and configure Adminer
Create a new directory to house Adminer with the command:
sudo mkdir /var/www/html/adminer
Change into that newly created directory with:
Download Adminer with:
sudo wget -O index.php https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php
Make sure to visit the Adminer site to check that you’ve downloaded the latest version.
Give the directory the proper permissions with the following commands:
sudo chown -R apache:apache /var/www/html/adminer/
sudo chmod -R 775 /var/www/html/adminer/
Next, we need to create an Apache configuration file with the command:
sudo nano /etc/httpd/conf.d/adminer.conf
In that file, paste the following:
CustomLog /var/log/httpd/adminer-access.log combined
Restart Apache with:
sudo systemctl restart httpd
How to access Adminer
Open a web browser and point it to http://SERVER (where SERVER is the IP address or domain of the hosting server). You’ll be presented with a login screen (Figure A).
You’ll use the credentials and database name we created earlier, so adminer for the user, the password you created, and adminer for the database name. Once you’ve logged in, you should see the main window that allows you to manage that database (Figure B).
And that’s all there is to installing the Adminer MongoDB GUI application on AlmaLinux. It shouldn’t take you much time to get comfortable with using this tool.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.