Last active
September 17, 2020 09:55
-
-
Save sheikhwaqas/f2c0301099c293fc2fdccc46bb48186a to your computer and use it in GitHub Desktop.
Install mongoDB 3.4 on Ubuntu 16.04 LTS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# 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 "Thanks for using this script." | |
############################################################################### |
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.
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
Thank you!