How To Install MongoDB on Fedora 38
In this tutorial, we will show you how to install MongoDB on Fedora 38. Are you looking to install MongoDB on your Fedora 38 system but don’t know where to start? Look no further! In this comprehensive guide, we will walk you through the step-by-step process to install and configure MongoDB on your Fedora 38 machine. MongoDB is a popular NoSQL database that provides high scalability and flexibility for managing unstructured data, making it an ideal choice for modern applications. With this guide, you’ll have a fully functional MongoDB setup up and running in no time. We’ll cover all the prerequisites, the installation process, and the necessary configurations to get MongoDB up and running on your Fedora 38 system. So, let’s dive in and get started!
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the MongoDB database on a Fedora 38.
Prerequisites
- A server running one of the following operating systems: Fedora 38.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for MongoDB.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install MongoDB on Fedora 38
Step 1. Before proceeding, update your Fedora operating system to make sure all existing packages are up to date. Use this command to update the server packages:
sudo dnf upgrade sudo dnf update
Step 2. Installing MongoDB on Fedora 38.
Now add the MongoDB repository to your system using the following command:
nano /etc/yum.repos.d/mongodb-org.repo
Add the below files:
[mongodb-org-6.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
Next, update packages and install the latest stable version of MongoDB using the following command:
sudo dnf update sudo dnf install mongodb-org
Once installation is complete we need to start the MongoDB server to start operating. We do that with the following command below:
sudo systemctl start mongod sudo systemctl enable mongod
Step 3. Configure MongoDB.
Now that you have MongoDB installed on your Fedora 38 system, it’s time to configure it. open the MongoDB configuration file using the following command:
nano /etc/mongod.conf
Locate the bind IP parameter and change its value to 0.0.0.0. This will allow MongoDB to listen to all IP addresses on the system.
Save the changes and exit the file, then restart the MongoDB service using the following command:
sudo systemctl restart mongod
Step 4. Configure Firewall.
If you have an active firewalld service on your server and would like MongoDB service to be accessible over the network, allow port 27017/tcp:
sudo firewall-cmd --add-port=27017/tcp --permanent sudo firewall-cmd --reload
Congratulations! You have successfully installed MongoDB. Thanks for using this tutorial for installing the MongoDB database on your Fedora 38 system. For additional help or useful information, we recommend you check the official MongoDB website.