本文共 1768 字,大约阅读时间需要 5 分钟。
操作系统: ubuntu-16.04-x64mongodb版本:3.6.2
下载mongodb安装包,点击,本次实验选择ubuntu-16.04-x64。
将下载好的安装包上传到linux主机上。
解压安装包并拷贝到安装路径下。
tar xf mongodb-linux-x86_64-ubuntu1604-4.0.0.tgz mv mongodb-linux-x86_64-ubuntu1604-4.0.0 mongodb cp -r mongodb /usr/local
修改环境变量PATH
vim /etc/profile export PATH="$PATH:/usr/local/mongodb/bin" source /etc/profile # 使环境变量的修改立即生效
启动mongodb
mongod --dbpath /usr/local/mongodb/data/ --logpath /usr/local/mongodb/log/mongo.log--dbpath:用于指定mongodb数据文件路径--logpath:用于指定mongodb日志文件路径
启动mongodb client
root@ubuntu:/usr/local/mongodb/logs# mongoMongoDB shell version v3.6.2connecting to: mongodb://127.0.0.1:27017MongoDB server version: 3.6.2Server has startup warnings: 2018-06-28T21:44:48.381-0700 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.2018-06-28T21:44:48.381-0700 I CONTROL [initandlisten] 2018-06-28T21:44:48.381-0700 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.2018-06-28T21:44:48.381-0700 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server. 2018-06-28T21:44:48.381-0700 I CONTROL [initandlisten] ** Start the server with --bind_ip to specify which IP 2018-06-28T21:44:48.381-0700 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to2018-06-28T21:44:48.381-0700 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the2018-06-28T21:44:48.381-0700 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.2018-06-28T21:44:48.381-0700 I CONTROL [initandlisten]
在命令行中输入:
> show dbsadmin 0.000GBconfig 0.000GBlocal 0.000GB
、
转载地址:http://owjmb.baihongyu.com/