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

Install MongoDB

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

You can install MongoDB after installing epel-release 's yum source on CentOS, but the version is older, and you can install a newer version of MongoDB if you use MongoDB's official yum.

Need to be networked

Vi / etc/yum.repos.d/mongodb-4.0.repo configure the YumSource of MongoDB: [mongodb-org-4.0] name=MongoDB Repositorybaseurl= https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/gpgcheck=1enabled=1gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc

Install MongoDB:yum install-y mongodb-org Note: yum installation installs the following packages: MongoDB official source contains the following dependent packages: mongodb-org: MongoDB meta-package, the installation automatically installs the following four component packages: mongodb-org-server: contains the Mongod daemon and related configuration files and init system service scripts. Mongodb-org-mongos: a daemon that contains mongos. Mongodb-org-shell: contains mongo shell. Mongodb-org-tools: management tools including MongoDB: mongoimport, bsondump, mongodump, mongoexport, mongofiles, mongooplog, mongoperf, mongorestore, mongostat, and mongotop. Modify the configuration file vi / etc/mongod.conf bind_ip=192.168.80.100 of mangodb to set the listening port to facilitate the connection of systemctl start mongod.servicenetstat-anpt | grep mongod

Mongo login:

Mongo

-above is yum installation mongodb-

Source code compilation

1. Download wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.5.tgz2, extract the package tar xzvf mongodb-linux-x86_64-rhel70-4.0.5.tgz-C / opt/3, move the extracted directory to / usr/local and rename it to mongodbcd / opt/mv mongodb-linux-x86_64-rhel70-4.0.0 / / usr/local/mongodb4, Create a data storage directory and a log file directory mkdir-p / usr/local/mongodb/data/dbmkdir-p / usr/local/mongodb/logs 5, Edit the mongodb startup configuration file cd / usr/local/mongodb/binvim mongodb.conf dbpath = / usr/local/mongodb/data/db / / data storage directory logpath = / usr/local/mongodb/logs/mongodb.log / / log file directory fork = true / / background running auth=true / / authentication bind_ip=0.0.0.0 / / listening address 6, the executable file of mongodb is located in the bin directory You need to add it to the PATH path to add the source / etc/profile / / reload environment variable at the end of vim / etc/profileexport MONGODB_HOME=/usr/local/mongodbexport PATH=$PATH:$MONGODB_HOME/bin / /

7. Start mongodbcd / usr/local/mongodb/binmongod-f mongodb.conf / / start 8, connect to mongodb and visit / usr/local/mongodb/bin/mongo or mangodb

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

Servers

Wechat

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

12
Report