Environment: Linux: Redhat or CentOS MONGODB installation mode 1: Install MONGODB by configuring Yum, Enterprise Edition and generic version: Not much, just look at the document [root@dominic5 ~]# Ping www.baidu.com PING www.a.shifen.com (180.97.33.71) bytes of data. Bytes from 180.97.33.71:icmp_seq=1 ttl=52 time=25.3 ms-bytes from 180.97.33.71:icmp_seq=2 ttl=52 time=29.3 ms [Roo T@DOMINIC5 ~]# Cat/etc/yum.repos.d/mongodb.repo--General version [MongoDB] Name=mongodb Repository Downloads-distro.mongodb.org/repo/redhat/os/x86_64/gpgcheck=0 enabled=1 [mongodb-enterprise-2.6] --Enterprise version installation Name=mongodb Enterprise 2.6 Repository baseurl=https://repo.mongodb.com/yum/redhat/$releasev er/mongodb-enterprise/2.6/$basearch/gpgcheck=0 enabled=1 [root@dominic4 ~] #sudo yum Install mongodb-org [ Root@dominic4 ~]# sudo yum install mongodb-enterprise
Loaded Plugins:product-id, security, Subscription-manager updating Red Hat repositories. Server | 1.5 KB 00:00 Setting up Install Process resolving dependencies--> Running transaction Check---> Package mongodb-en Terprise.x86_64 0:2.6.3-1.el5 set to is updated--> processing Dependency:mongodb-enterprise-mongos = 2.6.3 for Packag E:mongodb-enterprise--> Processing dependency:mongodb-enterprise-server = 2.6.3 for package:mongodb-enterprise--& Gt Processing Dependency:mongodb-enterprise-shell = 2.6.3 for package:mongodb-enterprise--> Processing Dependency:mon Godb-enterprise-tools = 2.6.3 for package:mongodb-enterprise--> Running transaction Check---> Package mongodb-ent Erprise-mongos.x86_64 0:2.6.3-1.el5 set to is updated---> Package mongodb-enterprise-server.x86_64 0:2.6.3-1.el5 Set To is updated--> processing dependency:net-snmp for package:mongodb-enterprise-server--> processing Dependency: Cyrus-sasl-gssapi for Package:mongodb-enterpRise-server--> Processing dependency:libsensors.so.3 () (64bit) for package:mongodb-enterprise-server---> Package mongodb-enterprise-shell.x86_64 0:2.6.3-1.el5 set to be updated---> Package mongodb-enterprise-tools.x86_64 0:2.6.3-1.el5 set to is updated--> Running transaction Check---> Package cyrus-sasl-gssapi.x86_64 0:2.1.22-5.el5_4 .3 set to is updated---> Package lm_sensors.x86_64 0:2.10.7-9.el5 set to be updated---> Package net-snmp.x86_64 1: 5.3.2.2-14.el5 set to is updated--> finished Dependency resolution dependencies resolved ============================ ==================================================================================================== Package Arch Version Repository Size ============================================================================== ================================================== Installing: mongodb-enterprise x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 4.7 k Installing for dependencies: cyrus-saSl-gssapi x86_64 2.1.22-5.el5_4.3 Server k lm_sensors x86_64 2.10.7-9.el5 server 525 k mongodb-enterprise-m Ongos x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 7.0 M mongodb-enterprise-server x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 9.2 m mongodb-enterprise-shell x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 4.3 m Mongodb-enterprise-tools x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 M net-snmp x86_64 1:5.3.2.2-14.el5 Server 705 k Transaction Summary ======================================================================================== ======================================== Install 8 Package (s) Upgrade 0 Package (s) total size:112 M total Download size: 1.2 M is this OK [y/n]: Y downloading Packages: (1/3): net-snmp-5.3.2.2-14.el5.x86_64.rpm | 705 KB 00:00 (2/3): cyrus-sasl-gssapi-2.1.22-5.el5_4.3.x86_64.rpm | KB 00:00 (3/3): lm_sensors-2.10.7-9.el5.x86_64.rpm | 525 KB 00:00--------------------------------------------------------------------------------------------------------------------------------Total 7.8 mb/s | 1.2 MB 00:00 Running rpm_check_debug Running Transaction test finished Transaction Test Transaction test succeeded Running Transaction INSTALLING:CYRUS-SASL-GSSAPI 1/8 installing:lm_sensors 2/8 INSTALLING:NET-SNMP 3/8 Installing:mongodb-enterprise-server 4/8 installing:mongodb-enterprise-tools 5/8 Installing:mo Ngodb-enterprise-shell 6/8 Installing:mongodb-enterprise-mongos 7/8 installing:mongodb-enterprise 8/8 du ration:652 (MS) installed products updated. Installed: mongodb-enterprise.x86_64 0:2.6.3-1.el5 Dependency installed: cyrus-sasl-gssapi.x86_64 0:2.1.22-5.el5_4.3 lm_sensors.x86_64 0:2.10.7-9.el5 mongodb-enterprise-mongos.x86_64 0:2.6.3-1.el5 mongodb-enterprise-server.x86_64 0:2.6.3-1.el5 mongodb-enterprise-shell.x86_64 0:2.6.3-1.el5 mongodb-enterprise-tools.x86_64 0:2.6.3-1.el5 net-snmp.x86_64 1:5.3.2.2-14.el5 complete!
Add a file----generic version you can specify any available version of MongoDB. However Yum'll 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,m Ongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
-----Enterprise Version Add file Pin a specific version of MongoDB Enterprise. Although can specify any available version of MongoDB Enterprise, Yum'll upgrade the packages when a newer version B Ecomes 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-enterprise,mongodb-enter Prise-server,mongodb-enterprise-shell,mongodb-enterprise-mong
MONGODB installation Mode 2:
=======##### Install for 64-bit Linux step 1:download The binary files for the desired release of MongoDB. Download the binaries from https://www.mongodb.org/downloads. For example, to download the latest release through the shell, issue the Following:curl-o http://downloads.mongodb.org/l Inux/mongodb-linux-x86_64-2.6.2.tgz --Direct download of the source db step 2:extract the files from the downloaded archive. For example, from a system shell, can extract through tar command:tar-zxvf mongodb-linux-x86_64-2.6.2.tgz Step 3 : Copy the extracted archive to the target directory. Copy the extracted folder to the location from which MongoDB'll run. Mkdir-p MongoDB cp-r-N mongodb-linux-x86_64-2.6.2/mongodb Step 4:ensure The location of the binaries is in the PATH V Ariable. The MongoDB binaries are in the bin/directory of the archive. To ensure this binaries are in your path, you can modify your path. For example, your can add the following line to your shell ' s RC file (e.g. ~/.basHRC): Export path=<mongodb-install-directory>: $PATH Replace <mongodb-install-directory> with the PATH to The MongoDB binaries. Way one installs, initiates the connection MongoDB through MONGO
MONGO by default, MONGO looks for a database server listening on port 27017 on the localhost interface. To connect to a server on a different port or interface, use the--port and--host options. 1. From the MONGO shell, confirm your are in the MyDB database by issuing the FOLLOWING:DB
2. If MONGO does not return mydb for the previous operation, set the "context to" MyDB database, with the following Ation:use MyDB
3. Create two documents named J and K by using the following sequence of JavaScript operations:j = {name: "Mongo"} k = {X:3}
4. Insert the J and K to the TestData collection with the following sequence of Operations:db.testData.insert (j) Db.testData.insert (k) When you insert the "I", the Mongod would create both the MyDB database and the Te Stdata collection.
5. Confirm that the TestData collection exists. Issue the following operation:show collections the MONGO Shell would return to the list of the collections in the current (I. E. MyDB) database. At this point, the only collection is TestData. All Mongod databases also have a system.indexes (page 251) collection.
6. Confirm that the documents exist in the TestData collection by issuing a query on the collection using the "Find" () Metho D:db.testdata.find () This operation returns the following results. The ObjectId (page 148) values would be unique: {"_id": ObjectId ("4c2209f9f3924d31102bd84a"), "name": "Mongo"} {"_id" : ObjectId ("4c2209fef3924d31102bd84b"), "X": 3}
----from the official when, other OS (Windows,ubantu, SUSE, etc.) installation, please view the official when
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.