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 Mongodb online and offline in CentOS

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "the method of installing Mongodb online and offline of CentOS". In daily operation, I believe that many people have doubts about the method of installing Mongodb online and offline of CentOS. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "the method of installing Mongodb online and offline of CentOS". Next, please follow the editor to study!

1. Offline installation: (in two batches, with and without linux foundation)

Comrades who have the foundation of linux can read:

Install the package:

Installation process

Install the pstree gadget and its use

Close mongodb

Set up boot boot:

Comrades without linux foundation:

First, go to the official to download the offline installation package:

Ftp connects to the server and uploads the offline package

Xshell connection:

Extract the file (you can press the tab key if you type a bit, and it will be completed automatically): tar-xzf mongo*

If the decompression command is not clear, you can go to the document library to see the basic command.

Switch to the root user, copy the folder to the / usr/local directory (where software is usually installed), and rename the folder

Cp-r mongodb-. / usr/local/mv mongodb..../ mongodb

For those who do not understand the command, please see:

Change to the / usr/local/mongodb directory, create a database directory and journal files, and run mongod (. / represents the current directory) in the background.

Mkdir dbstouch logs./mongod-dbpath=/usr/local/mongodb/dbs/-logpath/usr/local/mongodb/logs-fork

View the process and end the process

Pstree-p | grep mongodpkill mongod

If the prompt does not have the pstree command, it means that you are also the smallest installation. Don't panic, just install it.

Yum install-y psmisc (for rest assured applications, you can do-y, fully automated installation, do not rest assured to read one by one)

Is it too troublesome to start? Can be simplified as shown in the figure

If you are using vi for the first time, press I first to enter edit mode. After typing, press esc and enter: wq enter. If you find that you can't get back no matter what you do, don't be afraid, force to withdraw: Q!

Enter. / mongod-f mongod.conf to start

Generally speaking, it is OK to add startup items, and it is also done when playing kali against the sky. The last time ssh can't be started, it is also done the same way. For some reason, centos can't do this, so skip this step.

Change to this directory first: cd / lib/systemd/system

Then create a service for mongodb: vi mongodb.service

Enter the following:

[unit] description=mongodb after=network.target remote-fs.target nss- lookup.target [service] type=forkingexecstart=/usr/local/mongodb/bin/mongod-- config / usr/local/mongodb/bin/mongod.confexecreload=/bin/kill-s hup $mainpidexecstop=/usr/local/mongodb/bin/mongod-- shutdown-- config / usr/local/mongodb/bin/mongod.confprivatetmp= truth [install] wantedby=multi-user.target

Start the service:

Systemctl start mongodb.service

Stop the service:

Systemctl stop mongodb.service

Boot:

Systemctl enable mongodb.service

For those who are not clear, you can read the commonly used linux documents:

After rebooting, I found that mongodb has been booted and self-started!

Now you can delete the initial files.

two。 Online installation:

It is basically not difficult to install online, just follow the official documentation:

Packet information

Note that the installation only supports 64 systems.

Add Fil

The content is given by the government:

Install it, it's extremely slow.

Has been installed, the following will not be happy to continue to send, boring, follow the official documents to go through

Continue another day. Hey, the following pictures prove that the database is fine.

At this point, the study on "the method of installing CentOS online and offline Mongodb" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Internet Technology

Wechat

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

12
Report