1.安装mongodb
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-6.0.5.tgz
tar -zxvf mongodb-linux-x86_64-rhel70-6.0.5.tgz
mv mongodb-linux-x86_64-rhel70-6.0.5 mongodb
mv mongodb /usr/local/
cd /usr/local/mongodb/
vim /etc/profile
export MONGODB_HOME=/usr/local/mongodb
export PATH=$PATH:$MONGODB_HOME/bin
source /etc/profile
2.启动mongodb server
mkdir /data/mongo/ -p
mongod -dbpath /data/mongo/ -logpath /data/mongo/mongo.log -logappend -fork -port 27017 --bind_ip 0.0.0.0
3.安装mongodb shell
wget https://downloads.mongodb.com/compass/mongosh-1.6.0-linux-x64.tgz
tar -zxvf mongosh-1.6.0-linux-x64.tgz
sudo cp mongosh /usr/local/bin/
sudo cp mongosh_crypt_v1.so /usr/local/lib/
然后命令行输入
mongosh
show dbs
4.关闭防火墙
systemctl stop firewalld.service