On this page
Install MongoDB Community Edition on SUSE
On this page
Overview
Use this tutorial to install MongoDB 3.6 Community Edition on SUSE Linux Enterprise Server (SLES) using the zypper
package manager.
Considerations
Platform Support
MongoDB 3.6 Community Edition supports the following 64-bit SUSE Linux Enterprise Server (SLES) release on x86_64 architecture:
- SLES 12
MongoDB only supports the 64-bit version of this platform.
See Supported Platforms for more information.
Windows Subsystem for Linux (WSL) - Unsupported
MongoDB does not support the Windows Subsystem for Linux (WSL).
Production Notes
Before deploying MongoDB in a production environment, consider the Production Notes document which offers performance considerations and configuration recommendations for production MongoDB deployments.
Install MongoDB Community Edition
Follow these steps to install MongoDB Community Edition using the zypper
package manager.
Configure the package management system (zypper
).
Add the repository so that you can install MongoDB using zypper
.
Changed in version 3.0: MongoDB Linux packages are in a new repository beginning with 3.0.
For MongoDB 3.6
Run the command appropriate for your version of SUSE:
- SUSE 12
-
sudo zypper addrepo --gpgcheck "https://repo.mongodb.org/zypper/suse/12/mongodb-org/3.6/x86_64/" mongodb
For versions of MongoDB earlier than 3.6
To install MongoDB packages from a previous release series such as 3.4, you can specify the release series in the repository configuration.
For example, to restrict your SUSE 12 system to the 3.4 release series, use the following command:
sudo zypper addrepo --no-gpgcheck https://repo.mongodb.org/zypper/suse/12/mongodb-org/3.4/x86_64/ mongodb
Install the MongoDB packages.
To install the latest stable version of MongoDB, issue the following command:
sudo zypper -n install mongodb-org
To install a specific release of MongoDB, specify each component package individually and append the version number to the package name, as in the following example:
sudo zypper install mongodb-org-3.6.19 mongodb-org-server-3.6.19 mongodb-org-shell-3.6.19 mongodb-org-mongos-3.6.19 mongodb-org-tools-3.6.19
You can specify any available version of MongoDB. However zypper
will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the packages by running the following command:
sudo zypper addlock mongodb-org-3.6.19 mongodb-org-server-3.6.19 mongodb-org-shell-3.6.19 mongodb-org-mongos-3.6.19 mongodb-org-tools-3.6.19
Previous versions of MongoDB packages use a different repository location. Refer to the version of the documentation appropriate for your MongoDB version.
Run MongoDB Community Edition
- ulimit Considerations
- Most Unix-like operating systems limit the system resources that a session may use. These limits may negatively impact MongoDB operation. See UNIX ulimit Settings for more information.
- Directories
-
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, these default directories are created during the installation.
If you installed manually by downloading the tarballs, you can create the directories using
mkdir -p <directory>
orsudo mkdir -p <directory>
depending on the user that will run MongoDB. (See your linux man pages for information onmkdir
andsudo
.)By default, MongoDB runs using the
mongod
user account. If you change the user that runs the MongoDB process, you must also modify the 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, edit the
systemLog.path
andstorage.dbPath
settings in the/etc/mongod.conf
. Ensure that the user running MongoDB has access to these directories. - its data files in
Procedure
Follow these steps to run MongoDB Community Edition. These instructions assume that you are using the default settings.
Init System
To run and manage your mongod
process, you will be using your operating system’s built-in init system. Recent versions of Linux tend to use systemd (which uses the systemctl
command), while older versions of Linux tend to use System V init (which uses the service
command).
If you are unsure which init system your platform uses, run the following command:
ps --no-headers -o comm 1
Then select the appropriate tab below based on the result:
systemd
- select the systemd (systemctl) tab below.init
- select the System V Init (service) tab below.
- systemd (systemctl)
- System V Init (service)
Start MongoDB.
You can start the mongod
process by issuing the following command:
sudo systemctl start mongod
If you receive an error similar to the following when starting mongod
:
Failed to start mongod.service: Unit mongod.service not found.
Run the following command first:
sudo systemctl daemon-reload
Then run the start command above again.
Verify that MongoDB has started successfully.
You can verify that the mongod
process has started successfully by issuing the following command:
sudo systemctl status mongod
You can optionally ensure that MongoDB will start following a system reboot by issuing the following command:
sudo systemctl enable mongod
Begin using MongoDB.
Start a mongo
shell on the same host machine as the mongod
. Use the --host
command line option to specify the localhost address and port that the mongod
listens on:
mongo --host 127.0.0.1:27017
Later, to stop MongoDB, press Control+C
in the terminal where the mongod
instance is running.