Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install mongoDB 3.4 on Ubuntu 16.04 LTS
###############################################################################
# Install mongoDB Server on Ubuntu 16.04 LTS
###############################################################################
# Import the Public Key used by the Ubuntu Package Manager
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
# Create a file list for mongoDB to fetch the current repository
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
# Update the Ubuntu Packages
apt update
# Install MongoDB
apt install mongodb-org -y
# Change mongoDB Listening IP Address from local 127.0.0.1 to All IPs 0.0.0.0
sed -i 's/127\.0\.0\.1/0\.0\.0\.0/g' /etc/mongod.conf
# Start the MongoDB Service
service mongod start
# End Script
echo "Please do run mysql_secure_installation to Secure your MySQL Installation."
echo "Thanks for using this script."
###############################################################################
@cn007b

This comment has been minimized.

Copy link

cn007b commented Jun 9, 2017

Thank you!

@waynebaylor

This comment has been minimized.

Copy link

waynebaylor commented Nov 13, 2017

if you're going to have mongo listening on all ip addresses, then you should also secure it by creating a user and enabling authentication.

also, line #24 refers to MySQL not mongo.

@sivaprakashDesingu

This comment has been minimized.

Copy link

sivaprakashDesingu commented Feb 24, 2020

When I was tried the above steps, My system automatically installed with V4.2.5, so I tied the below command which downgraded the version to 3.4.9

sudo apt-get install -y --allow-downgrades mongodb-org=3.4.10 mongodb-org-server=3.4.10 mongodb-org-shell=3.4.10 mongodb-org-mongos=3.4.10 mongodb-org-tools=3.4.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.