Here are a list of commands that I have executed to install MongoDB into Ubuntu 16.04 LTS Xenial server.
Pre-requisites:
apt install software-properties-common
apt-get update
Add MongoDB repository:
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
apt-get update
Install MongoDB Server Files:
apt-get install -y mongodb-org
Setup start-up script:
nano /etc/systemd/system/mongodb.service
Insert the following lines of content:
[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
Enable start-up script:
DONE - how to use your new MongoDB:
Configuration file is located here:
/etc/mongodb.conf
To Start service:
systemctl start mongodb
To Stop service:
systemctl stop mongodb
To Check Status of service:
systemctl status mongodb
/etc/mongodb.conf
To Start service:
systemctl start mongodb
To Stop service:
systemctl stop mongodb
To Check Status of service:
systemctl status mongodb
MongoDB will start automatically on your next server boot process.
Enjoy! - if you experience any issue - pls leave me a comment. Thanks
No comments:
Post a Comment