1.mkdir mongodb
2.cd mongodb
3.获取mongodb包
curl -x xxx.proxy https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-server_5.0.5_amd64.deb -O -J -L
4.解压
dpkg -x mongodb-org-server_5.0.5_amd64.deb .
5.vim etc/mongod.conf
6.修改配置文件
mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /xxxxxxx/mongodb/data/
journal:
enabled: true
# engine:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /xxxxx/logs/mongod.log
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
7.touch start_mongod.sh
8.vim start_mongod.sh
#!/bin/bash
DATA_BASE=/home/gta/mongodb
$DATA_BASE/usr/bin/mongod --config $DATA_BASE/etc/mongod.conf --fork
9 sudo vim /etc/profile
export PATH=$PATH:/xxxxxxxxxxx/bin
10.source /etc/profile
11.启动start_mongod.sh
XXXXXXXXXXX:~/bin$ start_mongod.sh
about to fork child process, waiting until server is ready for connections.
forked process: 1902191
child process started successfully, parent exiting