In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
System: centOS5.6
Download the mongo source package, pcre,epel,js
1 # wget http://downloads.mongodb.org/src/mongodb-src-r1.8.1.tar.gz
# wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
# wget http://sourceforge.net/projects/pcre/files/pcre/8.12/pcre-8.12.tar.bz2
Install python:
# yum install-y python-devel
Install scons: download scons
Tar zxf scons-2.0.1.tar.gz
Cd scons-2.0.1
Python setup.py install
Install the spidermonkey library, download the js api library that supports c, click here to download js-1.7.0.tar.gz
Yum install-y boost boost-devel
Tar zxvf js-1.7.0.tar.gz
Cd js/src/
Export CFLAGS= "- DJS_C_STRINGS_ARE_UTF8"
Make-f Makefile.ref
JS_DIST=/usr gmake-f Makefile.ref export
Cd.. /..
Install pcre
Tar zxf pcre-8.12.tar.gz
Cd pcre-8.12
. / configure-enable-utf8-enable-unicode-properties
Make & & make install
Cd..
Install MongoDB
Tar zxf mongodb-src-r1.8.1.tar.gz
Cd mongodb-src-r1.8.1
Scons all / / scons may not find the pcre library (it is useless to modify / etc/ld.so.conf, it is the problem of scons itself). Open SConstruct under mongodb-src-r1.8.0, look for [linux2 "= = os.sys.platform:], add the installation path of pcrecpp library after LIBPATH, add the name of pcrecpp library after LIBS, and then scons all again (operation: vim SConstruct) Original: env.Append (LIBPATH= ["/ usr/lib64", "/ lib64"]) Modified env.Append (LIBPATH= ["/ usr/lib64", "/ lib64", "/ usr/local/pcre/lib"]); then add env.Append (LIBS= ["libpcrecpp"]) after env.Append (LIBS= ["pthread"]))
Scons-prefix=/usr/local/mongo install
If you need to install lib and head, install it as follows
Scons-prefix=/usr/local/mongo-full install
Create a profile
Mkdir-p / usr/local/mongo/etc / usr/local/mongo/data / usr/local/mongo/log/ / usr/local/mongo/repair
Vim / usr/local/mongo/etc/mongo.conf
Add the following to mongo.conf
Dbpath = / usr/local/mongo/data
Logpath = / usr/local/mongo/mongodb.log
Repairpath = / usr/local/mongo/repair
Pidfilepath = / usr/local/mongo/mongodb.pid
Directoryperdb = true
Logappend = true
Noauth = true
Port = 27017
MaxConns = 1024
Fork = true
Rest = true
Quota = true
QuotaFiles = 1024
Nssize = 16
Start mongodb
Ln-s / usr/local/mongo/bin/mongod / usr/bin/mongod
Mongod-f / usr/local/mongo/etc/mongo.conf
See if it's started, but it's unwise to manage the mongodb server in this way, so let's improve it:
Mkdir-p / usr/local/mongo/srv
Vim / usr/local/mongo/srv/mongodb-start
Add the following
#! / bin/sh
Mongod-f / usr/local/mongo/etc/mongo.conf
Vim / usr/local/mongo/srv/mongodb-stop
Add the following
#! / bin/bash
Pid= `ps-o pid,command ax | grep mongod | awk'! / awk/ & &! / grep/ {print $1}'`
If ["${pid}"! = "]; then
Kill-2 ${pid}
Fi
Add execution permission
Chmod axix / usr/local/mongo/srv/mongodb-start
Chmod axix / usr/local/mongo/srv/mongodb-stop
Vim / etc/rc.d/init.d/mongodb
Add the following
#! / bin/sh
#
# mongodb-this script starts and stops the mongodb daemon
#
# chkconfig:-85 15
# description: MongoDB is a non-relational database storage system.
# processname: mongodb
# config: / usr/local/mongo/etc/mongo.conf
# pidfile: / usr/local/mongo/mongodb.pid
PATH=/usr/local/mongo/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=mongodb
Test-x $DAEMON | | exit 0
Set-e
Case "$1" in
Start)
Echo-n "Starting MongoDB..."
/ usr/local/mongo/srv/mongodb-start
Stop)
Echo-n "Stopping MongoDB..."
/ usr/local/mongo/srv/mongodb-stop
*)
N=/etc/init.d/$NAME
Echo "Usage: $N {start | stop}" > & 2
Exit 1
Esac
Exit 0
Add Servic
Chmod axix / etc/rc.d/init.d/mongodb
Chkconfig-add mongodb
Chkconfig-level 345 mongodb on
/ etc/rc.d/init.d/mongodb start
Php mongo extension installation:
Server environment Cent OS 5.664 bit, php version 5.2.17 compilation installation, installation path / usr/local/php
First download the latest php mongodb extension source code, which can be downloaded from http://pecl.php.net/package/mongo
Wget http://pecl.php.net/get/mongo-1.2.2.tgz
Tar zxf mongo-1.2.2.tgz
Cd mongo-1.2.2
After entering the folder, first run phpize to prepare the environment for compiling the extension. The program phpize is introduced here.
/ usr/local/php/bin/phpize
The execution result after running is as follows:
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
After running, the. / configure script is generated, and we run the. / configure script to configure it.
. / configure-- with-php-config=/usr/local/php/bin/php-config
The parameter with-php-config tells the configuration script php-config the path to this program. The introduction of php-config is here.
The result of the above command running in a correctly configured environment is as follows
Creating libtool
Appending configuration tag "CXX" to libtool
Configure: creating. / config.status
Config.status: creating config.h
Then use make to compile the extension
Make & & make install
The result of correct compilation and execution is as follows:
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: / usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
When you are finished, please edit your php.ini file to add a line
Extension=mongo.so
Generally, the default ini file for compiling php is in the
/ usr/local/php/etc/php.ini
Restart your web server or php-fpm, print phpinfo, and if you see the mongo entry table, then the mongodb extension has been installed successfully
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.