ubuntu 部署单机版mongodb

参考官方文档:https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu-tarball/

sudo apt-get install libcurl4 openssl liblzma5
tar -zxvf mongodb-linux-*-6.0.2.tgz
sudo ln -s  /path/to/the/mongodb-directory/bin/* /usr/local/bin/
sudo mkdir -p /var/lib/mongo
sudo mkdir -p /var/log/mongodb
sudo chown `whoami` /var/lib/mongo     # Or substitute another user
sudo chown `whoami` /var/log/mongodb   # Or substitute another user

创建配置文件

systemLog:
  destination: file
  logAppend: true
  path: /data/mongo/mongod.log
storage:
  dbPath: /data/mongo
  journal:
    enabled: true
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /data/mongo/mongod.pid  # location of pidfile
  timeZoneInfo: /usr/share/zoneinfo
net:
  port: 9000
  bindIp: 0.0.0.0

 

启动

mongod --dbpath /data/mongo --logpath /data/mongo/mongod.log -f /data/mongodb-6.0.2/mongod.conf --fork

 其他

安装客户端连接工具

下载:https://www.mongodb.com/try/download/shell?jmp=docs

安装:https://www.mongodb.com/docs/mongodb-shell/install/#std-label-mdb-shell-install

 

posted @ 2022-10-14 19:40  不会跳舞的胖子  阅读(62)  评论(0编辑  收藏  举报