database server of MongoDB
pip3 install rospkg
pip3 install pymongo
-
Go to the official download website. In the "MongoDB Community Server Download" section, select version "3.6.23", platform "Ubuntu 16.04 ARM 64", package "tgz":
NOTE: if your Ubuntu is later than 18.04, please select version 7.0.6. Meanwhile, replace the following contents that are related to the selected package
-
Extract files with the following command:
tar -zxvf mongodb-linux-aarch64-ubuntu1604-3.6.23.tgz
-
Add the MongoDB's path to environment by editing bashrc:
nano ~/.bashrc
Add the following contents. Please do replace <path_of_extracted> with your extracted path:
# mongodb export MONGODB_HOME=<path_of_extracted>/mongodb-linux-aarch64-ubuntu1604-3.6.23 export PATH=$MONGODB_HOME/bin:$PATH
Then, source the bash with command:
source ~/.bashrc
-
Create a path for recording db data. Please do replace with yours:
mkdir -p /<yours>/mongodb/data mkdir /<yours>/mongodb/logs
-
Create configure file for MongoDB
nano /<yours>/mongodb/mongod.conf
Write the following contents:
storage: dbPath: /<yours>/mongodb/data journal: enabled: true systemLog: destination: file logAppend: true path: /<yours>/mongodb/logs/mongod.log net: port: 27017 bindIp: 0.0.0.0
ctrl-o to save, and ctrl-x to quit
-
Launching the server and a client Open a terminal for the server:
mongod --dbpath /<yours>/mongodb/data/ --logpath /<yours>/mongodb/logs/mongod.log –fork
Open another terminal for the client:
mongo --host 127.0.0.1 --port 27017