How to do it...

Let's create our first Droplet:

  1. Choose your Linux distribution; as I mentioned before, we are going to use Ubuntu 18.04:

  1. One-click apps are preconfigured Droplets, but I prefer to set my Droplet from scratch to have the control and be able to optimize my configuration. After this recipe, if you want to take a look at these options if you need to configure something quickly, that's fine:
  1. Choose the size of your Droplet. I prefer to use the 2 GB RAM Memory Droplet, which costs $10 per month. You might be wondering why I don't choose the cheapest version of 1 GB RAM; this is because I've tried to use this version, but I noticed that 1GB RAM is not enough to handle NPM when you install the packages. Most of the time, this will hang up your Droplet—I know sounds ridiculous, but NPM consumes a lot of RAM.
  1. If you choose the $10 Droplet, you don't have to pay that money right away. One of the best things about Digital Ocean is that they only charge you for the time you used your Droplet. That means that if after your complete this recipe (let's say you take 2 hours to complete it), you shut down (power off) your Droplet, you will only be charged for the 2 hours, which is $0.030. If you keep your Droplet on for the full month (30 days), you will be charged $10, so don't worry:
  1. Choose the datacenter region; this will depend on your location. If you're in the US, you will need to pick New York or San Francisco. You need to choose the datacenter closest to your location: 
  1. Name your Droplet. If you need more than one Droplet, you can select the amount here:
  1. Once you click on the Create button, it will take 30-45 seconds to create your Droplet. Once it's completed, you will see your Droplet:
  1. At this point, you should get an email with your server credentials:
  1. In your Terminal, you can access your Droplet with the ssh root@YOUR_DROPLET_IP command. When you access it for the first time, you will get a message to add this IP to your known hosts after you have to put in the Droplet password:
  1. If everything works fine, you will be asked to change your UNIX password. You need to paste the current password and after you have to write the new password you want and retype it after you will be connected to the Droplet:
  1. Let's start configuring our Droplet. Install Node.js. For this, we will install the latest version of Node using a PPA. Right now, the current release of Node is 10.x. If when you are reading this recipe, Node has a new version, change the version in the command (setup_10.x):
  cd ~
curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh
  1. Once we get the nodesource_setup.sh file, run the following command:
  sudo bash nodesource_setup.sh
  1. To install Node, run the following:
  sudo apt install nodejs -y
  1. If you want to verify the version of Node and NPM you just installed, run:
  node -v
v10.8.0
npm -v
6.2.0
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset