Configure the package Management system (
yum
).
Create a /etc/yum.repos.d/mongodb-org-3.2.repo
file so this you can install MongoDB directly, using yum
.
Changed in version 3.0:mongodb Linux packages is in a new repository beginning with 3.0.
For the
LatestStable release of MongoDB
Use the following repository file:
[mongodb-org-3.2] name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/$releasever/ mongodb-org/3.2/x86_64/Gpgcheck=1enabled=1gpgkey=https:// WWW.MONGODB.ORG/STATIC/PGP/SERVER-3.2.ASC
For versions of MongoDB
earlierthan 3.0
To install the packages from a earlier release series, such as 2.4 or 2.6, you can specify the release series in the Repo Sitory configuration. For example, to restrict your system to the 2.6 release series, create a file to hold the /etc/yum.repos.d/mongodb-org-2.6.repo
following configuration in Formation for the MongoDB 2.6 repository:
[mongodb-org-2.6] name=MongoDB 2.6 Repositorybaseurl=http://downloads-distro.mongodb.org/repo/redhat/os/ x86_64/Gpgcheck=0Enabled=1
You can find files for each release in the .repo
repository itself. Remember that odd-numbered minor release versions (e.g. 2.5) is development versions and is unsuitable for production us E.
2Install the MongoDB packages and associated tools.
When you install the packages, you choose whether to install the current release or a previous one. This step provides the commands for both.
To install the latest stable version of MongoDB, issue the following command:
sudo yum install-y 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 yum install-y mongodb-org-3.2.17 mongodb-org-server-3.2.17 mongodb-org-shell-3.2.17 mongodb-org-mongos-3.2.17 mongodb-org-tools-3.2.17
You can specify any available version of MongoDB. However would yum
upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin a package, add the following exclude
directive to your /etc/yum.conf
file:
Exclude=Mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
Install the MongoDB on Linux system