代码语言:javascript复制
tar -zxvf filename.tgz
mkdir mongodb
mv mongodb-3.4.4 mongodb
cd mongodb
mkdir data
mkdir logs
cd logs/
touch mongo.log
cd ..
mkdir etc
cd etc
vi mongo.conf
代码语言:javascript复制dbpath=/mongodb/data
logpath=/mongodb/logs/mongo.log
logappend=true
journal=true
quiet=true
port=27017
:wq
代码语言:javascript复制cd ..
cd mongodb-3.4.4/bin/
mongod -f /mongodb/etc/mongo.conf
cd /
ln -s /mongodb/mongodb-3.4.4/bin/mongo /usr/local/bin/mongo
ln -s /mongodb/mongodb-3.4.4/bin/mongod /usr/local/bin/mongod
mongo
连接失败的话就先本地连接mongodb
代码语言:javascript复制ssh username@ip
mongod -f /mongodb/etc/mongo.conf
然后服务器根目录再输入
代码语言:javascript复制mongo