Skip to content

Instantly share code, notes, and snippets.

@airbornelamb
Last active February 13, 2018 01:07
Show Gist options
  • Save airbornelamb/f06c8efe3d4879b46cb7f3bbacd2c593 to your computer and use it in GitHub Desktop.
Save airbornelamb/f06c8efe3d4879b46cb7f3bbacd2c593 to your computer and use it in GitHub Desktop.
Server setup script installs official mongoDB and nodejs for Ubuntu Xenial 16.04 with options for cloud9, gitlab, and several popular Javascript Frameworks (express-generator meteor create-react-app feathers-cli)
#!/bin/bash
echo "This script installs the mongoDB and nodejs for Ubuntu Xenial 16.04"
echo "You then have options for express-generator, meteor, create-react-app, and feathers"
sleep 3
sudo apt-get update
sudo apt-get install -y git curl
# Install mongodb 3.4
clear
echo "Installing mongodb"
sleep 2
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
sleep 5
sudo service mongod status
sleep 5
# Install nodejs 7.x
clear
echo "Installing nodejs 7.x"
sleep 2
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
# Install bower, gulp, nodemon and yarn
clear
echo "Installing yarn bower gulp grunt-cli nodemon"
sleep 2
sudo npm update -g npm
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install -y yarn
sudo yarn global add bower gulp webpack grunt-cli nodemon
sudo chown -R `whoami` ~/.npm
# Frameworks
clear
echo "Enter number of framework to install: "
options=("cloud9ide" "gitlab" "express" "meteor" "react" "feathers" "vue" "quit")
select opt in "${options[@]}"
do
case $opt in
"cloud9ide")
echo "you chose the cloud9 IDE, beware it is in ALPHA"
git clone git://github.com/c9/core.git c9sdk
cd c9sdk/scripts
./install-sdk.sh
clear
echo "WARNING this is unsecure"
echo "To access IDE use 'test' for both user and password"
cd ..
./server.js -p 8080 -l 0.0.0.0 -a test:test
;;
"gitlab")
echo "you chose the gitlab server"
sudo apt-get install curl openssh-server ca-certificates postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
sudo gitlab-ctl reconfigure
;;
"express")
echo "you chose express"
sudo yarn global add express-generator
express --view=ejs expressapp
cd expressapp
yarn install
echo "Express server will run on: http://localhost:3000/"
yarn start
;;
"meteor")
echo "you chose meteor"
curl https://install.meteor.com/ | sh
meteor create --full meteorapp
cd meteorapp
meteor
;;
"react")
echo "you chose create-react-app"
sudo yarn global add create-react-app
create-react-app reactapp
cd reactapp
yarn start
;;
"feathers")
echo "you chose feathers"
sudo yarn global add feathers-cli
mkdir feathersapp
cd feathersapp
feathers generate app
echo "Server will run on http://localhost:3030/"
yarn start
;;
"vue")
echo "you chose vue"
sudo yarn global add vue-cli live-server
vue init simple my-project
cd my-project
live-server
;;
"quit")
break
;;
*) echo invalid option;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment