Running R and Data Science in the Cloud Part II

The previous post focused on the initial task of instantiating a server. We chose Digital Ocean because it has an easy-to-use interface, great pricing, and great customer support. I should note that you can use any cloud service you’d like, so long as you can install Ubuntu 14.04 on it. If you do choose Digital Ocean, get $10 credit to your account by signing up with this link. In this post, we’ll focus on some basic steps to secure your server and ensure proper configuration. These steps are taken from Digital Ocean’s tutorial pages, though slightly modified to suit the use case. Let’s get started! Note that this tutorial focuses on mac users, which already have ssh console access through Terminal. Windows users can follow along, though you’ll need to install and configure PuTTY beforehand.


Setting up login credentials

To log into your server, you’ll need to know: the login password for the account ‘root’, and your server’s IP address (both of which should have been emailed to you by Digital Ocean). With that information in hand, let’s open up an instance of Terminal (for MAC users). Follow the instructions below:

  1. Open a Terminal window.
  2. In the command line, type the instruction below:
ssh root@server_ip_address

The instruction asks your local computer to log into the remote server using the account ‘root’ via SSH. The window will prompt you to enter a password, and immediately change the password. Follow the on screen instructions as pictured below.


Now that we’re logged in via SSH using our ROOT account, we’ll need to do a few things. First, we’ll create a new user and grant this user “super user” privileges. Super user privileges allow administrator-level abilities to users without having to use the root account. Once logged in as root, create a new account called ‘username‘ (replace username with your desired user name):

adduser username

You will be asked a series of questions, beginning with the account password. Make sure to assign a password. All other information is optional. See on screen instructions below.

Next, we need to add root (super user) privileges to our newly assigned user. Installing packages systemwide will require us to do that under a super user privilege. Otherwise, any packages we install using a regular account will only be available to that account (and nobody else on the system). We can do that (as root) by issuing the following command:

gpasswd -a username sudo

Now that our user has root privileges, it’s time to log out of the server using the root account, and login using our username account. To do that, issue the following commands, pressing enter after each. You’ll be prompted for the password you just entered.


ssh username@server_ip_address

With the login credentials complete, we can now focus on installing R and RStudio Server on our machine. See that in the following post!

Leave a Reply

Next ArticleRunning R and Data Science in the Cloud Part III