technical skills grow

Responsive Ads Here

Tuesday, June 8, 2021

Install mongo shell

If you want to install mongo database in Server

vim mongo_install.sh

 !/usr/bin/env bash
# run this script from your home folder
# sudo bash
curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.12.tgz

tar -zxvf mongodb-linux-x86_64-2.6.12.tgz
cp mongodb-linux-x86_64-2.6.12/bin/* /usr/local/bin
groupadd mongodb
useradd --system --no-create-home -g mongodb mongodb

mkdir -p /var/log/mongodb
touch /var/log/mongodb/mongodb.log

mkdir -p /var/lib/mongodb/

chown mongodb:mongodb -R /var/lib/mongodb
chown mongodb:mongodb -R /var/log/mongodb

cat > /etc/mongod.conf <<EOF
dbpath=/var/lib/mongodb
logpath=/var/log/mongodb/mongodb.log
logappend=true
EOF

cat > /etc/systemd/system/mongodb.service <<EOF
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb

No comments:

Post a Comment

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts