Ubuntu under MongoDB First install configuration

Source: Internet
Author: User

1 Downloads
https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tgz
2 unzip and copy to/usr/local/mongodb
tar -zxvf mon*cp mongodb-linux-x86_64-3.0.6 /usr/local/mongo
3 Configuring Environment Variables/etc/profile
sudo  
4 Create a new data folder and log file (MongoDB is the place to store the information and logs, but he will not create it on its own).
sudo mkdir /usr/local/mongodb/data  #创建mongodb数据库存放路径sudo mkdir /usr/local/mongodb/log   #创建mongodb日志存放路径touch /usr/local/mongodb/log/mongodb.log   #创建mongodb日志文件补充: mongodb默认的数据会放到/data/db下 此处我们把日志文件放到mongodb目录下 方便以后查找,修改文件权限 (因为刚才我们创建的文件 都是用sudo命令创建的,所以 文件的owner 都是属于root 而我们平时用的用户都是非root的)sudo chown -R kk:kk /usr/local/mongodb/*
5 Start
mongod -dbpath=/usr/local/mongodb/data -logpath=/usr/local/mongodb/log/mongodb.log -logappend -port 27017 --fork --auth参数说明  启动服务时用到的如下:  --dbpath 数据库路径  --logpath 日志文件路径  --logappend 日志在日志文件末尾追加  --port 启用的端口号【可不写,默认是27017】  --fork 让mongodb服务在后台运行       --auth

Ubuntu under MongoDB First install configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.