Install MongoDB Enterprise on SUSE Using .tgz Tarball

Overview

Although the recommended procedure to install is through thepackage manager, you can alsoinstall by directly downloading the .tgz file. The followingtutorial downloads the .tgz tarball directly to install MongoDB4.2 Enterprise Edition on SUSE Linux Enterprise Server12. MongoDB Enterprise is available on select platforms and containssupport for several features related to security and monitoring.

Production Notes

Before deploying MongoDB in a production environment, consider theProduction Notes document.

Platform Support

MongoDB only provides Enterprise packages for 64-bit builds of SUSEEnterprise Linux version 12.

This installation guide only supports 64-bit systems. SeeSupported Platforms for more information.

Considerations

Use the provided distribution packages as described in this page if possible.These packages will automatically install all of MongoDB’s dependencies, and arethe recommended installation method.

Note

SUSE Linux Enterprise Server and potentially other SUSE distributions shipwith virtual memory address space limited to 8 GB by default. You _must_adjust this in order to prevent virtual memory allocation failures as thedatabase grows.

The SLES packages for MongoDB automatically adjust these limits intheir default init script. If you are starting MongoDB manually withoutthe provided init script, are using your own custom init script, orare using the TGZ tarball release, you must make these changesyourself.

Install MongoDB Enterprise

Note

To install a different version of MongoDB, please refer to thatversion’s documentation. To install the previous version, seethe tutorial for version 4.0.

Prerequisites

MongoDB .tar.gz tarballs require installing the followingdependencies:

  1. zypper install cyrus-sasl cyrus-sasl-plain cyrus-sasl-gssapi krb5 libcurl4 libldap-2_4-2 libopenssl1_0_0 libsensors4 libsnmp30 libpcap1 libwrap0

Procedure

Download the MongoDB Enterprise .tar.gz tarball.

After you have installed the required prerequisite packages, downloadthe MongoDB Enterprise tarball for your system from theMongoDB Download Center.

Extract the files from the downloaded archive.

For example, from a system shell, you can extract using the tar command:

  1. tar -zxvf mongodb-linux-*-4.2.1.tgz

Ensure the binaries are in a directory listed in your PATH environment variable.

The MongoDB binaries are in the bin/ directory of the tarball.You can either:

  • Copy the binaries into a directory listed in your PATHvariable, such as /usr/local/bin (Update/path/to/the/mongodb-directory/ with your installationdirectory as appropriate)
  1. sudo cp /path/to/the/mongodb-directory/bin/* /usr/local/bin/
  • Create symbolic links to the binaries from a directory listed inyour PATH variable, such as /usr/local/bin (Update/path/to/the/mongodb-directory/ with your installationdirectory as appropriate):
  1. sudo ln -s /path/to/the/mongodb-directory/bin/* /usr/local/bin/

Run MongoDB Enterprise

Prerequisites

By default, MongoDB instance stores:

  • its data files in /var/lib/mongo
  • its log files in /var/log/mongodb

If you installed via the package manager, the directories are createdduring the installation.

If you installed manually by downloading the tarballs, you can createthe directories using mkdir -p <directory> or sudo mkdir -p<directory> depending on the user that will run MongoDB. (See yourlinux man pages for information on mkdir and sudo.)

By default, MongoDB runs using the mongod user account. If youchange the user that runs the MongoDB process, you must also modifythe permission to the /var/lib/mongo and /var/log/mongodbdirectories to give this user access to these directories.

To specify a different log file directory and data file directory, editthe systemLog.path and storage.dbPath settings inthe /etc/mongod.conf. Ensure that the user running MongoDB hasaccess to these directories.

Most Unix-like operating systems limit the system resources that asession may use. These limits may negatively impact MongoDB operation.See UNIX ulimit Settings for more information.

Procedure

Create the data and log directories.

Note

Depending on user permissions, you may need to sudo mkdir -p<directory> instead of mkdir -p <directory>. Use or omitsudo as appropriate. See your linux man pages for informationon mkdir and sudo.

Create a directory where the MongoDB instance stores its data. Forexample:

  1. sudo mkdir -p /var/lib/mongo

Create a directory where the MongoDB instance stores its log. For example:

  1. sudo mkdir -p /var/log/mongodb

The user that starts the MongoDB process must have read and writepermission to these directories. For example, if you intend to runMongoDB as yourself:

  1. sudo chown `whoami` /var/lib/mongo # Or substitute another user
  2. sudo chown `whoami` /var/log/mongodb # Or substitute another user

Run MongoDB.

To run MongoDB, run the mongod process at the system prompt.

  1. mongod --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log --fork

For details on the command-line options —dbpath and —logpath, seeOptions.

Verify that MongoDB has started successfully.

Verify that MongoDB has started successfully bychecking the process output for the following line in thelog file /var/log/mongodb/mongod.log:

  1. [initandlisten] waiting for connections on port 27017

You may see non-critical warnings in the processoutput. As long as you see the log line shown above, you can safelyignore these warnings during your initial evaluation of MongoDB.

Begin using MongoDB.

Start a mongo shell on the same host machine as themongod. You can run the mongo shellwithout any command-line options to connect to amongod that is running on your localhost with defaultport 27017:

  1. mongo

For more information on connecting using the mongoshell, such as to connect to a mongod instance runningon a different host and/or port, see The mongo Shell.

To help you start using MongoDB, MongoDB provides GettingStarted Guides in various driver editions. SeeGetting Started for the available editions.