Building for Linux

Note: Binaries are available for most platforms. Most users won't need to compile mongo themselves; in addition every prebuilt binary has been regression tested. See the Downloads page for these prebuilt binaries.

Prerequisites

SpiderMonkey

Most pre-built Javascript SpiderMonkey libraries do not have UTF-8 support compiled in; MongoDB requires this. Additionally, Ubuntu has a weird version of SpiderMonkey that doesn't support everything we use. If you get any warnings during compile time or runtime, we highly recommend building SpiderMonkey from source. See Building SpiderMonkey for more information. We currently support SpiderMonkey 1.6 and 1.7, although there is some degradation with 1.6, so we recommend using 1.7. We have not yet tested 1.8, but will once it is officially released.

V8 support is under development.

Fedora

The following steps have been reported to work for Fedora versions from 8 to 13. (If they don't work on newer versions, please report this to mongodb-user@googlegroups.com.)

sudo yum -y install git tcsh scons gcc-c++ glibc-devel
sudo yum -y install boost-devel pcre-devel js-devel readline-devel
#for release builds:
sudo yum -y install boost-devel-static readline-static ncurses-static

Ubuntu

Note: See SpiderMonkey note above.

Use cat /etc/lsb-release to see your version.

Ubuntu 8.04

apt-get -y install tcsh git-core scons g++
apt-get -y install libpcre++-dev libboost-dev libreadline-dev xulrunner-1.9-dev
apt-get -y install libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev libboost-date-time-dev

Ubuntu 9.04 and 9.10

apt-get -y install tcsh git-core scons g++
apt-get -y install libpcre++-dev libboost-dev libreadline-dev xulrunner-1.9.1-dev
apt-get -y install libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev libboost-date-time-dev

Ubuntu 10.04+

apt-get -y install tcsh git-core scons g++
apt-get -y install libpcre++-dev libboost-dev libreadline-dev xulrunner-1.9.2-dev
apt-get -y install libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev libboost-date-time-dev

Building

  1. Install prerequisites
  2. get source
    git clone git://github.com/mongodb/mongo.git
    cd mongo
    # pick a stable version unless doing true dev
    git tag -l
    # Switch to a stable branch (unless doing development) --
    # an even second number indicates "stable". (Although with
    # sharding you will want the latest if the latest is less
    # than 1.6.0.) For example:
    git checkout r2.0.0
    
  3. build
    scons all
  4. install --prefix can be anywhere you want to contain your binaries, e.g., /usr/local or /opt/mongo.
    scons --prefix=/opt/mongo install

Troubleshooting

  • Link errors. If link errors occur, the -t gcc option is useful for troubleshooting. Try adding -t to the SConstruct file's LINKFLAGS.
  • Static libraries. The --release scons option will build a binary using static libraries. You may need to install static boost libraries when using this option.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.

blog comments powered by Disqus