There was a problem when I installed mongodb on the linux system.

operating system: CentOS 7.464-bit
installation official website has the best time to operate step by step

sudo service mongod start

the result is:

Redirecting to / bin/systemctl start mongod.service
Failed to start mongod.service: Unit not found.

it"s strange that I don"t know what the problem is. Do you have a boss to tell me

Mar.29,2021

you post your installation steps, too. According to the official website, there is no problem with the installation. The official installation package comes with a systemd script


try two solutions

sudo systemctl unmask mongodb
sudo service mongod start

or
1 create a profile:

sudo nano /etc/systemd/system/mongodb.service

2 copy code

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
 
[Install]
WantedBy=multi-user.target

3 Press ctrl+X to quit
4 start the service

sudo systemctl start mongodb
sudo systemctl status mongodb

5 Let it start permanently

sudo systemctl enable mongodb

I don't know whether you have solved it or not. It is recommended that you use docker installation

because the possible problems vary according to your personal environment. < hr >

1. Install docker script: $curl-sSL https://get.docker.com/ | sh
2. Install DB script (link parameter is required to back up container data in formal environment, but not in development environment):
$docker run-- name mongoDB-d-P mongo
3. Check the mapped port: docker ps-a
4. Next, turn off the firewall and use the database tool to access


first, I have solved it, second, I followed the official website step by step, and third, I solved it violently. I reset the server and then installed it.


Command: systemctl start mongod.service

Menu