MongoDB installation on Linux

Source: Internet
Author: User

1.

http://www.mongodb.org/

2. Preparation before installation

2.1, creating data directories and log directories

[[email protected] mongodb]# Mkdir-p/opt/mongo/{data,logs}

2.1, creating users and Groups

[Email protected] mongodb]# useradd MONGO

[Email protected] mongodb]# Groupadd MONGO

Groupadd:group MONGO exists

2.3 Changing a catalog group

[Email protected] mongodb]# chown-rmongo:mongo/opt/mongo/

[email protected] mongodb]# LL

Total 112244

3. Decompression

[Email protected]]# tar-zxvf mongodb-linux-i686-2.6.5.tgz

[Email protected] mongodb]# CD mongodb-linux-i686-2.6.5

[email protected] mongodb-linux-i686-2.6.5]# LL

Cdtotal 64

Drwxr-xr-x 2 root root 4096 Oct 11:47 bin

-rw-r--r--1 root root 34520 Oct 8 00:13 gnu-agpl-3.0

-rw-r--r--1 root root 1359 Oct 8 00:13 README

-rw-r--r--1 root root 17793 Oct 8 00:13 third-party-notices

4. Migrating data to the/usr/local/mongo directory

4.1 copying files to /usr/local/mongo

[Email protected] mongodb]# Cp-rmongodb-linux-i686-2.6.5/usr/local/mongo

[Email protected] mongodb]# cd/usr/local/mongo/

[email protected] mongo]# LL

Total 64

Drwxr-xr-x 2 root root 4096 Dec 03:39 bin

-rw-r--r--1 root root 34520 Dec 03:39gnu-agpl-3.0

-rw-r--r--1 root root 1359 Dec 03:39 README

-rw-r--r--1 root root 17793 Dec 03:39third-party-notices

[Email protected] mongo]# CD bin/

[email protected] bin]# LL

Total 279652

-rwxr-xr-x 1 root root 23262756 Dec 2503:39 bsondump

-rwxr-xr-x 1 root root 11646208 Dec 2503:39 MONGO

-rwxr-xr-x 1 root root 23425560 Dec 2503:39 mongod

-rwxr-xr-x 1 root root 23333956 Dec 2503:39 mongodump

-rwxr-xr-x 1 root root 23281924 Dec 2503:39 mongoexport

-rwxr-xr-x 1 root root 23326132 Dec 2503:39 mongofiles

-rwxr-xr-x 1 root root 23301860 Dec 2503:39 mongoimport

-rwxr-xr-x 1 root root 23272516 Dec 2503:39 mongooplog

-rwxr-xr-x 1 root root 23079220 Dec 2503:39 mongoperf

-rwxr-xr-x 1 root root 23371588 Dec 03:39mongorestore

-rwxr-xr-x 1 root root 18096080 Dec 2503:39 MONGOs

-rwxr-xr-x 1 root root 23321732 Dec 2503:39 mongostat

-rwxr-xr-x 1 root root 23265828 Dec 2503:39 mongotop

4.2, copy Mongo,mongod to /usr/bin/

[Roo[email protected] bin]# CP mongo/usr/bin/

[email protected] bin]# CP mongod/usr/bin/

5. Initialize data and log directory

[Email protected] ~]# Mongod-port 10001--dbpath/opt/mongo/data--logpath/opt/mongo/logs/mongodb.log

2014-12-25t03:45:35.518+0800

2014-12-25t03:45:35.519+0800 warning:32-bit servers don ' t has journaling enabled by default. Please use--journalif want durability.

2014-12-25t03:45:35.520+0800

[Email protected] data]# pwd

/opt/mongo/data

[email protected] data]# LL

Total 82016

-RW-------1 root root 67108864 Dec 2503:45 local.0

-RW-------1 root root 16777216 Dec 2503:45 local.ns

-rwxr-xr-x 1 root root 6 Dec 03:45 Mongod.lock

Drwxr-xr-x 2 root root 4096 Dec 03:45 _tmp

[Email protected] data]#

[Email protected] logs]# pwd

/opt/mongo/logs

[email protected] logs]# LL

Total 4

-rw-r--r--1 root root 2300 Dec 03:45mongodb.log

[Email protected] logs]#

6. Connecting MONGO

[Email protected] logs]# MONGO localhost:10001

MongoDB Shell version:2.6.5

Connecting To:localhost:10001/test

Welcome to the MongoDB shell.

For interactive help, type ' help '.

For more comprehensive documentation, see

http://docs.mongodb.org/

Questions? Try the Support group

Http://groups.google.com/group/mongodb-user

Server has startup warnings:

2014-12-25t03:45:35.533+0800[initandlisten]

2014-12-25t03:45:35.533+0800[initandlisten] * * Note:this is a A-bit MongoDB binary.

2014-12-25t03:45:35.533+0800[initandlisten] * * * a bit buildsare limited to less than 2GB of data (or less with--jou rnal).

2014-12-25t03:45:35.534+0800[initandlisten] * * Note thatjournaling defaults to OFF for the + bit and is currently off.

2014-12-25t03:45:35.534+0800[initandlisten] * * seehttp://dochub.mongodb.org/core/32bit

2014-12-25t03:45:35.534+0800[initandlisten]

> Db.foo.save ({a:1})

Writeresult ({"ninserted": 1})

> Db.foo.find ();

{"_id": ObjectId ("549b18ffff3a181677422f45"), "a": 1}

>

7. Testing

http://192.168.88.101:10001/

It looks like you is trying to access Mongodbover HTTP on the native driver port.

8. Client Connection

Use Mongovue connection.

MongoDB installation on Linux

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.