wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.7.tgz
tar -xzvf mongodb-linux-x86_64-rhel70-4.2.7.tgz
#创建mongodb.conf
vim mongodb.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /home/work/mongodb/log/mongodb.log
# where to store data.
storage:
dbPath: /home/work/mongodb/data/
# how to start mongod.
processManagement:
fork: true
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
sudo yum install make
sudo wget https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/compat-openssl10-1.0.2o-4.el8_6.x86_64.rpm
sudo rpm -ivh compat-openssl10-1.0.2o-4.el8_6.x86_64.rpm
#运行mongodb服务
/home/work/mongodb/mongodb-linux-x86_64-rhel70-4.2.7/bin/mongod --config /home/work/mongodb/mongodb.conf > log.txt 2>&1 &
#客户端
/home/work/mongodb/mongodb-linux-x86_64-rhel70-4.2.7/bin/mongo