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 and uninstall MongoDB using the Yum source on CentOS 7

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

Share

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

1. Configure Yum Feed

1vim / etc/yum.repos.d/mongodb-org-3.4.repo

[mongodb-org-3.4]

Name=MongoDB Repository

Baseurl= https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/

Gpgcheck=1

Enabled=1

Gpgkey= https://www.mongodb.org/static/pgp/server-3.4.asc

two。 Install MongoDB

Mongodb-org will contain mongodb-org-server, mongodb-org-mongos, mongodb-org-shell, mongodb-org-tools

1sudo yum install-y mongodb-org

3. Configure SELinux

1semanage port-a-t mongod_port_t-p tcp 27017

Or

1vi / etc/selinux/config

SELINUX=disabled

Restart

Or

1vi / etc/selinux/config

SELINXU=permissive

Restart

4. Check data and log file access permissions

The default data file is / var/lib/mongo, and the default log file is / var/log/mongodb. When the file directory is modified in the configuration file / etc/mongod.conf, be sure to grant mongod user access.

5. Modify bind_ip

The default bind_ip setting is 127.0.0.1, modify it as needed, and then restart the service.

6. Start the service

123systemctl start mongod systemctl enable mongod ss-tunpl | grep 27017

Uninstall MongoDB

This process will completely remove MongoDB, its configuration, and all databases.

1. Out of Service

1systemctl stop mongod

two。 Remove package

1sudo yum erase $(rpm-qa | grep mongodb-org)

3. Remove data and log files

12sudo rm-r / var/log/mongodb sudo rm-r / var/lib/mongo

Reference:

Https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

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