1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# install
sudo apt update
sudo apt install -y mongodb
sudo systemctl status mongodb
# quick test
mongo --eval 'db.runCommand({ connectionStatus: 1 })'
# service
sudo systemctl status/stop/start/restart/disable mongodb
# firewall stuff
sudo ufw allow from your_other_server_ip/32 to any port 27017
sudo ufw status
# open mongodb port (restart needed)
sudo sed -i -e 's/^bind_ip.*/bind_ip=0.0.0.0/g' /etc/mongodb.conf
|