Created
April 19, 2020 06:36
-
-
Save hkhoshraftar/32ffdecd0147c2b81fbfa9f862d29bd7 to your computer and use it in GitHub Desktop.
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
cd /opt | |
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.5.tgz | |
tar -zxvf mongodb-linux-x86_64-4.0.5.gz | |
ln -s mongodb-linux-x86_64-4.0.5 mongodb | |
useradd mongod | |
mkdir -p /var/lib/mongo | |
chown -R mongod:mongod /opt/mongodb* | |
chown -R mongod: /var/lib/mongo | |
nano /etc/mongod.conf | |
----------------------------- | |
storage:2 | |
dbPath: "/var/lib/mongo" | |
journal: | |
enabled: true | |
net: | |
port: 27017 | |
bindIp: "127.0.0.1" | |
------------------------------ | |
nano /etc/systemd/system/mongod.service | |
----------------------------- | |
[Unit] | |
Description=MongoDB | |
After=syslog.target network.target | |
[Service] | |
Type=simple | |
User=mongod | |
Group=mongod | |
ExecStart=/opt/mongodb/bin/mongod --config /etc/mongod.conf | |
[Install] | |
WantedBy=multi-user.target | |
----------------------------- | |
systemctl daemon-reload | |
systemctl status mongod | |
setenforce 0 | |
systemctl daemon-reload | |
systemctl status mongod | |
systemctl start mongod | |
systemctl status mongod | |
nano /root/.bash_profile | |
------------------------ | |
## mongodb | |
PATH=$PATH:/opt/mongodb/bin | |
------------------------ | |
. ~/.bash_profile | |
setenforce 1 | |
mongo | |
mongo shell | |
systemctl enable mongod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment