Install the mongdb
#!/bin/bash
#Function: Install the mongdb
#Author: WangDonghui
#Date: 20180124
#Installing mongdb
echo "===========Installing mongdb!!!=============="
mkdir /opt/server/mongodb
mkdir /opt/server/mongodb/data
mkdir /opt/server/mongodb/logs
cd /root/package
curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.1.tgz
tar xf mongodb-linux-x86_64-3.2.1.tgz
cd mongodb-linux-x86_64-3.2.1
cp -rp * /opt/server/mongodb
cat > /etc/profile.d/mongo.sh << EOF
export PATH=$PATH:/home/mongodb/bin
EOF
source /etc/profile.d/mongo.sh
cat >/opt/server/mongodb/mongodb.conf << EOF
dbpath=/opt/server/mongodb/data
logpath=/opt/server/mongodb/logs/mongodb.log
pidfilepath=/opt/server/mongodb/mongodb.pid
port=27017
directoryperdb=true
logappend=true
oplogSize=2000
fork=true
#replSet=
bind_ip=192.168.20.169
EOF
/opt/server/mongodb/bin/mongod -f /opt/server/mongodb/mongodb.conf
#Installing the php mongdb module
echo "===========Installing the php mongdb module!!!=============="
cd /root/package
wget http://pecl.php.net/get/mongo-1.4.5.tgz
tar zxf mongo-1.6.14.tgz
cd mongo-1.6.14
/opt/server/php/bin/phpize
./configure --with-php-config=/opt/server/php/bin/php-config
make && make install
cat >>/opt/server/php/lib/php.ini<< EOF
extension=mongo.so
EOF
ps -ef |grep mongdb
/opt/server/php/bin/php -m
echo '======install complete '