How to Install MongoDB using shell script?
<p>We can install MongoDB by placing the below code in shell script file<br></p>

<pre><code>if [ ! -f /usr/bin/mongod ]; then&lt;br&gt;
  sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br&gt;
  echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br&gt;
  sudo apt-get -y update
  sudo apt-get install -y mongodb-org&lt;br&gt;
else
  echo "mongo db already installed.  Skipping..."
fi
</code></pre>