重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Mongodb2.0.5版本安装
在蕉城等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都做网站、网站设计 网站设计制作按需网站开发,公司网站建设,企业网站建设,高端网站设计,成都营销网站建设,外贸网站制作,蕉城网站建设费用合理。
- 一:安装Python
- Version:Python2.6
- http://www.python.org/ftp/python/
- tar zxvf Python-2.6.6.tgz
- ./configure –-enable-shared
- make
- sudo make instal
- cat /etc/ld.so.conf
- 在/etc/ld.so.conf 中添加 /usr/local/lib一行
- sudo ldconfig
- 二:Scons安装
- $ tar zxvf scons-2.0.1.tar.gz
- $ sudo python setup.py install
- sudo vim /usr/bin/scons 或者 vim /usr/local/bin/scons
- 修改内容如下
- #!/usr/bin/env python2.6
- sudo yum -y install boost-devel pcre-devel js-devel readline-devel ncurses-devel
- 三:Spider Monkey安装
- Version:js-1.7.0
- $ wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
- $ cd /home/webuser/software/mongodb/js/src
- $ export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"
- $ make -f Makefile.ref
- $ sudo JS_DIST=/usr make -f Makefile.ref export
- sudo yum remove boost*i386 //卸载32位程序包 rpm -qa查看状态
- sudo yum remove pcre*i386 boost*i386 ncurses*i386 readline*i386
- sudo yum remove ncurses*i386
- sudo yum remove readline*i386
- ---------------------------------------------
- sudo yum remove pcre-devel //卸载64位开发包
- sudo yum remove boost-devel
- sudo yum remove ncurses-devel pcre-devel boost-devel readline-devel
- sudo yum remove readline-devel
- --------------------------------------------
- sudo yum install pcre-devel*x86* //安装64位开发包
- sudo yum install boost-devel*x86*
- sudo yum install ncurses-devel*x86* pcre-devel*x86* boost-devel*x86* readline-devel*x86*
- sudo yum install readline-devel*x86*
- ---------------------------------------------
- sudo ldconfig
- ---------------------------------------------
- 四:Boost安装
- 下载 boost_1_48_0.tar.gz源码包
- tar zxvf boost_1_48_0.tar.gz
- cd boost_1_48_0/
- ./bootstrap.sh
- 在当前目录下会生成b2的编译文件,然后执行
- ./b2
- 编译成功会出现如下:
- the boost C++ Libraries were successfull built
- the following directory should be added to compiler include paths:
- ...................
- the following directory should be added to linker library paths:
- sudo cp -R boost/ /usr/include ----注意一定要拷贝完 -安装的时候复制粘贴吧,避免出错!
- sudo cp stage/lib/* /usr/lib/
- sudo ldconfig
- 五:Mongodb的安装
- tar zxvf mongodb-src-r2.0.5.tar.gz
- scons --64 --extrapath=/usr --libpath=/usr/lib64 --full --release --static all
- scons --prefix=/opt/mongodb --64 --extrapath=/usr --libpath=/usr/lib64 --full --release --static install
- mkdir /opt/mongodb/{etc,log,repair,data}
- cd /opt/mongodb/etc/
- 六:Mongodb配置文件
- dbpath = /opt/mongodb/data
- #repairpath = /opt/mongodb/repair 仅当Mongodb数据库有问题需要修复时使用
- logpath = /opt/mongodb/log/mongodb.log
- pidfilepath = /opt/mongodb/log/mongodb.pid
- unixSocketPrefix = /opt/mongodb/log
- directoryperdb = true
- auth = true
- #sysinfo = true
- #verbose = true
- logappend = true
- #cpu = true
- #Network and security set
- noauth = true
- port = 33111
- maxConns = 1024
- fork = true
- #Management
- #nohttpinterface = true
- rest = true
- quota = true
- quotaFiles = 1024
- nssize = 16
- #syncdelay = 5
最后:service mongod start 启动mongod 服务
netstat 查看
- 七:配置Mongodb启动
- vim /etc/init.d/mongod
- chmod u+x /etc/init.d/mongod
- chkconfig --add mongod
- 附上mongodb启动脚本:
- #!/bin/bash
- #&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- #Author:gaohaicang &
- #Company: dzh &
- #Date:2013-1-15 &
- #Version:1 &
- #&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- # description: mongodb server SysV script
- . /etc/rc.d/init.d/functions
- # Source networking configuration.
- . /etc/sysconfig/network
- #Set PATH ENV
- PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
- #Set mongod
- mongod=/opt/mongodb/bin/mongod
- prog=mongod
- lockfile=/opt/mongodb/data/db/mongod.lock
- pidfile=/opt/mongodb/log/mongodb.pid
- # config: /opt/mongod/etc/mongod
- RETVAL=0
- OPTIONS="--fork --logpath=/opt/mongodb/log/mongod.log --config /opt/mongodb/etc/mongodb"
- start()
- {
- echo -n $"Starting $prog: "
- daemon $mongod $OPTIONS
- daemon $mongd
- RETVAL=$?
- echo
- [ $RETVAL = 0 ]
- return $RETVAL
- }
- stop()
- {
- MONGOPID=`cat "$pidfile" 2>/dev/null `
- if [ -n "$MONGOPID" ]; then
- /bin/kill "$MONGOPID" >/dev/null 2>&1
- ret=$?
- if [ $ret -eq 0 ]; then
- STOPTIMEOUT=60
- while [ $STOPTIMEOUT -gt 0 ]; do
- /bin/kill -0 "$MONGOPID" >/dev/null 2>&1 || break
- sleep 1
- let STOPTIMEOUT=${STOPTIMEOUT}-1
- done
- if [ $STOPTIMEOUT -eq 0 ]; then
- echo "Timeout error occurred trying to stop Mongod Daemon."
- ret=1
- action $"Stopping $prog: " /bin/false
- else
- rm -f /opt/mongod/data/mongod.lock
- action $"Stopping $prog: " /bin/true
- fi
- else
- action $"Stopping $prog: " /bin/false
- fi
- else
- ret=1
- action $"Stopping $prog: " /bin/false
- fi
- return $ret
- }
- status()
- {
- echo -n $"$prog status is "
- netstat -tnlp|grep "$prog" >/dev/null
- RETVAL=$?
- if [ $RETVAL -eq 0 ];then
- echo -e "\033[32m running \033[0m"
- else
- echo -e "\033[31m stop \033[0m"
- fi
- }
- case "$1" in
- start)
- start ;;
- stop)
- stop ;;
- restart)
- stop
- start ;;
- status)
- status -p ${lockfile} $mongod
- RETVAL=$? ;;
- *)
- echo $"Usage: $prog {start|stop|restart|status|}"
- exit 1
- esac
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。