Install MongoDB on Fedora 24
The steps to install MongoDB on Fedora 24 is pretty simple.
First, login to the server as root user.
Then, we should add the repository to download the package. Open a new repo file ‘mongodb.repo’ using below command.
Option A: If you are running a 64-bit system, add the following information to the file you’ve created, using i to insert:
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
Then exit and save the file with the command :wq.
Option B: If you are running a 32-bit system, add the following information to the file you’ve created, using i to insert:
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/
gpgcheck=0
enabled=1
Then exit and save the file with the command :wq .
Once you have done this, installing MongoDB is now one command away.
Now you should get output similar to below. When rompted with Y / n, enter yes or y to download and install the package
Transaction Summary Total size: 110 M
Last metadata expiration check: 0:00:17 ago on Thu Aug 4 19:34:04 2016.
Dependencies resolved.
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Installing:
mongodb-org x86_64 2.6.12-1 mongodb 4.6 k
mongodb-org-mongos x86_64 2.6.12-1 mongodb 6.9 M
mongodb-org-server x86_64 2.6.12-1 mongodb 9.1 M
mongodb-org-shell x86_64 2.6.12-1 mongodb 4.3 M
mongodb-org-tools x86_64 2.6.12-1 mongodb 90 M
======================================================================================================================================================
Install 5 Packages
Installed size: 279 M
Is this ok [y/N]:
Once installed,
Start-Up MongoDB
Check MongoDB Service Status
Start the MongoDB Service at Boot
Summary List of Status Statistics (Continuous)
Summary List of Status Statistics (5 Rows, Summarized Every 2 Seconds)
Enter the MongoDB Command Line
By default, running this command will look for a MongoDB server listening on port 27017 on the localhost interface.
If you’d like to connect to a MongoDB server running on a different port, then use the –port option. For example, if you wanted to connect to a local MongoDB server listening on port 23456, then you’d issue the following command:
To get the latest mongodb
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.4/x86_64/
Thankyou 🙂 Will test an installation and update the blog shortly
Hi,
Thank you for the great tutorial !!! systemctl start mongod this is what i been looking for two days….Good luck sir!
Glad to know this blog helped 🙂
Hi peopleI actually I’ll , I’m not really a devops sort of bloke but I’m trying to upgrade from mongDB 3.2 to 3.4 but when I run the yum command after updating the config to get the latest mongodb (Thanks Bob Otter, much appreciated) I get the message that essentially I need to run yum with –best –erasing to force the ugrade.
This clearly says erase the old Mongo and install the new version.
I have people that depend upon the database so you can appreciate I feel a little concerned about running the command. Is my concern justified or is it just a formality?
If anyone can give any advice I would be eternally grateful.
Hi Martin
The steps in this blog is to be followed when doing a fresh installation. I can see that you are upgrading from 3.2 to 3.4. In that case, it is nessessary to follow the below preliminary steps first.
1) Ensure you have an up-to-date backup of your data set. See https://docs.mongodb.com/manual/core/backups/
2) Consult the following documents for any special considerations or compatibility issues specific to your MongoDB release:
https://docs.mongodb.com/manual/release-notes/
Then you would need to upgrade the revision by updating drivers, clusters and instances. Official documentation here: https://docs.mongodb.com/manual/tutorial/upgrade-revision/
I will cover this as a seperate blog shortly. In the meantime, let me know if you are stuck anywhere and I will help you through.