{"id":14062940,"url":"https://github.com/duckmayr/install-update-r-on-linux","last_synced_at":"2025-12-27T04:57:35.521Z","repository":{"id":135110169,"uuid":"148222054","full_name":"duckmayr/install-update-r-on-linux","owner":"duckmayr","description":"Simple instructions for installing or updating R on Ubuntu Linux or Linux Mint","archived":false,"fork":false,"pushed_at":"2023-05-16T23:55:25.000Z","size":6,"stargazers_count":65,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-04T00:32:31.406Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/duckmayr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-09-10T21:35:27.000Z","updated_at":"2024-10-08T19:05:30.000Z","dependencies_parsed_at":"2024-04-10T16:39:14.426Z","dependency_job_id":"f534d4a8-ae44-4b50-887e-3a34d70a0f1c","html_url":"https://github.com/duckmayr/install-update-r-on-linux","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/duckmayr/install-update-r-on-linux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duckmayr%2Finstall-update-r-on-linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duckmayr%2Finstall-update-r-on-linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duckmayr%2Finstall-update-r-on-linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duckmayr%2Finstall-update-r-on-linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duckmayr","download_url":"https://codeload.github.com/duckmayr/install-update-r-on-linux/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duckmayr%2Finstall-update-r-on-linux/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267703041,"owners_count":24130463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:02:54.575Z","updated_at":"2025-12-27T04:57:35.514Z","avatar_url":"https://github.com/duckmayr.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"# install-update-r-on-linux\n\nI use R daily for research and run some flavor of Ubuntu Linux or Linux Mint on my machines.\u003csup\u003e1\u003c/sup\u003e\nThe Ubuntu repositories (which Linux Mint also uses) typically have a fairly recent version of R, but I prefer to have the most recent version.\nWhat follows is a guide to install/upgrade to the most recent version of R on Ubuntu (18.04) or Mint (19).\nI then include details regarding system dependencies for some popular R packages.\nParts of this guide were written in response to [this Stack Overflow question](https://stackoverflow.com/questions/46214061/how-to-upgrade-r-in-linux/).\n\n## Installing/Updating to R 3.6.x on Ubuntu 18.04/Linux Mint 19\n\nFirst, go to [CRAN's list of mirrors](https://cran.r-project.org/mirrors.html) and find the URL of the mirror that is closest to you.\nThe terminal commands below assume you choose http://cran.wustl.edu/.\nThen we can set up our authenication key\u003csup\u003e2\u003c/sup\u003e and the APT repository for the latest version of R with the following terminal commands:\n\n```bash\nsudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9\nsudo echo \"deb http://cran.wustl.edu/bin/linux/ubuntu bionic-cran35/\" | sudo tee -a /etc/apt/sources.list\nsudo apt update\n```\n\nWhat we do next depends on whether you need to install or upgrade R.\nIf you're installing for the first time, run\n\n```bash\nsudo apt install r-base r-base-dev\n```\n\nNote also that I have put to install `r-base` **and** `r-base-dev`, but I don't know if you want `r-base-dev`.\nI highly recommend it.\n\nIf you're upgrading R, run\n\n```bash\nsudo apt upgrade\n```\n\nIf you're upgrading R, to make sure you have all of your R packages available, in a new R session run\n\n```r\nupdate.packages(checkBuilt = TRUE, ask = FALSE)\n```\n\n## Installing System Dependencies for `devtools` and/or `tidyverse`\n\nI use [`devtools`](https://CRAN.R-project.org/package=devtools) for R package development and sometimes use packages from the [`tidyverse`](https://CRAN.R-project.org/package=tidyverse) for data manipulation.\nHowever, before you can install `devtools` or `tidyverse`, you need some system dependencies first, which you can pick up with the following terminal commands:\n\n```bash\nsudo apt update\nsudo apt install libcurl4-openssl-dev libxml2-dev libssl-dev\n```\n\nYou may also want the following system \"dependencies\" for `git2r`, but it isn't strictly necessary:\n\n```bash\nsudo apt install libgit2-dev libssh2-1-dev\n```\n\n-----\n\n\u003csup\u003e1\u003c/sup\u003e This statement is no longer quite true.\nI still use R daily for research, but have moved to [Manjaro Linux](https://manjaro.org/) as my primary OS on my work and personal machine.\nHowever, I still intend to keep this guide up to date (and of course, may end up with a machine running Ubuntu as the primary OS again in the future).\n\n\u003csup\u003e2\u003c/sup\u003e I put here the full key, though many other guides you may see will use only the \"short key.\"\nI have updated this guide to use the full key out of security concerns (see [here](https://forums.sonarr.tv/t/ubuntu-apt-repo-key-collision-security-concern/20285), for example).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduckmayr%2Finstall-update-r-on-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduckmayr%2Finstall-update-r-on-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduckmayr%2Finstall-update-r-on-linux/lists"}