Skip to content

Instantly share code, notes, and snippets.

@Hemanthdev
Last active May 13, 2020 17:17
Show Gist options
  • Save Hemanthdev/9554dc8ca253f9acd50f290cba9c0d23 to your computer and use it in GitHub Desktop.
Save Hemanthdev/9554dc8ca253f9acd50f290cba9c0d23 to your computer and use it in GitHub Desktop.
Mongo-node-install
#!/bin/bash
RPMPATH="dependencies/rpm"
endPoint=$(
hostname -I | cut -d' ' -f1
)
export endPoint
cd $RPMPATH
#echo "$(pwd)"
#ll
rpm -qa |grep "mongo" > /dev/null
if [ $? == 1 ];then
echo "MongoDB not installed, in progress to install."
if [ -f mongodb-org-server-4.2.6-1.amzn2.x86_64.rpm ];then
rpm -ivh mongodb*.amzn2.x86_64.rpm
else
echo "MongoDB rpm doesn't exist in $RPMPATH, Downloading file from Internet"
wget https://repo.mongodb.org/yum/amazon/2/mongodb-org/4.2/x86_64/RPMS/mongodb-org-server-4.2.6-1.amzn2.x86_64.rpm
rpm -ivh mongodb*.rpm
fi
else
echo "MongoDB installation has been completed"
fi
rpm -qa |grep "node" > /dev/null
if [ $? == 1 ];then
echo "Node not installed, in progress to install."
if [ -f node.rpm ];then
rpm -ivh node*.rpm
else
echo "Node rpm doesn't exist in $RPMPATH, Downloading file from Internet"
wget https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodejs-10.19.0-1nodesource.x86_64.rpm
rpm -ivh node*.rpm
fi
npm install pm2 -g
else
echo "Node installation has been completed"
fi
rpm -qa |grep "ejabberd" > /dev/null
if [ $? == 1 ];then
echo "Ejabberd not installed, in progress to install."
if [ -f ejabberd.rpm ];then
rpm -ivh ejabberd.rpm
else
echo "Ejabberd rpm doesn't exist in $RPMPATH, Downloading file from Internet"
wget https://www.process-one.net/downloads/downloads-action.php?file=/20.04/ejabberd-20.04-0.x86_64.rpm
rpm -ivh ejabberd*.rpm
fi
else
echo "Ejabberd installation has been completed"
fi
service mongod start
/etc/init.d/ejabberd start
#!/bin/bash
DEBPATH="dependencies/rpm"
endPoint=$(
hostname -I | cut -d' ' -f1
)
export endPoint
cd $DEBPATH
#echo "$(pwd)"
#ll
dpkg --list |grep "mongo" > /dev/null
if [ $? == 1 ];then
echo "MongoDB not installed, in progress to install."
if [ -f mongodb.deb ];then
dpkg -i mongodb.deb
else
echo "MongoDB doesn't exist in $DEBPATH, Downloading file from Internet"
wget https://repo.mongodb.org/apt/debian/dists/stretch/mongodb-org/4.2/main/binary-amd64/mongodb-org-server_4.2.6_amd64.deb
dpkg -i mongodb*.deb
fi
else
echo "MongoDB installation has been completed"
fi
which node > /dev/null
if [ $? == 1 ];then
echo "Node not installed, in progress to install."
if [ -f node*.tar.gz ];then
tar -C /usr/local/ -zxvf node*.tar.gz
NODEPATH=`ls /usr/temp/ |grep node`
echo "# NodeJS" >> ~/.profile
echo "export NODEJS_HOME=/usr/local/$NODEPATH/bin" >> ~/.profile
echo "export PATH=$NODEJS_HOME:$PATH" >> ~/.profile
. ~/.profile
else
echo "Node doesn't exist in $DEBPATH, Downloading file from Internet"
wget https://nodejs.org/dist/v10.19.0/node-v10.19.0.tar.gz
//add here command for node install after downloading
tar -C /usr/local/ -zxvf node*.tar.gz
NODEPATH=`ls /usr/temp/ |grep node`
echo "# NodeJS" >> ~/.profile
echo "export NODEJS_HOME=/usr/local/$NODEPATH/bin" >> ~/.profile
echo "export PATH=$NODEJS_HOME:$PATH" >> ~/.profile
. ~/.profile
fi
npm install pm2 -g
else
echo "Node installation has been completed"
fi
dpkg --list |grep "ejabberd" > /dev/null
if [ $? == 1 ];then
echo "Ejabberd not installed, in progress to install."
if [ -f ejabberd.rpm ];then
dpkg -i ejabberd.deb
else
echo "Ejabberd doesn't exist in $DEBPATH, Downloading file from Internet"
wget https://www.process-one.net/downloads/downloads-action.php?file=/20.04/ejabberd_20.04-0_amd64.deb
dpkg -i ejabberd*.deb
fi
else
echo "Ejabberd installation has been completed"
fi
service mongod start
/etc/init.d/ejabberd start
#!/bin/bash
RPMPATH="dependencies/rpm"
endPoint=$(
hostname -I | cut -d' ' -f1
)
export endPoint
cd $RPMPATH
#echo "$(pwd)"
#ll
rpm -qa |grep "mongo" > /dev/null
if [ $? == 1 ];then
echo "MongoDB not installed, in progress to install."
if [ -f mongodb-org-server-4.2.6-1.el7.x86_64.rpm ];then
rpm -ivh mongodb-*.el7.x86_64.rpm
else
echo "MongoDB rpm doesn't exist in $RPMPATH, Downloading file from Internet"
wget https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/RPMS/mongodb-org-server-4.2.6-1.el7.x86_64.rpm
rpm -ivh mongodb*.rpm
fi
else
echo "MongoDB already installed"
fi
rpm -qa |grep "node" > /dev/null
if [ $? == 1 ];then
echo "Node not installed, in progress to install."
if [ -f node.rpm ];then
rpm -ivh node*.rpm
else
echo "Node rpm doesn't exist in $RPMPATH, Downloading file from Internet"
wget https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodejs-10.19.0-1nodesource.x86_64.rpm
rpm -ivh node*.rpm
fi
npm install pm2 -g
else
echo "Node already installed"
fi
rpm -qa |grep "ejabberd" > /dev/null
if [ $? == 1 ];then
echo "Ejabberd not installed, in progress to install."
if [ -f ejabberd.rpm ];then
rpm -ivh ejabberd.rpm
else
echo "Ejabberd rpm doesn't exist in $RPMPATH, Downloading file from Internet"
wget https://www.process-one.net/downloads/downloads-action.php?file=/20.04/ejabberd-20.04-0.x86_64.rpm
rpm -ivh ejabberd*.rpm
fi
else
echo "Ejabberd already installed"
fi
service mongod start
/etc/init.d/ejabberd start
#!/bin/bash
RPMPATH="dependencies/rpm"
endPoint=$(
hostname -I | cut -d' ' -f1
)
export endPoint
cd $RPMPATH
#echo "$(pwd)"
#ll
rpm -qa |grep "mongo" > /dev/null
if [ $? == 1 ];then
echo "MongoDB not installed, in progress to install."
if [ -f mongodb-org-server-4.2.6-1.suse15.x86_64.rpm ];then
rpm -ivh mongodb*suse15.x86_64.rpm
else
echo "MongoDB rpm doesn't exist in $RPMPATH, Downloading file from Internet"
wget https://repo.mongodb.org/zypper/suse/12/mongodb-org/4.2/x86_64/RPMS/mongodb-org-server-4.2.6-1.suse12.x86_64.rpm
rpm -ivh mongodb*.rpm
fi
else
echo "MongoDB installation has been completed"
fi
rpm -qa |grep "node" > /dev/null
if [ $? == 1 ];then
echo "Node not installed, in progress to install."
if [ -f node.rpm ];then
rpm -ivh node*.rpm
else
echo "Node rpm doesn't exist in $RPMPATH, Downloading file from Internet"
wget https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodejs-10.19.0-1nodesource.x86_64.rpm
rpm -ivh node*.rpm
fi
npm install pm2 -g
else
echo "Node installation has been completed"
fi
rpm -qa |grep "ejabberd" > /dev/null
if [ $? == 1 ];then
echo "Ejabberd not installed, in progress to install."
if [ -f ejabberd.rpm ];then
rpm -ivh ejabberd.rpm
else
echo "Ejabberd rpm doesn't exist in $RPMPATH, Downloading file from Internet"
wget https://www.process-one.net/downloads/downloads-action.php?file=/20.04/ejabberd-20.04-0.x86_64.rpm
rpm -ivh ejabberd*.rpm
fi
else
echo "Ejabberd installation has been completed"
fi
service mongod start
/etc/init.d/ejabberd start
#!/bin/bash
DEBPATH="dependencies/rpm"
endPoint=$(
hostname -I | cut -d' ' -f1
)
export endPoint
cd $DEBPATH
#echo "$(pwd)"
#ll
dpkg --list |grep "mongo" > /dev/null
if [ $? == 1 ];then
echo "MongoDB not installed, in progress to install."
if [ -f mongodb.deb ];then
dpkg -i mongodb.deb
else
echo "MongoDB doesn't exist in $DEBPATH, Downloading file from Internet"
wget https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/4.2/multiverse/binary-arm64/mongodb-org-server_4.2.6_arm64.deb
dpkg -i mongodb*.deb
fi
else
echo "MongoDB installation has been completed"
fi
which node > /dev/null
if [ $? == 1 ];then
echo "Node not installed, in progress to install."
if [ -f node*.tar.gz ];then
tar -C /usr/local/ -zxvf node*.tar.gz
NODEPATH=`ls /usr/temp/ |grep node`
echo "# NodeJS" >> ~/.profile
echo "export NODEJS_HOME=/usr/local/$NODEPATH/bin" >> ~/.profile
echo "export PATH=$NODEJS_HOME:$PATH" >> ~/.profile
. ~/.profile
else
echo "Node doesn't exist in $DEBPATH, Downloading file from Internet"
wget https://nodejs.org/dist/v10.19.0/node-v10.19.0.tar.gz
//add here command for node install after downloading
tar -C /usr/local/ -zxvf node*.tar.gz
NODEPATH=`ls /usr/temp/ |grep node`
echo "# NodeJS" >> ~/.profile
echo "export NODEJS_HOME=/usr/local/$NODEPATH/bin" >> ~/.profile
echo "export PATH=$NODEJS_HOME:$PATH" >> ~/.profile
. ~/.profile
fi
npm install pm2 -g
else
echo "Node installation has been completed"
fi
dpkg --list |grep "ejabberd" > /dev/null
if [ $? == 1 ];then
echo "Ejabberd not installed, in progress to install."
if [ -f ejabberd.rpm ];then
dpkg -i ejabberd.deb
else
echo "Ejabberd doesn't exist in $DEBPATH, Downloading file from Internet"
wget https://www.process-one.net/downloads/downloads-action.php?file=/20.04/ejabberd_20.04-0_amd64.deb
dpkg -i ejabberd*.deb
fi
else
echo "Ejabberd installation has been completed"
fi
service mongod start
/etc/init.d/ejabberd start
#!/bin/bash
# Currently Supported Operating Systems:
#
# RHEL 5, 6, 7
# CentOS 5, 6, 7
# Debian 7, 8
# Ubuntu 12.04 - 18.04
# SUSE 12- 15
#
APP_DIR=$(pwd)
CONFIG_DIR="$APP_DIR"
SNPDPL_APP=""
# Am I root?
if [ "x$(id -u)" != 'x0' ]; then
echo 'Error: this script can only be executed by root'
exit 1
fi
# Detect OS
if [ -f /etc/os-release ];then
source /etc/os-release
type=$ID
else
[ -f /etc/redhat-release ];then
type=rhel
fi
#case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
# Debian) type="debian" ;;
# Ubuntu) type="ubuntu" ;;
# Amazon) type="amazon" ;;
# Amazon) type="suse" ;;
# *) type="rhel" ;;
#esac
if [[ "$type" == "debian" ]]; then
chmod a+x "${APP_DIR}/install-${type}.sh"
bash "${APP_DIR}/install-${type}.sh" $*
elif [[ "$type" == "ubuntu" ]]; then
chmod a+x "${APP_DIR}/scripts/install-${type}.sh"
bash "${APP_DIR}/scripts/install-${type}.sh" $*
elif [[ "$type" == "suse" ]]; then
chmod a+x "${APP_DIR}/scripts/snpdpl-install-${type}.sh"
bash "${APP_DIR}/scripts/install-${type}.sh" $*
elif [[ "$type" == "rhel" ]]; then
chmod a+x "${APP_DIR}/scripts/install-${type}.sh"
bash "${APP_DIR}/scripts/install-${type}.sh" $*
elif [[ "$type" == "amazon" ]]; then
chmod a+x "${APP_DIR}/scripts/install-${type}.sh"
bash "${APP_DIR}/scripts/install-${type}.sh" $*
else
chmod a+x "${APP_DIR}/scripts/install-${type}.sh"
bash "${APP_DIR}/scripts/install-${type}.sh" $*
fi
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment