What is DevRel? | What is Developer Relations ?
A to Z Full Forms and Acronyms

 How to Install MongoDB in your host web application Azure VM

Jun 24, 2021 Azure, VM, MongoDB, Web, Application, 4057 Views
In This Article, we'll discuss How to Install MongoDB in your host web application VM

Install MongoDB

Many applications require a database. Here you'll install MongoDB, the "M" in the MEAN stack. It's a popular NoSQL database solution that's free and open source. A NoSQL database doesn't require data to be structured in a pre-defined way as it would with a relational database like SQL Server or MySQL.

MongoDB stores its data in JSON-like documents that don't require rigid data structures. You interact with MongoDB using queries and commands sent using JavaScript Object Notation, or JSON.

What MongoDB editions are available?

MongoDB provides two editions:

  • MongoDB Community Server
  • MongoDB Enterprise Server

Here you'll install MongoDB Community Server. Later, you'll use MongoDB to store information about books.

How do I install MongoDB?

You can install MongoDB on Linux, macOS, and Windows. For learning purposes, here you'll install MongoDB on Ubuntu using Ubuntu's apt package manager.

The installation process varies depending on your operating system. If you're not familiar with Ubuntu, you can still follow along to get a sense of how things work.

Install MongoDB

Here you'll install MongoDB with just a few commands. You'll work from the SSH connection to the Ubuntu VM that you created in the previous unit.

  1. First, we'll make sure all current packages are up to date.

    Bash
    sudo apt update && sudo apt upgrade -y
    

     Note

    The sudo part means that we want to run the command with administrative privileges.

  2. Install the MongoDB package.

    Bash
    sudo apt-get install -y mongodb
    
  3. Once the installation completes, the service should automatically startup. Let's confirm this by running this command.

    Bash
    sudo systemctl status mongodb
    

    You should see the service running.

    Output
    azureuser@MeanStack:~$ sudo systemctl status mongodb
    ● mongodb.service - An object/document-oriented database
      Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset: enabled)
      Active: active (running) since Thu 2019-08-22 16:46:30 UTC; 9s ago
        Docs: man:mongod(1)
    Main PID: 18360 (mongod)
      CGroup: /system.slice/mongodb.service
              └─18360 /usr/bin/mongod --config /etc/mongodb.conf
    
    Aug 22 16:46:30 MeanStack systemd[1]: Started An object/document-oriented database.
    
  4. Run mongod --version to verify the installation.

    Bash
    mongod --version
    
A to Z Full Forms and Acronyms
Nitin Pandit

Nitin Pandit

With over 10 years of vast development experience with different technologies, Nitin Pandit is Microsoft certified Most Valued Professional (Microsoft MVP) with a rich skillset that includes developing and managing IT/Web-based applications in different technologies, such as – C#.NET, ADO.NET, LINQ to SQL, WCF, and ASP.NET 2.0/3.x/4.0, WCF, WPF, MVC 5.0 (Razor), and Silverlight, along with client-side programming techniques, like jQuery and AngularJS. Nitin possesses a Master’s degree in Computer Science and has been actively contributing to the development community for its betterment. He has written more than 100 blogs/articles and 3 eBooks on different technologies to help improve the knowledge of young technology professionals. He has trained more than one lakh students and professionals, as a speaker in workshops and AppFests, conducted in more than 25 universities in North India.

Related Article

Cookies.

By using this website, you automatically accept that we use cookies. What for?

Understood