Last active
April 25, 2020 17:42
-
-
Save stgogm/f5ec8c784ca8bbdbf3f6 to your computer and use it in GitHub Desktop.
Install, update and configure Git, Node.JS, MongoDB, VS Code and Redis Server in Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
clear | |
# Install and update/upgrade dependencies | |
printf "Updating and installing dependencies...\n" | |
sudo apt update | |
sudo apt upgrade -y | |
sudo apt install -y build-essential curl git vim wget gnupg | |
# Configure Git | |
printf "\nConfiguring Git:\n" | |
read -e -p "Enter your name: " GIT_NAME | |
git config --global user.name "$GIT_NAME" | |
read -e -p "Enter your email: " GIT_EMAIL | |
git config --global user.email "$GIT_EMAIL" | |
# Set git to use the credential memory cache | |
git config --global credential.helper cache | |
# Set the cache timeout | |
read -e -p "Enter credential cache timeout in seconds: " -i 28800 GIT_CACHE_TIMEOUT | |
git config --global credential.helper "cache --timeout=$GIT_CACHE_TIMEOUT" | |
git config --global push.default simple | |
git config --global core.editor "vim" | |
printf "Done with Git\n" | |
# Add Node.js, MongoDB and Compass PPAs | |
printf "\nInstalling Node.js, VS Code, Compass, MongoDB and Redis...\n" | |
read -e -p "Enter Compass version: " -i "1.20.5" COMPASS_VERSION | |
# MongoDB Community Server | |
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - | |
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list | |
# Compass | |
wget "https://downloads.mongodb.com/compass/mongodb-compass_$(echo $COMPASS_VERSION)_amd64.deb" | |
# Node.js | |
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - | |
# Install NodeJS, MongoDB, Compass, Redis Server and Compass | |
sudo apt update | |
sudo apt install -y nodejs mongodb-org redis-server | |
sudo dpkg -i "mongodb-compass_$(echo $COMPASS_VERSION)_amd64.deb" | |
sudo snap install code | |
# Upgrade packages | |
sudo apt upgrade -y | |
# Enable Mongo service at startup | |
sudo systemctl enable mongod.service | |
# Update NPM? | |
printf "\n" | |
read -e -p "Install the latest version of NPM? (Y/n): " -i "Y" UPDATE_NPM | |
if [ "$UPDATE_NPM" == "Y" ] | |
then | |
printf "Updating NPM...\n" | |
sudo npm i -g npm | |
fi | |
# Install NPM modules globally | |
printf "\n" | |
read -e -p "What NPM modules would you like to install globally? (Empty for none): " -i "pm2 bower gulp eslint serverless sass-lint pug-lint webpack webpack-cli @vue/cli" NPM_MODULES | |
if [ "$NPM_MODULES" != "" ] | |
then | |
printf "Installing '$NPM_MODULES'...\n" | |
sudo npm install --global $NPM_MODULES | |
fi | |
# Increase maximum watchers for Gulp watch, PM2 and others | |
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | |
# Update and upgrade | |
sudo apt update | |
sudo apt upgrade -y | |
# Cleanup | |
sudo rm "mongodb-compass_$(echo $COMPASS_VERSION)_amd64.deb" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run with: