Installing MongoDB Under Linux

You’ve decided which version of MongoDB you would like to use, and you’ve downloaded it to your Home directory. Next, you need to extract the package with the following command:
$ tar xzf mongodb-linux-x86_64-latest.tgz

The preceding command extracts the entire contents of the package to a new directory called mongodb-linux-x86_64-xxxx-yy-zz; this directory is located under your current directory. This directory will contain a number of subdirectories and files. The directory that contains the executable files is called the bin directory. We will cover which applications perform which tasks shortly.

However, you don’t need to do anything further to install the application. Indeed, it doesn’t take much more time to install MongoDB manually—depending on what else you need to install, it might even be faster. Manually installing MongoDB does have some downsides, however. For example, the executables that you just extracted and found in the bin directory can’t be executed from anywhere except the bin directory by default. Thus, if you want to run the mongod service, you will need to do so directly from the aforementioned bin directory. This downside highlights one of the benefits of installing MongoDB through repositories.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: