Record the process of installing MongoDB with source code

Source: Internet
Author: User
Tags install mongodb expression engine
This document describes how to install MongoDB on 64-bit centos. MongoDB is a document-oriented database developed in C ++, which is designed in an anti-traditional database paradigm and records related objects in one document, each document contains Schema-free, that is, the column names can be freely defined and flexible, especially in the case of changing business logic. Data is stored in binary format in bson (similar to JSON) format. The downside is that data redundancy and storage overhead may occur.

The latest version of MongoDB is. 8.2-rc3: its source code is installed with a lot of third-party things, such as the JS engine (Mozilla spider monkey is currently officially recommended, and may be changed to Google's V8 and node in the future. like JS, haha), Regular Expression Engine (PCRE), install build tool scons (which must be installed using Python), boost C ++ library, and so on. The following is the installation record:

1. download the required source files and related software packages:

        [root@localhost mongodb]# wget http://downloads.mongodb.org/src/mongodb-src-r1.8.2-rc3.tar.gz        [root@localhost mongodb]# wget http://sourceforge.net/projects/scons/files/scons/2.1.0.alpha.20101125/scons-2.1.0.alpha.20101125.tar.gz/download        [root@localhost mongodb]# wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz        [root@localhost mongodb]# wget http://sourceforge.net/projects/pcre/files/pcre/7.4/pcre-7.4.tar.gz/download

2. Install scons:

    [root@localhost mongodb]# tar zxvf scons-2.1.0.alpha.20101125.tar.gz    [root@localhost mongodb]# cd scons-2.1.0.alpha.20101125    [root@localhost scons-2.1.0.alpha.20101125]# python setup.py install

3. Install PCRE:

    [root@localhost mongodb]# tar zxvf pcre-7.4.tar.gz    [root@localhost mongodb]# cd pcre-7.4    [root@localhost pcre-7.4]# ./configure    [root@localhost pcre-7.4]# make    [root@localhost pcre-7.4]# make install

4. Install spider monkey:

    [root@localhost mongodb]# tar zxvf js-1.7.0.tar.gz    [root@localhost mongodb]# cd js/src    [root@localhost src]# export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"    [root@localhost src]# make -f Makefile.ref    [root@localhost src]# JS_DIST=/usr make -f Makefile.ref export

5. Installing boost and yum is relatively lazy:

[root@localhost src]# yum -y install boost boost-devel

6. Install MongoDB:

    [root@localhost mongodb]# tar zxvf mongodb-src-r1.8.2-rc3.tar.gz    [root@localhost mongodb]# cd mongodb-src-r1.8.2-rc3    [root@localhost mongodb-src-r1.8.2-rc3]# scons all    [root@localhost mongodb-src-r1.8.2-rc3]# scons --prefix=/usr/local/mongodb --full install

7. Start MongoDB to test:

[Root @ localhost bin] #./mongod -- dbpath/tmp./mongod: Error while loading shared libraries: libpcrecpp. so.0: cannot open shared object file: no such file or directory
    [root@localhost bin]# ./mongod --dbpath /tmp    ./mongod: error while loading shared libraries: libpcrecpp.so.0: cannot open shared object file: No such file or directory    [root@localhost bin]# LD_DEBUG=libs ./mongod -v    ......    29656:       trying file=/lib64/tls/x86_64/libpcrecpp.so.0    29656:       trying file=/lib64/tls/libpcrecpp.so.0    29656:       trying file=/lib64/x86_64/libpcrecpp.so.0    29656:       trying file=/lib64/libpcrecpp.so.0    29656:       trying file=/usr/lib64/tls/x86_64/libpcrecpp.so.0    29656:       trying file=/usr/lib64/tls/libpcrecpp.so.0    29656:       trying file=/usr/lib64/x86_64/libpcrecpp.so.0    29656:       trying file=/usr/lib64/libpcrecpp.so.0    29656:    ./mongod: error while loading shared libraries: libpcrecpp.so.0: cannot open shared object file: No such file or directory    [root@localhost bin]# ln -s /usr/local/lib/libpcrecpp.so.0 /usr/lib64/libpcrecpp.so.0    [root@localhost bin]# ll /usr/lib64/libpcrecpp.so.0    lrwxrwxrwx 1 root root 30 Jun  8 11:57 /usr/lib64/libpcrecpp.so.0 -> /usr/local/lib/libpcrecpp.so.0    [root@localhost bin]# ./mongod --dbpath /tmp    Wed Jun  8 11:57:38 [initandlisten] MongoDB starting : pid=29700 port=27017 dbpath=/tmp 64-bit    Wed Jun  8 11:57:38 [initandlisten] db version v1.8.2-rc3, pdfile version 4.5    Wed Jun  8 11:57:38 [initandlisten] git version: nogitversion    Wed Jun  8 11:57:38 [initandlisten] build sys info: Linux localhost.localdomain 2.6.18-128.el5 #1 SMP Wed Jan 21 10:41:14 EST 2009 x86_64 BOOST_LIB_VERSION=1_33_1    Wed Jun  8 11:57:38 [initandlisten] waiting for connections on port 27017    Wed Jun  8 11:57:38 [websvr] web admin interface listening on port 28017

Install MongoDB In Debian
1. apt-Get install scons2. apt-Get install libpcrecpp0 (Perl 5 Compatible Regular Expression Library-C ++ runtime files) 3. apt-Get install libpcre3-dev-perl 5 Compatible Regular Expression Library-development files4. apt-Get install libboost1.35-Dev (boost library, latest official website 1.4) 5. apt-Get install libpcap-dev6. apt-Get install libmozjs-dev7. apt-Get install xulrunner-Dev (gecko Library) 8. wget http://fastdl.mongodb.org/src/mongodb-src-r1.4.4.tar.gz9. tar zxvf mongodb-src-r1.4.4.tar.gz10.cd source code extract directory 11. scons -- sharedclient = sharedclient all -- prefix =/home/liubao/MongoDB/mongodb12. scons -- prefix =/usr/local/enginc/MongoDB install

MongoDB is written in C ++ and is used in the gecko library during compilation. A lot of JS operations should be used internally. And we can see a JSON. cpp file. I don't know if the data is compressed and stored in JSON format. Tomorrow, let's see how this stuff works.

I also noticed a problem. MongoDB is a self-written driver, while canssandra uses thrift protocol for cross-language communication. I don't know whether this is because of performance or other reasons.

Apt-Get install sconse: sub-process/usr/bin/dpkg returned an error code (1) solution: this can be solved as follows: CD/var/lib/dpkgsudo MV info. baksudo mkdir info

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.