Install MongoDB Enterprise Edition on SUSE
Overview
Use this tutorial to install MongoDB Enterprise on SUSE Linux EnterpriseServer (SLES) 12. MongoDB Enterprise is available on select platformsand contains support for several features related to security andmonitoring.
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 SUSELinux Enterprise Server (SLES) 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.
Import the MongoDB public key
- sudo rpm --import https://www.mongodb.org/static/pgp/server-4.2.asc
Configure the package management system (zypper).
Add the repository so that you can install MongoDB using zypper
.
Run the command appropriate for your version of SUSE:
- SUSE 12
- sudo zypper addrepo --gpgcheck "https://repo.mongodb.com/zypper/suse/12/mongodb-enterprise/4.2/x86_64/" mongodb
If you’d like to install MongoDB packages from a previous releaseseries such as 3.4, you canspecify the release series in the repository configuration. Forexample, to restrict your SUSE 12 system to the 3.4 release series,use the following command:
- sudo zypper addrepo --no-gpgcheck https://repo.mongodb.com/zypper/suse/12/mongodb-enterprise/3.4/x86_64/ mongodb
Install the MongoDB packages.
To install MongoDB 4.2, issue the followingcommand:
- sudo zypper -n install mongodb-enterprise
To install a specific release of MongoDB, specify eachcomponent package individually and append the version number to thepackage name, as in the following example:
- sudo zypper install mongodb-enterprise-4.2.1 mongodb-enterprise-server-4.2.1 mongodb-enterprise-shell-4.2.1 mongodb-enterprise-mongos-4.2.1 mongodb-enterprise-tools-4.2.1
You can specify any available version of MongoDB. However zypper
upgrades the packages when a newer version becomes available. Toprevent unintended upgrades, pin the packages by running the followingcommand:
- sudo zypper addlock mongodb-enterprise-4.2.1 mongodb-enterprise-server-4.2.1 mongodb-enterprise-shell-4.2.1 mongodb-enterprise-mongos-4.2.1 mongodb-enterprise-tools-4.2.1
Previous versions of MongoDB packages use a different repository location.Refer to the version of the documentation appropriate foryour MongoDB version.
See also
The recommended procedure to install is through the package manager,as detailed on this page. However, if you choose to install bydirectly downloading the .tgz
file, seeInstall MongoDB Enterprise on SUSE Using .tgz Tarball.
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/mongodb
directories 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
Start MongoDB.
You can start the mongod
process by issuing the followingcommand:
- sudo service mongod start
Verify that MongoDB has started successfully
You can verify that the mongod
process has startedsuccessfully by checking the contents of the log file at/var/log/mongodb/mongod.log
for a line reading
- [initandlisten] waiting for connections on port <port>
where <port>
is the port configured in /etc/mongod.conf
, 27017
by default.
You can optionally ensure that MongoDB will start following a systemreboot by issuing the following command:
- sudo chkconfig mongod on
Stop MongoDB.
As needed, you can stop the mongod
process by issuing thefollowing command:
- sudo service mongod stop
Restart MongoDB.
You can restart the mongod
process by issuing the followingcommand:
- sudo service mongod restart
You can follow the state of the process for errors or important messagesby watching the output in the /var/log/mongodb/mongod.log
file.
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:
- mongo
For more information on connecting using the mongo
shell, 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.
Uninstall MongoDB
To completely remove MongoDB from a system, you must remove the MongoDBapplications themselves, the configuration files, and any directories containingdata and logs. The following section guides you through the necessary steps.
Warning
This process will completely remove MongoDB, its configuration, and _all_databases. This process is not reversible, so ensure that all of yourconfiguration and data is backed up before proceeding.
Stop MongoDB.
Stop the mongod
process by issuing the following command:
- sudo service mongod stop
Remove Packages.
Remove any MongoDB packages that you had previously installed.
- sudo zypper remove $(rpm -qa | grep mongodb-enterprise)
Remove Data Directories.
Remove MongoDB databases and log files.
- sudo rm -r /var/log/mongodb
- sudo rm -r /var/lib/mongo
Additional Information
Packages
MongoDB provides officially supported Enterprise packages in their ownrepository. This repository contains the following packages:
Package Name | Description |
---|---|
mongodb-enterprise | A metapackage that will automatically installthe four component packages listed below. |
mongodb-enterprise-server | Contains the mongod daemon and associatedconfiguration and init scripts. |
mongodb-enterprise-mongos | Contains the mongos daemon. |
mongodb-enterprise-shell | Contains the mongo shell. |
mongodb-enterprise-tools | Contains the following MongoDB tools: mongoimport bsondump , mongodump , mongoexport ,mongofiles ,mongorestore , mongostat ,and mongotop . |