Installing MongoDb on Ubuntu Hardy from source with init.d and data dir

After setting up mongo by hand for 2 servers that are not deployed via puppet, here is a bash script to do it…


sudo su root

cd /opt/ && /usr/bin/curl -OL http://downloads.mongodb.org/linux/mongodb-linux-x86_64-1.4.1.tgz && tar -zxvf mongodb-linux-x86_64-1.4.1.tgz && ln -s /opt/mongodb-linux-x86_64-1.4.1 /opt/mongodb

useradd mongod -u 5005

curl http://gist.github.com/raw/413433/834a3d0ecc96cb36f8918f6d01b65fc082025cc0/gistfile1.sh > /etc/init.d/mongodb

chown mongod:mongod /etc/init.d/mongodb
chmod 750 /etc/init.d/mongodb

mkdir /etc/mongodb
chown mongod:mongod /etc/mongodb
chmod 750 /etc/mongodb

echo "dbpath=/opt/mongodb-data/" > /etc/mongodb/mongodb.conf
chown mongod:mongod /etc/mongodb/mongodb.conf
chmod 750 /etc/mongodb/mongodb.conf

mkdir /opt/mongodb-data
chown mongod:mongod /opt/mongodb-data
chmod 750 /opt/mongodb-data

2 thoughts on “Installing MongoDb on Ubuntu Hardy from source with init.d and data dir

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s