Skip to content

Instantly share code, notes, and snippets.

@nestoru
Last active September 3, 2020 08:42
Show Gist options
  • Save nestoru/e3782e260c2c9f2a9012dd79a3db9fd5 to your computer and use it in GitHub Desktop.
Save nestoru/e3782e260c2c9f2a9012dd79a3db9fd5 to your computer and use it in GitHub Desktop.
Ubuntu MongoDB install
# Mongo 3
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv BC711F9BA15703C6
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3-4.list
sudo apt-get update
sudo apt-get install -y mongodb-org=3.0.16 mongodb-org-server=3.0.16 mongodb-org-shell=3.0.16 mongodb-org-mongos=3.0.16 mongodb-org-tools=3.0.16
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections
sudo service mongod start
sudo tail -f /var/log/mongodb/mongod.log
# Or use something like the below to run it in the terminal directly and even specify any database of your choice
mongod --dbpath /home/<user>/Downloads/lms_local_mongo_data/
$ Mongo 4
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org=4.0.10 mongodb-org-server=4.0.10 mongodb-org-shell=4.0.10 mongodb-org-mongos=4.0.10 mongodb-org-tools=4.0.10
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections
sudo service mongod start
sudo tail -f /var/log/mongodb/mongod.log
# Or use something like the below to run it in the terminal directly and even specify any database of your choice
mongod --dbpath /home/<user>/Downloads/lms_local_mongo_data/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment