title: How do i install MongoDb on Ubuntu and set the config at install time
body: <p>I am creating an automated deployment for a cloud server and I need to get Mongodb installed, configured and running in one script. I won't have access to the server as the deployment server pulls my scripts from git.</p>
  
  <p>My issue is I need to set the logpath and dbpath to another location. How do i do this using apt-get. What I use at the moment is below but it sets the path to the default location.</p>
  
  <pre><code>apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
  echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | tee -a /etc/apt/sources.list.d/10gen.list
  apt-get -y update
  apt-get -y install mongodb-10gen
  </code></pre>