Last active
May 8, 2018 04:04
-
-
Save jamesguan/d82af96a7b7ce76fce371df6a9ba659c to your computer and use it in GitHub Desktop.
Installing/upgrading and uninstalling mongodb on centos 7
This file contains hidden or 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
// Commands: | |
mongod --version // Check version | |
which mongo // Check where mongo is | |
// Locations: | |
Logs are stored in /var/log/mongodb | |
Something is stored in /var/lib/mongo | |
Installing | |
// Go to: | |
cd /etc/yum.repos.d/ | |
// Edit mongo-org.rep and replace version number to point to different versions. | |
vim mongodb-org.rep | |
// Replace X with version number | |
[mongodb-org-X.X] | |
name=MongoDB Repository | |
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/X.X/x86_64/ | |
gpgcheck=1 | |
enabled=1 | |
gpgkey=https://www.mongodb.org/static/pgp/server-X.X.asc | |
// Check yum repolist: | |
yum repolist | |
yum -y install mongodb-org | |
// Run mongodb with this: | |
systemctl start mongod // Probably use sudo because of permissions | |
netstat -plntu | |
systemctl status mongod | |
// Run with config file: | |
mongod -f /etc/mongod.conf | |
// Run with config and tail logs: | |
mongod -f /etc/mongod.conf & tail -qF /var/log/mongodb/mongod.log | |
// Uninstalling // | |
// Using yum: | |
sudo yum erase $(rpm -qa | grep mongodb-org) | |
// Remove data | |
sudo rm -r /var/log/mongodb | |
sudo rm -r /var/lib/mongo | |
// Using rpm: | |
rpm -qa | less | grep mongo | xargs yum remove | |
Links: | |
https://docs.mongodb.com/manual/reference/method/db.createUser/ | |
https://docs.mongodb.com/manual/reference/built-in-roles/ | |
https://docs.mongodb.com/manual/core/wiredtiger/ | |
https://docs.mongodb.com/manual/reference/configuration-options/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment