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