Skip to content

Instantly share code, notes, and snippets.

@cobaltapps
Last active May 25, 2022 17:36
Show Gist options
  • Save cobaltapps/ba451f706cc5eabd7419f2d038d69229 to your computer and use it in GitHub Desktop.
Save cobaltapps/ba451f706cc5eabd7419f2d038d69229 to your computer and use it in GitHub Desktop.
User data code used to setup NodeJS environment on cloud servers such as DigitalOcean and Vultr.
#!/bin/sh
## Copy/paste this script code into the "User Data" textarea that appears when selecting
## the "User Data" checkbox upon setting up your new DigitalOcean Droplet.
## Update Ubuntu
apt-get update
## Install NodeJS and NPM
curl -sL https://deb.nodesource.com/setup_16.x | bash -
apt-get install nodejs -y
## Install Gulp globally so that it can be run from the command line
npm install --global gulp-cli
## Append code to end of sudoers file that allows the www-data user to execute sudo commands
## Only use this code if working on a non-live/DEV server as it makes the server less secure
echo 'www-data ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment