Build instructions for R on Amazon EC2

[This article was first published on Travis Nelson's Blog » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In this post, I will show:

– How to create an Amazon EC2 micro instance

– How to login to the EC2 instance using PuTTY

– How to install the R source and build it.

– Use R in the cloud!

 

Creating your EC2 instance

Go to the ASW console, Instances.

Press ‘Launch Instance’ button

Select ‘Basic 64-bit Amazon Linux AMI 2011.02.1 Beta (AMI Id: ami-8e1fece7)’

Build details: Basic 64-bit Amazon Linux AMI 2011.02.1 Beta (AMI Id: ami-8e1fece7)
Amazon Linux AMI Base 2011.02.1, EBS boot, 64-bit architecture with Amazon EC2 AMI Tools.
Root Device Size: 8 GB

 

Select ‘Micro’ instance type, since the AWS free usage tier is for micro instances only.

 

Use the defaults on the ‘Advanced Instance Options’.

 

Put in a descriptive name of what the instance is going to be used for.  I made the mistake of not doing this with my first instance, which I have no idea what they contain now.

 

Create a new key (unless you want to use an existing key) and download it.  It will save the file newkey.pem

 

Create a new Security Group with port 22 open.  Port 22 is for the SSH access.

 

Then launch instance.

 

Logging on to your EC2 instance

Logging on to you EC2 instance can be done several different ways and quite different for each environment.  Since I did this from a Windows machine, I posted instructions for how to SSH to your Amazon EC2 instance using a free tool called PuTTY.  For the AMI we are using, the login will be ‘ec2-user‘.

 

Building R from the source code

cd /opt
sudo mkdir R
cd R
sudo wget http://cran.at.r-project.org/src/base/R-2/R-2.13.0.tar.gz
sudo tar -xvf R-2.13.0.tar.gz
sudo rm -f R-2.13.0.tar.gz

Now we will install gcc, gcc-c++, gcc-gfortran, readline-devel, and make.  Whenever you are prompted with “Is this ok [y/N]:” enter y and press enter

sudo yum install gcc
sudo yum install gcc-c++
sudo yum install gcc-gfortran
sudo yum install readline-devel
sudo yum install make
cd R-2.13.0/

Since we are in a VE, we will need to turn off the X Window System using the command line argument –with-x=no

sudo ./configure --with-x=no
sudo make

 

The make will take about 30 minutes to complete.

export PATH=$PATH:/opt/R/R-2.13.0/bin

 

Check to see if R is working with:

R --version

Type ‘R’ to start the R console.  To exit the console, press ctrl+d.

R in the cloud!

To leave a comment for the author, please follow the link and comment on their blog: Travis Nelson's Blog » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)