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

The method of installing MongoDB4.0 on CentOS and RHEL

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces the method of installing MongoDB4.0 on CentOS and RHEL, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

MongoDB is an extremely flexible index support and rich query database. It is an NoSQL database that provides a grid for large media storage. MongoDB has released a new stable version 4. 0 with many major new features.

Step 1: add a MongoDB yum repository

Depending on the desired MongoDB version and system architecture, add the following to the yum repository configuration file mongodb.repo. For the purposes of this article, we are using the MongoDB 4.0 repository.

CentOS and RedHat systems only

# vi / etc/yum.repos.d/ Mongodb.repo [MongoDB] name=MongoDB Repositorybaseurl= http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/gpgcheck=0enabled=1

Fedora users can install it from their official yum repository.

Step 2: install the MongoDB server

Let's use the yum package manager to install the mongodb-org package, which automatically installs all its dependencies. To install any specific version of MongoDB, specify the package name, such as mongodb-org-4.0.0. The following command installs the latest stable version.

# yum install mongodb-org

Step 3: start the MongoDB service

The mongodb org server package provides a mongodb init script that is used to start the service.

# / etc/init.d/mongod restart

Configure MongoDB to start automatically when the system starts.

# chkconfig mongod on

Step 4: check the MongoDB version

Check the installed version of MongoDB using the following command

[root@tecadmin ~] # mongod-- versiondb version v4.0.0git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51OpenSSL version: OpenSSL 1.0.0-fips 29 Mar 2010allocator: tcmallocmodules: nonebuild environment: distmod: amazon distarch: x86'64 target_arch: x86'64

Use the command line to connect to MongoDB and execute some test commands to check that it is working properly.

[root@tecadmin ~] # mongo > use mydb; > db.test.save ({a: 1}) > db.test.find () {"_ id": ObjectId ("54fc2a4c71b56443ced99ba2"), "a": 1}

The MongoDB server has been successfully installed on the system.

Thank you for reading this article carefully. I hope it will be helpful for everyone to share the method of installing MongoDB4.0 on CentOS and RHEL. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

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