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

How centos8 installs mongodb 4.2 using yum

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

Share

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

1. Make repo files.

Refer to the official mongodb installation documentation and use the following script to make the Yum library to install mongodb4.2, but the installation process prompts "Failed to synchronize cache for repo 'mongodb-org-4.2'"

[mongodb-org-4.2] name=MongoDB Repositorybaseurl= https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/gpgcheck=1enabled=1gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc

The reason is that the official installation package for centos8 has not been provided yet, so since the $releasever variable is 8, try to write the address to 7 to see if a centos7-based version can be installed.

All right, use vim to create the repo file

Sudo vim / etc/yum.repos.d/mongodb-org-4.2.repo

Enter the following configuration into the repo file, then save it, and exit vim

[mongodb-org-4.2] name=MongoDB Repositorybaseurl= https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/gpgcheck=1enabled=1gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc

2. Use yum command to install

Sudo yum install-y mongodb-org

In the past, the installation process was unsuccessful because the network was too slow, so just execute it one more time. After a period of time, it was prompted that the installation was successful and the process was smooth.

3. Start mongodb

After installing the startup service, you can use the

The start, stop, and restart commands are as follows:

Sudo service mongod startsudo service mongod stopsudo service mongod restart

4. Open the remote connection of mongodb

The configuration file for mongodb is / etc/mongod.conf

If you want to open remote access, you need to modify the bindIp value of the file to: 0.0.0.0, otherwise you can't connect through other computers.

Sudo vim / etc/mongod.conf

After the file is modified, restart should be executed to make the configuration take effect.

Sudo service mongod restart

If you still cannot connect remotely, have the firewall open port 27017 (which is the default port for mongodb, and the port for mongodb can be modified through the configuration file)

Firewall-cmd-permanent-zone=public-add-port=27017/tcpfirewall-cmd-reload

Refer to the official installation documentation:

Https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/#run-mongodb-community-edition

Summary

The above is the editor to introduce to you centos8 use yum to install mongodb 4.2 method, hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!

If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!

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