1. Configure the Yum source for MongoDB
- To create a Yum source file:
vim /etc/yum.repos.d/mongodb-org-3.4.repo
- Add the following content:
[mongodb-org-3.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/ gpgcheck=0 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
Update all packages before installing:
yum update (可选操作)
2. Installing MongoDByum -y install mongodb-org
3. Set Boot upsystemctl enable mongod.service
4. Set up MongoDB remote access:
- Edit mongod.conf
vim /etc/mongod.conf
- Comment out the Bindip
and restart MongoDB.
5. Common operation
- Start Mongodb:systemctl start Mongod.service
- Stop Mongodb:systemctl Stop Mongod.service
Find the status of MongoDB: Systemctl status Mongod.service
6. Start the MONGO shell
- Command:
mongo
Enter the shell
View database show dbs
and more commands
At last
Hello everyone, this is "taoland", this blog is mainly used to record a rookie program ape Growth Road. This is my first time to do blog, hope and we have a lot of communication, grow together! The article will be updated synchronously at the following address ...
Personal blog: www.yangyuetao.cn
Small program: Taoland
CENTOS7 installation MongoDB3.4