CentOS yum 安装 Mongo + PHP

  • 内容
  • 评论
  • 相关

CentOS yum 安装 Mongo + PHP pecl mongo 500x341

下载: mongo_php.sh
#!/bin/bash

# install repo
if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then
cat >/etc/yum.repos.d/10gen-mongodb.repo<<ANDYANDY
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
ANDYANDY
else
cat >/etc/yum.repos.d/10gen-mongodb.repo<<ANDYANDY
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
ANDYANDY
fi

# install mongod
yum -y install mongo-10gen mongo-10gen-server
chkconfig --levels 235 mongod on

# install php-pecl-mongo
yum -y install make gcc php-devel
pecl search mongo
pecl install mongo
echo 'extension = mongo.so' > /etc/php.d/mongo.ini

# iptables rule
echo '-A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT' >> /etc/sysconfig/iptables