How to install the MongoDB GUI Adminer on AlmaLinux
Need a simple-to-use GUI to help manage your MongoDB databases? Jack Wallen shows you how to install Adminer for just that purpose.
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:
[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’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:
sudo secure_mysql_installation
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:
FLUSH PRIVILEGES;
exit
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:
cd /var/www/html/adminer
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:
<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 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).
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).
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.
For all the latest Technology News Click Here
For the latest news and updates, follow us on Google News.