This walkthrough assumes you have previously setup a public SSH key on your Digital Ocean account. If you have not setup an SSH key. Replace Step 3 with the alternative directions underneath the main tutorial.
- Create a New Droplet
- Choose “Once-click apps”
- “Node on 16.04”
- Choose the $5/month option ( $0.007/hour )
- Choose the desired SSH Key you’d like to use to login.
- Click “Create”
- When the droplet has finished being created, click on the IP Address to copy it to your clipboard.
- In your terminal, run
ssh root@IP_ADDRESS
. If it asks for authenticity of host, type ‘yes’ and hit enter. - Next lets update all currently installed packages. Run
sudo apt-get update
. - Next we’ll need to install Node Package Manager. Run
sudo apt-get install npm
- Now what we have Node and NPM installed, we can spin up a really basic express server using the
nano
text editor. - Install express.
npm install express
- Create a file.
touch hello.js
- Edit the file with nano.
nano hello.js
and copy/paste hello.js ( scroll to the bottom of this page ). - Press
Control + x
. Then typey
followed byreturn
to save the file and return to the terminal. - Now let’s run the file through node to see if it works.
nodejs hello.js
- Visit your server’s IP address ( in the URL bar ).
Next Step: Get MongoDB Installed
If you do not want to use SSH, you can access a virtual console via the Digital Ocean dashboard. Click on your node droplet that you created and you'll see a "Console" link that will open a new window with a virtual console from Digital Ocean. I have personally found this console unreliable and sometimes lags too much.