Skip to end of metadata
Go to start of metadata

This page shows you how to install MongoDB on your Node.js™ SmartMachine.

In this page:

In the interest of conserving your no.de's RAM and CPU, if you're looking for a good hosted MongoDB instance during the 48-hour NodeKnockout Competition, we recommend checking out the free offering from MongoHQ

Using an Installation Script

The easiest way to install MongoDB on your Node.js SmartMachine is to use this installation script .

  1. Start by logging into your smartmachine as the "admin" user:
  2. Invoke root privileges for bash:
    You will also need to invoke root privileges when you run the mongo shell or perform other maintenance work.
  3. Use curl to download the installation script:
  4. Start the script using bash:

The installation script:

  • downloads MongoDB and the additional library needed
  • unpacks the tar files
  • creates the directories ~/local/bin, ~/local/lib, ~/local/var/mongodb if they don't already exist
  • moves the files to the appropriate directories
  • creates an SMF manifest for the MongoDB service

To start MongoDB, and to ensure that it restarts when your machine reboots, run these commands:

Installing Manually

Follow these instructions to install MongoDB 1.8.1 on your Node.js SmartMachine.

Note that running MongoDB this way will not restart if your Node.js SmartMachine is rebooted. You may want to create an SMF manifest for it and use SMF to make sure it runs when your machine restarts. You can use the SMF manifest from the installation script .

At a Glance

You can get a different version of MongoDB from the download site. You can use either the 32- or 64-bit Solaris builds.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. May 09, 2011

    Anonymous

    Downloading mongodb-sunos5-x86_64-1.8.1.tgz...
    2011-05-09 10:56:32 URL:http://fastdl.mongodb.org/sunos5/mongodb-sunos5-x86_64-1.8.1.tgz [33244394/33244394] -> "mongodb-sunos5-x86_64-1.8.1.tgz" [1]
    Downloading was successful.
    Downloading mongo-extra-64.tgz...
    2011-05-09 10:56:35 URL:http://fastdl.mongodb.org/sunos5/mongo-extra-64.tgz [1669058/1669058] -> "mongo-extra-64.tgz" [1]
    Downloading was successful.
    Untarring mongodb-sunos5-x86_64-1.8.1.tgz
    tar: directory checksum error
    Problem untarring mongodb-sunos5-x86_64-1.8.1.tgz.
    Hi 

    When I run the script, I got the below output. There is an error in tar command. 


    Downloading mongodb-sunos5-x86_64-1.8.1.tgz...

    2011-05-09 10:56:32 URL:http://fastdl.mongodb.org/sunos5/mongodb-sunos5-x86_64-1.8.1.tgz [33244394/33244394] -> "mongodb-sunos5-x86_64-1.8.1.tgz" [1]

    Downloading was successful.

    Downloading mongo-extra-64.tgz...

    2011-05-09 10:56:35 URL:http://fastdl.mongodb.org/sunos5/mongo-extra-64.tgz [1669058/1669058] -> "mongo-extra-64.tgz" [1]

    Downloading was successful.

    Untarring mongodb-sunos5-x86_64-1.8.1.tgz

    tar: directory checksum error

    Problem untarring mongodb-sunos5-x86_64-1.8.1.tgz.


    Regards,
    Rony

    1. May 14, 2011

      Anonymous

      Hey Rony,

      run this comand first to unzip the file

      gunzip mongodb-sunos5-x86_64-1.8.1.tgz

      then

      tar -xvf mongodb-sunos5-x86_64-1.8.1.tar

      hope that helps,

      Bach

    2. May 16, 2011

      Rony,

      Can you tell me what output you get when you use the uname -a command?

      For instance: this is mine:

      [node@twohorses ~/test]$ uname -a
      SunOS twohorses.no.de 5.11 joyent_20110414T185150Z i86pc i386 i86pc Solaris
      
  2. May 25, 2011

    Anonymous

    bash mongodbnode.sh 1.8.1
    Downloading mongodb-sunos5-x86_64-1.8.1.tgz...
    2011-05-25 09:51:28 URL:http://fastdl.mongodb.org/sunos5/mongodb-sunos5-x86_64-1.8.1.tgz [33244394/33244394] -> "mongodb-sunos5-x86_64-1.8.1.tgz" [1]
    Downloading was successful.
    Downloading mongo-extra-64.tgz...
    2011-05-25 09:51:30 URL:http://fastdl.mongodb.org/sunos5/mongo-extra-64.tgz [1669058/1669058] -> "mongo-extra-64.tgz" [1]
    Downloading was successful.
    Untarring mongodb-sunos5-x86_64-1.8.1.tgz
    Decompressing 'mongodb-sunos5-x86_64-1.8.1.tgz' with '/usr/bin/gzcat'...
    tar: blocksize = 10
    x mongodb-sunos5-x86_64-1.8.1, 0 bytes, 0 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/THIRD-PARTY-NOTICES, 7866 bytes, 16 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/GNU-AGPL-3.0, 34520 bytes, 68 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/README, 731 bytes, 2 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin, 0 bytes, 0 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/mongod, 12426440 bytes, 24271 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/mongo, 4174992 bytes, 8155 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/mongodump, 12509384 bytes, 24433 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/mongos, 7377696 bytes, 14410 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/mongofiles, 12450648 bytes, 24318 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/mongoimport, 12463864 bytes, 24344 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/bsondump, 12439264 bytes, 24296 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/mongostat, 12544168 bytes, 24501 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/mongoexport, 12447024 bytes, 24311 tape blocks
    x mongodb-sunos5-x86_64-1.8.1/bin/mongorestore, 12472368 bytes, 24361 tape blocks
    Untarring mongo-extra-64.tgz
    Decompressing 'mongo-extra-64.tgz' with '/usr/bin/gzcat'...
    x mongo-extra-64, 0 bytes, 0 tape blocks
    x mongo-extra-64/libgcc_s.so.1, 255312 bytes, 499 tape blocks
    x mongo-extra-64/libstdc++.so.6, 5900688 bytes, 11525 tape blocks
    No ~/local/var found; creating one.
    No ~/local/var/mongodb found; creating one.
    Moving files to their final location.
    Cleaning up files.
    Installing MongoDB service...
    Congratulations, MongoDB looks like it was successfully installed.
    The mongo binaries are in /home/node/local/bin and the data is in /home/node/local/var/mongodb
    To start using MongoDB, run the following two commands:
      source ~/.bashrc
      pfexec svcadm enable mongodb
    For security purposes, MongoDB is only listening for connections from 127.0.0.1.
    [node@no ~]$ source ~/.bashrc
    [node@no ~]$ pfexec svcadm enable mongodb
    [node@no ~]$ ps -l
     F S    UID   PID  PPID   C PRI NI     ADDR     SZ    WCHAN TTY         TIME CMD
     0 O   1010  7152  3940   0  40 20        ?    552          pts/12      0:00 ps
     0 S   1010  3940  3925   0  40 20        ?    835        ? pts/12      0:00 bash
    [node@no ~]$ mongo
    ld.so.1: mongo: fatal: libstdc++.so.6: open failed: No such file or directory
    Killed
    there are still problems with the script - seems that the mongo-extra-64 stuff hasn't been put in the right place...

    ..should it be in in the local/bin directory too?

    $ bash mongodbnode.sh 1.8.1

    Downloading mongodb-sunos5-x86_64-1.8.1.tgz...

    2011-05-25 09:51:28 URL:http://fastdl.mongodb.org/sunos5/mongodb-sunos5-x86_64-1.8.1.tgz [33244394/33244394] -> "mongodb-sunos5-x86_64-1.8.1.tgz" [1]

    Downloading was successful.

    Downloading mongo-extra-64.tgz...

    2011-05-25 09:51:30 URL:http://fastdl.mongodb.org/sunos5/mongo-extra-64.tgz [1669058/1669058] -> "mongo-extra-64.tgz" [1]

    Downloading was successful.

    Untarring mongodb-sunos5-x86_64-1.8.1.tgz

    Decompressing 'mongodb-sunos5-x86_64-1.8.1.tgz' with '/usr/bin/gzcat'...

    tar: blocksize = 10

    x mongodb-sunos5-x86_64-1.8.1, 0 bytes, 0 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/THIRD-PARTY-NOTICES, 7866 bytes, 16 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/GNU-AGPL-3.0, 34520 bytes, 68 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/README, 731 bytes, 2 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin, 0 bytes, 0 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/mongod, 12426440 bytes, 24271 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/mongo, 4174992 bytes, 8155 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/mongodump, 12509384 bytes, 24433 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/mongos, 7377696 bytes, 14410 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/mongofiles, 12450648 bytes, 24318 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/mongoimport, 12463864 bytes, 24344 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/bsondump, 12439264 bytes, 24296 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/mongostat, 12544168 bytes, 24501 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/mongoexport, 12447024 bytes, 24311 tape blocks

    x mongodb-sunos5-x86_64-1.8.1/bin/mongorestore, 12472368 bytes, 24361 tape blocks

    Untarring mongo-extra-64.tgz

    Decompressing 'mongo-extra-64.tgz' with '/usr/bin/gzcat'...

    x mongo-extra-64, 0 bytes, 0 tape blocks

    x mongo-extra-64/libgcc_s.so.1, 255312 bytes, 499 tape blocks

    x mongo-extra-64/libstdc++.so.6, 5900688 bytes, 11525 tape blocks

    No ~/local/var found; creating one.

    No ~/local/var/mongodb found; creating one.

    Moving files to their final location.

    Cleaning up files.

    Installing MongoDB service...

    Congratulations, MongoDB looks like it was successfully installed.

    The mongo binaries are in /home/node/local/bin and the data is in /home/node/local/var/mongodb

    To start using MongoDB, run the following two commands:

      source ~/.bashrc

      pfexec svcadm enable mongodb

    For security purposes, MongoDB is only listening for connections from 127.0.0.1.

    [node@no ~]$ source ~/.bashrc

    [node@no ~]$ pfexec svcadm enable mongodb

    $ mongo

    ld.so.1: mongo: fatal: libstdc++.so.6: open failed: No such file or directory

    Killed

  3. Aug 22, 2011

    Anonymous

    I want to run mongo in replica set mode. This works fine but how do I secure the database to prevent unauthorised access? Is is possible to set up my instance to only allow connection on certain ports from a whitelist?