Tech

How to Install MongoDB on macOS


Jack Wallen will guide you through simple steps to install NoSQL database, MongoDB, on macOS.

July 30, 2019 Palo Alto / CA / USA - MongoDB HQ in Silicon Valley;  MongoDB Inc.  is an American software company that develops and provides commercial support for the open source MongoDB
Image: Sundry Photography / Adobe Stock

For those who have tried, installing MongoDB on the latest Ubuntu 22.04 released is no headache. The reason for this is that Ubuntu no longer supports libssl1.1, which is still a requirement for MongoDB. I have been trying to install and run this powerful NoSQL database on Jammy Jellyfish but no luck. I can install it, but it always fails at start.

I also found it problematic to install MongoDB on AlmaLinux. So I switched to another operating system for my MongoDB needs: macOS. With macOS, getting MongoDB up and running is pretty straightforward, as long as you know how to use Homebrew.

Let me show you how.

UNDERSTAND: Recruitment Toolkit: Database Engineer (TechRepublic Premium)

What you need

The only thing you need to make this work is a macOS device. I’ll be demonstrating on a MacBook Pro. Be busy.

How to install Homebrew

The first thing you need to do is install Homebrew, which is a command-line package manager for macOS and a must-have for power users. To install Homebrew, log into your macOS device and open the terminal from Launchpad. With the terminal open, execute the following command:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

That installation will take some time to complete successfully.

How to install MongoDB

With Homebrew installed, we can now install MongoDB. We will be installing the latest version of the database server (v6). Before running the install command, we must first touch MongoDB with Homebrew, using the command:

brew tap mongodb / brew

Once the process is complete, we can install MongoDB with the command:

brew install [email protected]

Again, this command will take some time to complete. Once done, MongoDB is installed and ready to start.

How to start MongoDB

To start and enable the MongoDB server, issue the command:

brew service starts mongodb/brew/mongodb-community

To make sure the service is running, issue the command:

list of brewing services

You should see that the service has started successfully (Picture A).

Picture A

mongodb command line interface
Figure A: MongoDB is performing like a champ.

How to connect to MongoDB shell

To access the MongoDB shell, issue the command:

mongosh

Congratulations, you now have MongoDB 6.0 Community Edition running on macOS. Now you can start building your database for any project you have in mind.

Subscribe to TechRepublic’s How to make technology work on YouTube for all the latest tech advice for business professionals from Jack Wallen.



Source link

news7g

News7g: Update the world's latest breaking news online of the day, breaking news, politics, society today, international mainstream news .Updated news 24/7: Entertainment, Sports...at the World everyday world. Hot news, images, video clips that are updated quickly and reliably

Related Articles

Back to top button