Skip to content

Instantly share code, notes, and snippets.

@SeonghoonKim
Created December 26, 2012 09:20
Show Gist options
  • Save SeonghoonKim/4379081 to your computer and use it in GitHub Desktop.
Save SeonghoonKim/4379081 to your computer and use it in GitHub Desktop.
mongodb install script for RHEL/CentOS 6
#!/bin/bash
MONGODB_REPO="/etc/yum.repos.d/10gen-mongodb.repo"
if [ -f ${MONGODB_REPO} ]; then
echo "$MONGODB_REPO found"
else
cat << 'EOF' > ${MONGODB_REPO}
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/$basearch
enabled = 1
gpgcheck=0
EOF
fi
echo "Installing MongoDB..."
yum install -y mongo-10gen mongo-10gen-server
echo "Installing init script of MongoDB..."
chkconfig --level 2345 mongod on
echo "Starting MongoDB..."
service mongod start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment