The first steps of compiling Mongo DB is to make sure that your database is situated in a server that is totally different from your application server and that the database is connections are encrypted. You will realize that you have to create your own SSL support since the prebuild MongoDB does not come with it.
Another crucial bit is that MongoDB you select a 64-Bit when creating your droplet. Even though MongoDB still runs very well on a 32-bit the catch being that is only limited to 2GB storage.
Step 1: Updating the packages
Make sure that all the packages are up to date and this can be done by logging into the root make sure that everything is updated. If this is the first time doing this, then you will have to pick the install package maintainer version.
Step 2: Installing the necessary pre-requisites
There are a few packages that will need to be installed before compiling MongoDB and this can be done with a simple command. Some of the packages required are:
o the Ubuntu packages that are essential for programs that are necessary for building software also known as the build-essential.
o Other packages that will be needed are the scons, libssl-dev, git-core, and portable C++ sources libraries.
Step 3: Reducing the size of the Droplet
As we are aware that compiling MongoDB is very intense when it comes to resource and takes too much of the time the process has to speed up by resizing the droplet temporary.
Step 4: Source of the MongoDB
This is basically getting the source of the MongoDB and that can be done by using GIT to download the code for it.
Step 5: Version to Install
After we have downloaded the source of the MongoDB, it is time that we choose which version that is needed to be compiled and installed. After typing in the command you will get a list of a version of MongoDB and the best way to select the best version is picking the highest numbered version.
Step 6: Compiling and installing
Compiling multiple codes at the same time is the best way to ensure that you speed up the compilation process.
Step 7: Running the Script
This has to be done by making the script executable. This is the best practice as we are aware that database runs under its own account.
Step 8: Ensuring Upstart works
It is important for MongoDB to always start automatically when your computer boot and this is made possible by the upstart program.
Step 9: Rotation Config
This is the process of making sure that the log files are automatically archived. This will enable the MongoDB log files do not get out of control and this is well done by configuring the program logrotate by using Nano to edit the configuration file.