(1)MongoDB安装与配置
在Download MongoDB Community Server | MongoDB中下载MongoDB压缩包
选择版本
上传至虚拟机当中
解压
tar -zxvf mongodb-linux-x86_64-rhel70-6.0.11.tgz
移动到/usr/local/soft/路径下
sudo mv mongodb-linux-x86_64-rhel70-6.0.11 /usr/local/soft/
进入/usr/local/soft,把mongodb-linux-x86_64-rhel70-6.0.11重名为mongodb
sudo mv mongodb-linux-x86_64-rhel70-6.0.11/ mongodb
ll
进入cd /usr/local/soft/mongodb路径下,创建data、logs目录
cd /usr/local/soft/mongodb
mkdir data logs
添加环境变量
sudo vi /etc/proile
添加内容
export PATH=/usr/local/soft/mongodb/bin:$PATH
更新环境变量
source /etc/profile
在/etc/mongodb/conf路径下,新建mongodb.conf
cd /usr/local/soft/mongodb
vi mongodb.conf
在文件中添加内容
dbpath=/usr/local/soft/mongodb/data
logpath=/usr/local/soft/mongodb/logs/mongodb.log
port=27018
fork=true
auth=false
logappend=true
配置环境变量
vi ~/.bash_profile
添加内容
PATH=$PATH:$HOME/bin:/usr/local/soft/mongodb/bin
进入/usr/local/soft/mongodb/bin/路径下
启动MongoDB
cd /usr/local/soft/mongodb/bin/
./mongod --config ../mongodb.conf
安装MongoDB shell
wget https://downloads.mongodb.com/compass/mongodb-mongosh-1.10.6.x86_64.rpm
sudo yum localinstall mongodb-mongosh-1.10.6.x86_64.rpm
sudo yum localinstall mongodb-mongosh-1.10.6.x86_64.rpm
进入MongoDB
mongosh"mongodb://localhost:27018"