Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos 6.7 install mongodb

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Environment introduction

System: CentOS release 6.7 (Final)

Installation directory: / data/

Installation process

Cd / data/tools/

Download wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.9.tgz software, this address is slow.

Baidu cloud disk: http://pan.baidu.com/s/1boNcmZH

[root@sms tools] # tar zxvf mongodb-linux-x86_64-2.6.1.tgz

[root@sms tools] # mv mongodb-linux-x86_64-2.6.1 / usr/local/mongodb

[root@sms tools] # cd / usr/local/

Set environment variabl

# set for mongodb

Export MONGODB_HOME=/usr/local/mongodb

Export PATH=$MONGODB_HOME/bin:$PATH

[root@sms mongodb] # source / etc/profile

Validate environment variables

[root@sms mongodb] # mongod

Mongod mongodump

[root@sms mongodb] # mongod-version

Db version v3.0.6

Create directories and log files

[root@sms mongodb] # mkdir / data/mongodb/ {journal/,log/,data/}-p

[root@sms mongodb] # touch / data/mongodb/log/mongodb.log

Create a profile

[root@sms mongodb] # vim / etc/mongodb.conf

Dbpath=/data/mongodb/data

Logpath=/data/mongodb/log/mongodb.log

Logappend=true

Port=9000

Fork=true

Noauth=true

Nojournal = true

Smallfiles = true

Noprealloc = true

Add users, set directory permissions

[root@sms mongodb] # useradd mongodb-M-s / sbin/nologin

[root@sms mongodb] # chown-R mongodb.mongodb / data/mongodb/

Run the mongodb service

[root@www] # mongod-f / etc/mongodb.conf

Test service

[root@www bin] # mongo 127.0.0.1:9000

Add boot servic

[root@www bin] # vim / etc/rc.local

Mongod-f / etc/mongodb.conf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report