- 安装MongoDB >
- Install MongoDB Enterprise >
- Install MongoDB Enterprise on Ubuntu
Install MongoDB Enterprise on Ubuntu¶
概述¶
Use this tutorial to install MongoDB Enterprise on Ubuntu Linux systems. The tutorial uses .deb packages to install.
Packages¶
MongoDB provides packages of the officially supported MongoDB Enterprise builds in it’s own repository. This repository provides the MongoDB Enterprise distribution in the following packages:
mongodb-enterprise
This package is a metapackage that will automatically install the four component packages listed below.
mongodb-enterprise-server
This package contains the mongod daemon and associated configuration and init scripts.
mongodb-enterprise-mongos
This package contains the mongos daemon.
mongodb-enterprise-shell
This package contains the mongo shell.
mongodb-enterprise-tools
This package contains the following MongoDB tools: mongoimport bsondump, mongodump, mongoexport, mongofiles, mongoimport, mongooplog, mongoperf, mongorestore, mongostat, and mongotop.
Control Scripts¶
The mongodb-enterprise package includes various control scripts, including the init script /etc/rc.d/init.d/mongod.
The package configures MongoDB using the /etc/mongod.conf file in conjunction with the control scripts.
As of version 2.6.4, there are no control scripts for mongos. The mongos process is used only in sharding. You can use the mongod init script to derive your own mongos control script.
Considerations¶
MongoDB only provides Enterprise packages for Ubuntu 14.04 LTS (Precise Pangolin).
Install MongoDB Enterprise¶
Import the public key used by the package management system.¶
The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the MongoDB public GPG Key:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
Create a /etc/apt/sources.list.d/mongodb-enterprise.list file for MongoDB.¶
Create the list file using the following command:
echo 'deb http://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/stable multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
If you’d like to install MongoDB Enterprise packages from a particular release series, such as 2.4 or 2.6, you can specify the release series in the repository configuration. For example, to restrict your system to the 2.6 release series, add the following repository:
echo 'deb http://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/2.6 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-enterprise-2.6.list
Reload local package database.¶
Issue the following command to reload the local package database:
sudo apt-get update
Install the MongoDB Enterprise packages.¶
When you install the packages, you choose whether to install the current release or a previous one. This step provides instructions for both.
To install the latest stable version of MongoDB Enterprise, issue the following command:
sudo apt-get install mongodb-enterprise
To install a specific release of MongoDB Enterprise, specify each component package individually and append the version number to the package name, as in the following example that installs the 2.6.1` release of MongoDB Enterprise:
apt-get install mongodb-enterprise=2.6.1 mongodb-enterprise-server=2.6.1 mongodb-enterprise-shell=2.6.1 mongodb-enterprise-mongos=2.6.1 mongodb-enterprise-tools=2.6.1
You can specify any available version of MongoDB Enterprise. However apt-get will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin the version of MongoDB Enterprise at the currently installed version, issue the following command sequence:
echo "mongodb-enterprise hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-server hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-shell hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-mongos hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-tools hold" | sudo dpkg --set-selections
Previous versions of MongoDB Enterprise packages use different naming conventions. See the 2.4 version of documentation for more information.
Run MongoDB Enterprise¶
The MongoDB Enterprise instance stores its data files in /var/lib/mongo and its log files in /var/log/mongo, and runs using the mongod user account. If you change the user that runs the MongoDB process, you must modify the access control rights to the /var/lib/mongo and /var/log/mongo directories.
Begin using MongoDB.¶
To begin using MongoDB, see MongoDB 快速入门. Also consider the 生产环境指南 document before deploying MongoDB in a production environment.