Go to the official website to download and download the compressed package corresponding to the platform and architecture
service management
sudo nano /etc/systemd/system/mongoDB.service
write
[Unit]
# Service name, customizable
Description = mongodb Service
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
# The command to start frps needs to be modified to your mongod installation path, for example /usr/bin/mongod --config /etc/mongod.conf
ExecStart = /usr/bin/mongod --config / etc/mongod.conf
[Install]
WantedBy = multi-user.target
Open http://localhost:27017 in the browser to test
# Start mongoDB
systemctl start mongoDB
# Stop mongoDB
systemctl stop mongoDB
# Restart mongoDB
systemctl restart mongoDB
# View mongoDB status
systemctl status mongoDB
configure mongoDB to start automatically.
systemctl enable mongoDB