If your company is in the business of using, handling or depending on data, chances are you’re in need of a document-oriented, NoSQL database. If you’re unfamiliar with the term, a NoSQL database is a non-relational database that doesn’t use tables filled with rows and columns. Instead, they make use of a storage model that is optimized specifically for the data.
These types of databases offer scalability, flexibility, data distribution, and speed of processing that relational databases can’t match.
One NoSQL database is MongoDB. This database has been adopted by big data and enterprise companies including Adobe, Craigslist, eBay, FIFA, Foursquare, and LinkedIn. MongoDB comes in both an enterprise and community edition. I’ll be demonstrating with the open-source community edition, installing it on Ubuntu Server 18.04.
This edition can be installed from the standard repositories, however, that will likely install an outdated version. Because of that, I’ll show how to deploy a version from the official MongoDB repository. This will install:
- mongodb-org (this is the meta-package that will install everything below)
- mongodb-org-server (the mongod daemon)
- mongodb-org-mongos (the mongos daemon)
- mongodb-org-shell (the mongo shell)
- mongodb-org-tools (the MongoDB tools package which includes import, dump, export, files, performance, restore, and stats tools)
Do note that this package only supports 64-bit architecture and LTS (Long Term Support) versions of Ubuntu (so 14.04, 16.04, and 18.04).
Once installed, your Java development company (or whatever sector your business serves) can begin developing for big data.
When installing a major application/service, it’s always best to first run an update/upgrade on the server. Not only will this ensure you have the most recent software, but it’ll also apply any security patches. Do note, however, should the kernel be updated in this process, you will need to reboot the machine before the updates take effect.
To update and upgrade Ubuntu, log into the server and issue the following two commands:
sudo apt-get update
sudo apt-get upgrade -y
Once up the update and upgrade completes, reboot your server (if required). You are now ready to install MongoDB, and you won’t even need to bring in your Java developers to take care of this task.
Adding the Repository
The first thing to be done is the addition of the necessary MongoDB repository. To do this, log into your Ubuntu server. From the command line, add the required MongoDB key with the command:
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
If you see an error regarding the wget command, install that tool with:
sudo apt-get install wget
Once you’ve added the key, create a new apt source list file with the command:
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu
This article was written by Editorial Staff and originally published on WPArena.