Log in RStudio with AWS EC2 instance - r

I managed to follow all the steps to create EC2 instance and install R Server on it.
But now when I go to RStudio to connect (which looks something like "ec2-[Public IP]-.eu-west-3.compute.amazonaws.com:8787")
I am asked a username and a password but I did not configure any:
I tried rstudio (username) and rstudio (password) but it does not work.
Anyone knows how I can find the username and the password to connect?
Thanks.
M

If this is using the AMI from http://www.louisaslett.com/RStudio_AMI/, the default password recently changed to the instance ID of the EC2. A code starting with i- and 17 alphanumeric characters, for example.
Username is still rstudio.

You can create a user/password in Linux and use it to log in
#add user(s)
useradd username
echo username:password | chpasswd
here is a detailed blog from on running R on AWS

I was having the same issue (I believe there is no ubuntu password for an AWS EC2 Instance and R studio requires one).
You can add a new user by typing the following: sudo adduser YOURUSERNAME and follow the terminal instructions (press enter to skip the info you do not want to give). Head over to the IP xxx.xxx.xxx.xxx:8787 and you should be able to log in now.
How to install R studio 3.4.4, upgrade to 3.6.0 and add a username (Ubuntu 18):
sudo apt update
sudo apt-get install -y r-base r-base-dev
sudo apt install gdebi-core
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.1335-amd64.deb
sudo gdebi rstudio-server-1.2.1335-amd64.deb
sudo chmod 777 -R /usr/local/lib/R/site-library
sudo adduser YOURUSERNAME
#########
# Upgrade R
echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/" | sudo tee -a /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y r-base r-recommended r-base-dev
# Rstudio dependency issues (when installing devtools) - I installed from an AWS EC2 account so I need to change my root password.
sudo passwd root
su root
apt-get -y build-dep libcurl4-gnutls-dev

Related

How to upgrade R version on AWS EC2 instance?

Quite surprisingly it's hard to find a workable solution around this.
I have an EC2 instance launched with Ubuntu 18.04 distribution.
I do sudo-get install r-base but the installed R version is R3.4
I've followed the steps here below where it asks to edit the source.list file
https://cran.r-project.org/bin/linux/ubuntu/README.html#installation
However, AWS declines the update as the source link is not secured.
Have you made sure you succesfully added the public key to the system?
This has worked for me fine in EC2 Ubuntu 18.04 to update to R 3.6.1. I also followed instructions given in https://cran.r-project.org/bin/linux/ubuntu/README.html#installation.
First, add the public key in the documentation´s "Secure APT" section. Run this in terminal:
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Next, add modify your file /etc/apt/source.list by entering this command:
$ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
Once that is done, enter this command and double check if AWS has not declined the update
$ sudo apt update
Finally, run this to get updates installed
$ sudo apt install r-base r-base-dev
I found this resource to be very helpful:
https://www.charlesbordet.com/en/shiny-aws-3/#how-to-install-shiny-server
I ended up using AMI from this website
louisaslett.com/RStudio_AMI/
It has some pre-builts libraries and installations.

Apt-get is broken after install Google Cloud SDK on Ubuntu 18.04 LTS

I was installing the Google Cloud SDK on my Ubuntu VM using the following commands
# Add the Cloud SDK distribution URI as a package source
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
# Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
# Update the package list and install the Cloud SDK
sudo apt-get update && sudo apt-get install google-cloud-sdk
and I think its broken now.
apt-get install unixODBC unixODBC-dev
E: Conflicting values set for option Signed-By regarding source https://packages.cloud.google.com/apt/ cloud-sdk: /usr/share/keyrings/cloud.google.gpg !=
E: The list of sources could not be read.
E: Conflicting values set for option Signed-By regarding source https://packages.cloud.google.com/apt/ cloud-sdk: /usr/share/keyrings/cloud.google.gpg !=
E: The list of sources could not be read.
Is there anyway to fix it so I can continue to download packages.
I got into a very similar situation today by not following the installation instructions carefully enough. What I think happened is that I accidentally pasted and executed some of the commands that were only supposed to be run if you had trouble with any of the previous steps.(The ones having "Troubleshooting Tip" above them.)
It looks like I "solved" it now by by removing these files
sudo rm /usr/share/keyrings/cloud.google.gpg
sudo rm /usr/share/keyrings/cloud.google.gpg~
sudo rm /etc/apt/sources.list.d/google-cloud-sdk.list
and then following the installation instruction again (more carefully this time) to install Google Cloud SDK.
Remove the existing sdk by running single command:
sudo rm /usr/share/keyrings/cloud.google.gpg && sudo rm /usr/share/keyrings/cloud.google.gpg~ && sudo rm /etc/apt/sources.list.d/google-cloud-sdk.list
Install google cloud sdk by running the single command
sudo apt-get install apt-transport-https ca-certificates gnupg && echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && sudo apt-get update && sudo apt-get install google-cloud-sdk && sudo apt-get install google-cloud-sdk-app-engine-java && sudo apt-get install google-cloud-sdk-app-engine-python && gcloud init
Hope this issue will be fixed.
I followed all these commands (for trying to reproduce error in system)
1st command
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
2nd command
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
3rd command
sudo apt-get update && sudo apt-get install google-cloud-sdk
4th command
sudo apt-get install unixODBC unixODBC-dev
above command prompted
E: Unable to locate package unixODBC
E: Unable to locate package unixODBC-dev
Then I installed all the gCloud sdk dependencies By below command
5th command
sudo apt-get install google-cloud-sdk-app-engine-java google-cloud-sdk-app-engine-python google-cloud-sdk-pubsub-emulator google-cloud-sdk-bigtable-emulator google-cloud-sdk-datastore-emulator kubectl
All above commands are given by you except 5th one,
I am unable to reproduce that error in my machine,
But it seems Your apt needs to clean up signed certificats and reconfigure again..
refer below link it might help you.
https://www.fossmint.com/keep-ubuntu-system-clean/
and please let me know about the solution if you got..
feel free to discuss on the same.
In case of no such files found, you can remove related link in sources.list or sources.list.save. It worked for me.
I had the same issue, here is how I fixed it
Step 1: Remove sudo rm google-cloud-sdk.list
cd /etc/apt/sources.list.d
sudo rm google-cloud-sdk.list
Step 2: Reinstall Google Cloud again
sudo snap remove google-cloud-sdk # skip if you had installed gcp sdk before
sudo apt-get install apt-transport-https ca-certificates gnupg -y
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
gcloud init
Ref: https://askubuntu.com/a/1389272
This one solved it for me:
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --yes --dearmor -o /usr/share/keyrings/cloud.google.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list > /dev/null

How to install apt-get package in Amazon Linux machine

How to install apt-get in amazon linux machine,using yum or wget ,i searched extensively but didnt find relvant ..getting below message
[ec2-user#ip-172-31-33-94 ~]$ sudo apt-get update -y && sudo apt-get install -y
linux-image-extra-$(uname -r)
sudo: apt-get: command not found
well figured out these commands hence answering,these commands will install apt-get and run docker as ec2 user
sudo yum update -y
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
docker info
docker run -it --rm tarunkumard/gatling:FirstScript

How to upgrade openresty with or without downtime

All,
I have few servers that have openresty installed and the version running on it is nginx version: openresty/1.9.7.2
How can i upgrade it to 1.11.5.2.
I have seen the documentation but things are not getting clear. Can someone please provide the detailed steps of the same.
This is a pretty late reply, but I just performed an upgrade from OpenResty 1.13.6.2 to 1.15.8.2. I'm running OpenResty in AWS/EC2 on Ubuntu 16.04.6 LTS. I just followed the Ubuntu guide to install at OpenResty
I did this on a backup instance to make sure everything worked, then applied the upgrade to my Live instance. All of my configs were intact and unchanged.
# install some prerequisites needed by adding GPG public keys (could be removed later)
sudo apt-get -y install --no-install-recommends wget gnupg ca-certificates
# import our GPG key:
wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
# for installing the add-apt-repository
sudo apt-get -y install --no-install-recommends software-properties-common
# add the our official APT repository:
sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"
# to update the APT index:
sudo apt-get update
# Then you can install openresty:
sudo apt-get -y install openresty
# check the new version:
openresty -v
# restart openresty
sudo service openresty restart

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