I am trying to install the R language in the docker file. My Ubuntu version is 18.04 LTS
RUN add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
apt-get update \
apt-get install -y r-base \
rm -rf /var/lib/apt/lists/*
But I am getting the below error. But it is working in my machine and not working docker file.
Reading package lists...
W: GPG error: https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
E: The repository 'https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease' is not signed.
The command '/bin/bash -c add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 apt-get update apt-get install -y r-base rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
Could anyone help to fix this issue?
Thanks in advance
Add the key before the adding the repo.
Also you need the && after every command to chain them all.
I prefer to use ; after set -uex for long chains so I can easily see which command output is coming from, particularly when it fails.
RUN set -uex; \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9; \
add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'; \
apt-get update; \
apt-get install -y r-base; \
rm -rf /var/lib/apt/lists/*
Related
I am unable to install the R package ggplot2 because it depends on the package digest, which requires R (>= 3.3.0) and I only have 3.2.3. I tried upgrading R as described here, but I get an unusual message after the first line and an error after the third. The results of the first 3 lines are below exactly as the appear on the command terminal, edited for privacy and empty lines before commands added for clarity.
Name1#Name2 ~ $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
[sudo] password for Name1:
Executing: /tmp/tmp.BIQ28xf0ql/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-keys
E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: key E084DAB9: "Michael Rutter <marutter#gmail.com>" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
Name1#Name2 ~ $ sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
deb http://cran.wustl.edu/bin/linux/ubuntu xenial/
Name1#Name2 ~ $ sudo apt update
E: Malformed entry 2 in list file /etc/apt/sources.list (Suite)
E: The list of sources could not be read.
All commands after the third give the same errors, with commands 4 and 6 giving the errors twice for some reason.
I will be frank and admit that this whole think is very beyond me and I am just copying and pasting the code that supplied without understanding most of it. Any help will be greatly appreciated.
EDIT: Answer available here.
You are almost there, but it seems like your sources.list may be malformed.
First delete all entries related to R by using nano /etc/apt/sources.list (or your favorite editor).
Then as you did add the key
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Then add the correct repository
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
Quick update
sudo apt update
Install r-base by
sudo apt-get install r-base
And confirm everything is working with
R --version
I'm trying to install an old version of RODBC into my dockerfile (I'm using R 3.6.3 and the newest version of RODBC needs R v4) by downloading the package using curl and then installing using install.packages but I'm getting the below error. Any ideas of how to achieve this?
Error: unexpected symbol in "install.packages(RODBC_1.2-6.tar.gz"
In the dockerfile I try to do the above with the following RUN statements:
RUN curl https://cran.r-project.org/src/contrib/Archive/RODBC --output RODBC_1.2-6.tar.gz
RUN R -e "install.packages(RODBC_1.2-6.tar.gz)"
The full dockerfile is:
FROM ubuntu:bionic
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter3.5" \
&& add-apt-repository --enable-source --yes "ppa:marutter/c2d4u3.5"
## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
littler \
r-base \
r-base-dev \
r-recommended \
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update
#These are all required, the exact version, for SQL Server to work
RUN apt-get install -y gnupg2 libssl1.0 libssl1.0-dev apt-transport-https
RUN apt-get install -y libcurl4-openssl-dev curl
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc unixodbc-dev
RUN apt-get install -y libssl-dev
RUN install.r tidyr bigrquery dplyr sqldf readr httr uuid
RUN curl https://cran.r-project.org/src/contrib/Archive/RODBC --output RODBC_1.2-6.tar.gz
RUN R -e "install.packages(RODBC_1.2-6.tar.gz)"
COPY src/upload_v2.r /usr/local/src/scripts/upload_v2.r
WORKDIR /usr/local/src/scripts
It looks like quote is missing in RUN R line:
RUN curl https://cran.r-project.org/src/contrib/Archive/RODBC --output RODBC_1.2-6.tar.gz
RUN R -e "install.packages('RODBC_1.2-6.tar.gz')"
I am trying to update to R version 3.5.3, by using the R manual. However, when I type this line:
deb https://cloud.r-project.org/bin/linux/ubuntu cosmic-cran35/
I get a return of command not found.
I tried to add it to my source list as previously suggested, but this does not seem to work. I am trying to do this on a linux system
Edit: Thanks #Ralf for correction (see comments)
Append the 'deb' line to your sources.list by opening a terminal and typing:
echo "deb https://cloud.r-project.org/bin/linux/ubuntu cosmic-cran35/" | sudo tee -a /etc/apt/sources.list
Install the R-CRAN GPG key to verify what you're installing:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Update your package list and install with:
sudo apt update
sudo apt install r-base r-base-dev
I am trying to install R in an Ubuntu docker image. I am able to successfully do so using this line:
RUN apt-get update && apt-get install -y r-base
but it is installing r 3.2.3. I need a newer version (3.5.2). Does anyone know how to specify which version to download?
Sure thing:
FROM ubuntu:18.10
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y install --no-install-recommends --no-install-suggests \
ca-certificates software-properties-common gnupg2 gnupg1 \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
&& add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' \
&& apt-get install r-base
Taken from here: https://cran.r-project.org/bin/linux/ubuntu/README.html
And here: https://github.com/noisebrain/Dockerfiles/blob/0668df74b27f514dab19a7afae6715328de72980/Rstudio-server-aib/rstudio-server-aib.dockerfile
root#100d1cda7377:/# R
R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
I have been trying to but struggling to install R and RStudio on my Chromebook Samsung 3. I have it set-up with Crouton with XFCE/Xiwi and use Trusty. I can install R just fine but either can't install Rstudio at all or can get the icon for Rstudio to show up but nothing happens when I click on it. Can someone give me a process on how to install these effectively on my device?
UPDATE 2020:
I am no longer using Crouton, but rather the built in Linux option (Crostini). In the Linux terminal, I did the following:
sudo apt-get update; sudo apt-get upgrade; sudo apt-get update --fix-missing; sudo apt autoclean; sudo apt-get clean; sudo apt-get autoremove
sudo apt install -y gnupg2
sudo apt-key adv --keyserver keys.gnupg.net --recv-key 'E19F5F87128899B192B1A2C2AD5F960A256A04AF'
sudo vi /etc/apt/sources.list
Add this line. Can use a different mirror if desired. (Note: older versions of Crostini were running Stretch by default instead of Buster)
deb http://cran.rstudio.com/bin/linux/debian buster-cran35/
Then back in the terminal
sudo apt-get install xclip
sudo apt install -y r-base r-base-dev
sudo apt-get install gdebi-core
sudo apt install -y libgstreamer1.0 libgstreamer-plugins-base1.0 libxslt-dev libnss3
sudo apt --fix-broken install
sudo curl -o rstudio.deb https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.2.5033-amd64.deb
sudo dpkg -i rstudio.deb
sudo apt-get update; sudo apt-get upgrade; sudo apt --fix-broken install; sudo apt-get update --fix-missing; sudo apt autoclean; sudo apt-get clean; sudo apt-get autoremove
ORIGINAL ANSWER:
It admittedly took me a long time, but I was finally able to install R and RStudio on my Chromebook Samsung 3. I have it set-up with Crouton with XFCE/Xiwi and use Trusty. After setting up Crouton, etc. here is what I had to do in the Linux terminal:
sudo apt-get install software-properties-common
sudo apt-get install selinux-policy-default
sudo apt-get install libqpol1
Add these lines:
deb https://<FOO>/bin/linux/ubuntu trusty/
deb https://<FOO>/ trusty-backports main restricted universe
to file
/etc/apt/sources.list
(replace FOO with the CRAN mirror of your choice and replace trusty if applicable)
Terminal:
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo add-apt-repository ppa:marutter/rrutter
sudo apt update
sudo apt upgrade
sudo apt upgrade r-base r-base-dev
sudo apt-get install gdebi-core
wget https://download2.rstudio.org/rstudio-server-1.1.442-amd64.deb
sudo gdebi rstudio-server-1.1.442-amd64.deb
wget https://download1.rstudio.org/rstudio-0.99.896-amd64.deb
sudo apt-get install libxslt1-dev
sudo gdebi rstudio-0.99.896-amd64.deb
cd /usr/bin/
rstudio
source
source
source
source