Install RStudio on AWS EC2 instance - r

I managed to create an EC2 instance Amazon Linux AMI 2017.09.1 (randomly chosen) on Amazon Web Services (AWS).
I can send and receive files from my local desktop to AWS properly.
Now I would like to install R (RStudio Server) on AWS.
When searching for an answer, I found the script below that is to be written into Putty:
# install R base
$ sudo yum install r-base
#install RStudio-Server 1.1.442
$ sudo yum install gdebi-core
$ wget https://download2.rstudio.org/rstudio-server-1.1.442-amd64.deb
$ sudo gdebi rstudio-server-1.1.442-amd64.deb
#add user(s)
useradd username
echo username:password | passwordtest
But the answer I get each time is: "No package r-base available" or also "No package gdebi-core available".
Are they some prerequisite steps that I am missing?
Thanks.
M

Amazon Linux AMI 2017.09.1 is based on Centos 6 and the step you got is for Ubuntu(gdebi is an Ubuntu installer), Here are the steps from the official documentation.
$ sudo yum install R
$ wget https://download2.rstudio.org/rstudio-server-rhel-1.1.442-x86_64.rpm
$ sudo yum install rstudio-server-rhel-1.1.442-x86_64.rpm

Related

launching R in AWS EC2

I am trying to launch an R instance in AWS EC2. I have opted for the free tier and use the Amazon Linux AMI. In user data I have specified in the following manner to install R and Rstudio:
#!/bin/bash
# install R
yum install -y R
# install RStudio-Server
wget https://download2.rstudio.org/server/centos6/x86_64/rstudio-server-rhel-1.2.5033-
x86_64.rpm
yum install -y --nogpgcheck rstudio-server-rhel-1.2.5033-x86_64.rpm
yum install -y curl-devel
yum install -y openssl openssl-devel
# add user
useradd forecasting
echo forecasting:testing | chpasswd
However, the R version is not the latest one - how do I modify this code to download the latest version of R?
Using the instructions in this installing R for RStudio link, I think the following might work for Centos 6. Unfortunately I can't check it, but it might give you something to work from.
#!/bin/bash
# install R runtime dependencies
yum install epel-release
# set R version
R_VERSION=3.6.2
# download and install R
wget https://cdn.rstudio.com/r/centos-6/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
yum install -y R-${R_VERSION}-1-1.x86_64.rpm
# install RStudio-Server
wget https://download2.rstudio.org/server/centos6/x86_64/rstudio-server-rhel-1.2.5033-
x86_64.rpm
yum install -y --nogpgcheck rstudio-server-rhel-1.2.5033-x86_64.rpm
yum install -y curl-devel
yum install -y openssl openssl-devel
# add user
useradd forecasting
echo forecasting:testing | chpasswd

Can't Get RStudio Server to Run on EC2

I need to create an AMI with a clean install of R and RStudio Server. I have tried this on Amazon Linux 2 AMI (HVM), Amazon Linux AMI 2018.03.0 (HVM), and Ubuntu Server 18.04 LTS (HVM) but none of them work. I do not get any errors (that I notice) in my installs but when I try to access RStudio Server via http://ec2-XX-XX-XX-XX.compute-1.amazonaws.com:8787 there's nothing to connect to. I have even tried opening all ports to all IPs to make sure it wasn't a networking issue.
My Amazon API install scripts are below
Amazon Linux AMI 2018.03.0 (HVM)
sudo yum install -y R
wget https://download2.rstudio.org/server/centos6/x86_64/rstudio-server-rhel-1.2.1335-x86_64.rpm
sudo yum install -y rstudio-server-rhel-1.2.1335-x86_64.rpm
rm rstudio-server-rhel-1.2.1335-x86_64.rpm
Amazon Linux 2 AMI
sudo amazon-linux-extras install -y R3.4
wget https://download2.rstudio.org/server/centos6/x86_64/rstudio-server-rhel-1.2.1335-x86_64.rpm
sudo yum install -y rstudio-server-rhel-1.2.1335-x86_64.rpm
rm rstudio-server-rhel-1.2.1335-x86_64.rpm
I get this as part of the result:
Running transaction
Installing : rstudio-server-1.0.153-1.x86_64 1/1
groupadd: group 'rstudio-server' already exists
rsession: no process found
rstudio-server start/running, process 4990
Verifying : rstudio-server-1.0.153-1.x86_64 1/1
Installed:
rstudio-server.x86_64 0:1.0.153-1
Complete!
I think the issue is the rsession: no process found portion but I can't figure out how to resolve it.

opencpu cloud server installation guide on ubuntu 16.04

Would anyone know or like to share their note on installing opencpu cloud server on ubuntu 16.04?
I thought it is easy, but we saw many error here and there when following the instructions. I am new to opencpu. And, I don't have much experience on apache and nignx.
Here is the long story:
I created a new and clean ubuntu 16.04 server from microsoft azure vm, and installed opencpu cloud server following:
# Requires Ubuntu 14.04 (Trusty) or 16.04 (Xenial)
sudo add-apt-repository -y ppa:opencpu/opencpu-1.6
sudo apt-get update
sudo apt-get upgrade
# Installs OpenCPU server
sudo apt-get install -y opencpu
The server reported insserv error when running opencpu init script
update-rc.d: error: insserv rejected the script header dpkg
We then did some goolge and fix around, we got apache2 running, but when called:
curl http://localhost/ocpu/info
received 404 error.
FYI, the single user server runs fine.
The solution we found is that opencpu need mod_R to be turned on from apache2:
sudo a2enmod R
You need first to change to dir:
/etc/apache2/mods-available
And, make sure R.load file exists.
After running a2enmod command, should see a link to R.load (R module) in
/etc/apache2/mods-enable
Thank you y g for your question and response .. I had the same problem i try what you have mentioned in your comment but
curl http://localhost/cpu/info
takes along time without no response.
Thank you.
I used opencpu 1.5 works without bugs on ubuntu 16.04
sudo add-apt-repository -y ppa:opencpu/opencpu-1.5
sudo apt-get update
sudo apt-get upgrade
Install R and then install opencpu
sudo apt-get install r-base r-base-dev
sudo apt-get install -y opencpu
Also you should probably install Rstudio for IDE access
sudo apt-get install rstudio-server
To login to R you'll need to make a new user - follow the prompts
sudo adduser myname
Now just to make sure its all working
sudo service opencpu restart
sudo service rstudio-server restart
And try something like to check if its working
curl -L -v localhost/ocpu/library/
which should return a list of packages now installed on Ubuntu like this
Final Screenshot

Shiny server - This package is uninstallable?

I use the command lines below to install:
$ sudo apt-get install r-base
$ sudo su - \
-c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""
$ sudo apt-get install gdebi-core
$ wget https://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-1.4.1.759-amd64.deb
$ sudo gdebi shiny-server-1.4.1.759-amd64.deb
Error message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading state information... Done
This package is uninstallable
Dependency is not satisfiable: libssl0.9.8
Any ideas why?
I followed those command lines from the shiny website itself sometime ago. Now it has changed and failed to install with the current instructions. I have followed this guide too but no luck at all.
Any ideas?
I'm on ubuntu 16.04 now btw.
Use the last version of rstudio which use the last version lo libssl, which probably is installed in your system:
For that execute below commands:
64bit
$ sudo apt-get install gdebi-core
$ wget https://download2.rstudio.org/rstudio-server-1.1.383-amd64.deb
$ sudo gdebi rstudio-server-1.1.383-amd64.deb
32bit
$ sudo apt-get install gdebi-core
$ wget https://download2.rstudio.org/rstudio-server-1.1.383-i386.deb
$ sudo gdebi rstudio-server-1.1.383-i386.deb
For more info go to: https://www.rstudio.com/products/rstudio/download-server/
I also had this problem but was able to get around it by installing the most recent version of shiny server.
You can check to see if libssl0.9.8 is even installed:
dpkg --get-selections | grep ssl
Likely it is not (perhaps it is deprecated).
In the tutorial, it recommends you use the latest version of shiny-server. See if you can successfully install a more recent version.
$ sudo apt-get install gdebi-core
$ wget https://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-<latest-version>-amd64.deb
$ sudo gdebi shiny-server-<latest-version>-amd64.deb

R studio not working on ubuntu 16.04

I converted to Ubuntu today, but have a problems launching R studio. I installed R through the command prompt like this:
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/">> /etc/apt/sources.list'
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install r-base
I cheked if R was installed proper by typing R and then exiting by q(save="no").
I installed R studio through the command prompt by
sudo apt-get install gdebi-core
wget https://download2.rstudio.org/rstudio-server-0.99.902-amd64.deb
sudo gdebi rstudio-server-0.99.902-amd64.deb
But this doesn't work and i can't find the launch button or open R studio.
Afterwards i tried to remove it and install it through the website but doesn't work either. What should i do?
There is no lauch button -- you connect to port 8787 on the machine running RStudio Server.
In other words, type http://localhost:8787 in the address bar of your browser. You should see a login screen with the RStudio logo. This connects you to your RStudio Server.
If you want to run the Desktop version you need to install the other available .deb package.
For those on Ubuntu 16.10, or who prefer to use the desktop version of RStudio, you may wish to follow the solution posted by Mike Williamson reproduced below:
1) Get the latest R Studio Daily Build here, though note that it's not necessarily stable.
2) Install, chaning the name of the package to the one you downloaded - perhaps easiest if you go to your Downloads directory - and you'll probably find that there are missing packages:
$ sudo dpkg -i rstudio-1.0.124-amd64.deb
3) Download the missing packages (the lack of which causes the installation to fail):
$ wget http://ftp.ca.debian.org/debian/pool/main/g/gstreamer0.10/libgstreamer0.10-0_0.10.36-1.5_amd64.deb
$ wget http://ftp.ca.debian.org/debian/pool/main/g/gst-plugins-base0.10/libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb
4) Install them:
$ sudo dpkg -i libgstreamer0.10-0_0.10.36-1.5_amd64.deb
$ sudo dpkg -i libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb
5) Make sure they don't get over-written at the next software update:
$ sudo apt-mark hold libgstreamer-plugins-base0.10-0
$ sudo apt-mark hold libgstreamer0.10
6) Install RStudio (changing name to the version you downloaded):
sudo gdebi rstudio-1.1.5-amd64.deb
7) Launch RStudio:
rstudio

Resources