Install MongoDB 6.0 on Fedora 36

Chukwuemeka Maduekwe
3 min readNov 10, 2022

--

Installing the latest version of MongoDB, currently version 6.0 on Fedora 36 was really an issue for me, having tried RedHat guide on Fedora with no sucess at all. This process is also intended for fresh install of Fedora and should work fine on older ones.

  1. Run a System Update on Fedora: This is actually a standard practice and shouldn’t take much of your time in any new installation for any Linux distribution. sudo dnf update
  2. Enable RPM Fusion (Free & Non-Free): Fedora only allows packages which follows certain standards as such, not all packages are available on the official repositories. RPM Fusion tries to solve this by providing most of these packages rejected by the official repo.
    > Free software: `sudo rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm`
    > Non-free software: `sudo rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm`
  3. Enable Fastest Mirror Plugin by running `fastestmirror=true`. Fastest mirror fetches the nearest mirror to your location.

### Once that’s done, we’re good to install MongoDB on our Fedora Machine

MongoDB Installation:

  1. Head to MongoDB Amazon Install and copy the code in the first step looking like this:
    [mongodb…
    name=MongoDB Repository
    baseurl=https://repo.mongodb.org/yum/amazon/...
    gpgcheck…
    enabled…
    gpgkey=https://www.mongodb.org/static/pgp...

    > The complete text can be found here, I don’t want to use the current one as it might be updated at any point. The ellipsis I used above shows continuation
  2. Open your terminal and run
    sudo vi /etc/yum.repos.d/mongodb.repo
    Click the ‘I’ key on your keyboard to insert
    ‘ctrl + shift + v’ > To paste code copied from MongoDB installation guide
    ‘esc’ > To exit insert mode
    ‘:wq’ > To write to file and exit
    If you get an error aftet ‘:wq’; enter `!sudo chmod 777 %`
    Press the enter key
    `:wq!`
  3. Now run sudo yum install -y mongodb-org -y
    If you get an error like this ‘conflicting requests’
    > Do this: dnf copr enable dioni21/compat-openssl10 then sudo yum install -y mongodb-org -y
  4. Start MongoDB: sudo systemctl start mongod
    If you receive an error similar to the following when starting mongod `Failed to start mongod.service: Unit mongod.service not found.` Run the following command first: sudo systemctl daemon-reload Then run the start command above again.
  5. Verify that MongoDB has started successfully. sudo systemctl status mongod
  6. You can optionally ensure that MongoDB will start following a system reboot by issuing the following command: sudo systemctl enable mongod
  7. Stop MongoDB: If you ever need to stop mongodb sudo systemctl stop mongod
  8. Restart MongoDB: You can restart the mongod process by issuing the following command sudo systemctl restart mongod
  9. To run mongodb in the terminal mongoshs

### Optional: Guide to install MongoDB Compass

Once that is done, you can proceed to also install compass, a tool I love

  1. Head to MongoDB Compass Installation
  2. Below ‘Select your operating system’ > choose ‘Linux’
  3. Select ‘.rpm’ above ‘Software Requirements’
  4. Now copy the code on #1 wget https://downloads.mongodb.com/compass/mongodb-compass-1.33.1.x86_64.rpm
  5. Once it’s done downloading, run sudo yum install mongodb-compass-1.33.1.x86_64.rpm and accept all options
  6. The downloaded fill won’t be deleted, you’ll have to use the explorer or terminal
  7. Now you can enjoy MongoDB and Compass.

More content at PlainEnglish.io.

Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and Discord.

--

--

No responses yet