Pages

2013年3月12日火曜日

MongoDb を入れてみた


CentOS 5.8 に MongoDb 2.2.3 を入れてみた。

$ su -
# cd /usr/local/src
# wget http://downloads.mongodb.org/linux/mongodb-linux-i686-2.2.3.tgz
# tar zxvf mongodb-linux-i686-2.2.3.tgz
# mv mongodb-linux-i686-2.2.3.tgz ../

# ln -s /usr/local/mongodb-linux-i686-2.2.3 /usr/local/mongodb
# ln -s /usr/local/mongodb/bin/bsondump /usr/local/bin/bsondump
# ln -s /usr/local/mongodb/bin/mongo /usr/local/bin/mongo
# ln -s /usr/local/mongodb/bin/mongod /usr/local/bin/mongod
# ln -s /usr/local/mongodb/bin/mongodump /usr/local/bin/mongodump
# ln -s /usr/local/mongodb/bin/mongoexport /usr/local/bin/mongoexport
# ln -s /usr/local/mongodb/bin/mongofiles /usr/local/bin/mongofiles
# ln -s /usr/local/mongodb/bin/mongoimport /usr/local/bin/mongoimport
# ln -s /usr/local/mongodb/bin/mongorestore /usr/local/bin/mongorestore
# ln -s /usr/local/mongodb/bin/mongos /usr/local/bin/mongos
# ln -s /usr/local/mongodb/bin/mongosniff /usr/local/bin/mongosniff
# ln -s /usr/local/mongodb/bin/mongostat /usr/local/bin/mongostat

# useradd mongod
# mkdir -p /var/lib/mongo
# mkdir -p /var/log/mongo
# chown mongod.mongod /var/lib/mongo
# chown mongod.mongod /var/log/mongo

自動起動のためにソース版からちょこっとファイルを拝借。。

# cd /usr/local/src
# wget http://downloads.mongodb.org/src/mongodb-src-r2.2.3.tar.gz
# tar zxvf mongodb-src-r2.2.3.tar.gz
# cd mongodb-src-r2.2.3/rpm
# cp init.d-mongod /etc/rc.d/init.d/mongod
# vi /etc/rc.d/init.d/mongod
-----
mongod=${MONGOD-/usr/bin/mongod}
-----
↓ 修正

-----
mongod=${MONGOD-/usr/local/bin/mongod}
-----


# chmod +x /etc/rc.d/init.d/mongod
# cp mongod.conf /etc/mongod.conf

# service mongod start
# chkconfig mongod on

0 件のコメント:

コメントを投稿

Followers