How to install MongoDB GUI admin in AlmaLinux

March 31, 2022 0 Comments

Need an easy-to-use GUI to help you manage your MongoDB databases? Jack Wallen shows you how to install an administrator just for that purpose.

Computer with operating system Linux
Photo: mtmmarek / Adobe Stock

MongoDB is a NoSQL database that is a great option for those who need to store large amounts of data for highly accessible, scalable applications and services. Out of the box, MongoDB is run entirely from the command line. For some database administrators, this is a great option but for those who prefer GUI tools for taking care of database management, where do you go for this document-based platform?

Views: You need to know the 40+ terms of open source and Linux (TekriPublic Premium)

An alternative is admin, which, like phpMyAdmin, is a simple graphical interface for managing databases. The admin does not have the most advanced looking UI, but it does make working with your MongoDB database much easier.

I want to show you how easy it is to create an admin and run it in AlmaLinux.

What you will need

All you need to install the administrator on AlmaLinux is a user with a running example of the operating system and the sudo feature.

How to install MongoDB

If MongoDB is not already installed in your AlmaLinux instance, let’s do it now. Log in to your server and create a new storage file with:

sudo nano /etc/yum.repos.d/mongodb.repo

In that file, paste the following:

[mongodb-org-4.4]

name=MongoDB Repository

baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/

gpgcheck=1

enabled=1

gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

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 are now ready to install the administrator

How to install admin

First, we will add the necessary dependencies to 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 MariaDB installation with the command:

sudo secure_mysql_installation

Be sure to set a new password for the administrator user and then answer Y for 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.

Allow the necessary permissions with:

GRANT ALL ON adminer.* TO 'adminer'@'localhost';

Flash permissions and exit Database Console with:

FLUSH PRIVILEGES;

exit

How to download and configure admin

Create a new directory for administrators with the command:

sudo mkdir /var/www/html/adminer

Make changes to the newly created directory with:

cd /var/www/html/adminer

Download admin with:

sudo wget -O index.php https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php

Be sure to visit the admin site to check if you have downloaded the latest version.

Appropriate permission to the directory 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:

<VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot /var/www/html/adminer/

ServerName adminer.exampledomain.com

DirectoryIndex index.php

ErrorLog /var/log/httpd/adminer-error.log

CustomLog /var/log/httpd/adminer-access.log combined

</VirtualHost>

Restart Apache with:

sudo systemctl restart httpd

How to access admin

Open a web browser and point it to http: // SERVER (where SERVER is the IP address or domain of the hosting server). You will be given a login screen (Figure A)

Figure A

Admin login screen.
Admin login screen.

You will use the certificate and database name you created earlier, so the administrator for the user, the password you created, and the administrator for the database name. Once you’ve logged in, you’ll see the main window that lets you manage that database (Figure B)

Figure B

The admin main window makes it easy to manage your database.
The admin main window makes it easy to manage your database.

And this is what AlmaLinux has to do with installing the admin MongoDB GUI application. It won’t take long for you to become comfortable using this tool.

Subscribe to TechRepublic How to do tech work on youtube From Jack Wallen to Business Professionals for all the latest technology advice.

Leave a Reply

Your email address will not be published.