| by Arround The Web | No comments

How to Install R on Debian 11

“R is an open-source programming language which is widely used for performing analysis and data visualization, along with developing statistical applications. It offers support for a plethora of packages that make it very useful in a wide array of fields. After getting through the initial learning curve, you can create effective and efficient data visualization to leave your users in awe.”

Let’s see how you can leverage the power given to you by R by installing it on Debian 11.

Ensuring Prerequisites are Met

For you to successfully install R on your Debian 11, you need to meet a couple of hardware requirements:

– You need to have at least 1GB of RAM on your computer. If you don’t have it, you can use swap space to fulfil this requirement.

– A user account with “sudo” privileges

Installing R

The default package for R included in the Debian 11 repositories features an older stable version of R. In your terminal; you can use the following to install R:

$sudo apt install r-base -y

The process will take some time, based on your internet bandwidth, and will complete in some time. As soon as you get your prompt back in the terminal, you can use this to fire up R and verify the installation:

$sudo -i R

Running this command will launch R in your terminal and give you the current version installed (4.0.4). This confirms that R has been successfully installed on your Debian 11.

Optional Steps for the Latest Version

If you want to don’t want the older version, you can follow these preceding steps to add the latest version repository to your Debian 11 and install updated R. Luckily; the CRAN repositories maintain an up-to-date package with the latest version of R. For installing it, we will be sticking to the terminal. With your sudo user, follow these steps in your terminal.

Installing a Few Prerequisite Packages

Use the following command to install all necessary packages which are required to add a new CRAN repository:

$sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common

Importing the GPG Key

Before we can import the package from the CRAN repository, we need to import the GPG Key for it. We can do so using the following:

$sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7'

Import the Repository

Now, after the GPG key, we need to add the CRAN repository to your Debian 11.

$sudo add-apt-repository ‘deb http://cloud.r-project.org/bin/linux/debian bullseye-cran40/

Updating the Repositories

After the successful import of the repository, we need to update the list of repositories for your Debian to be able to recognize the updated R repository for installation. Run:

$sudo apt update

If you haven’t gotten any errors in your terminal up to this point, you can use the installation command again to install the latest version:

$sudo apt install r-base -y

You can launch the R console to check the installed version.

Installing R Studio

RStudio is an integrated development environment for R. It comes loaded with a plethora of features and tools to help you with your projects. You can use the following to install it on your Debian 11:

$wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-202 HYPERLINK “https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2022.07.2-576-amd64.deb”2 HYPERLINK “https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2022.07.2-576-amd64.deb”.0 HYPERLINK “https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2022.07.2-576-amd64.deb”7 HYPERLINK “https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2022.07.2-576-amd64.deb”. HYPERLINK “https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2022.07.2-576-amd64.deb”2 HYPERLINK “https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2022.07.2-576-amd64.deb”- HYPERLINK “https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2022.07.2-576-amd64.deb”576 HYPERLINK “https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2022.07.2-576-amd64.deb”-amd64.deb

$sudo apt install -f ./rstudio-2022.07.2-576-amd64.deb

Launching R Studio

You can go into applications to type “Rstudio” in the search box to pull up the icon and then click on it to launch the IDE.

Uninstalling R

Whether you are done with your project or if you simply want to remove R from your Debian 11, you can simply use the following:

$sudo apt autoremove r-base --purge -y

When you get your prompt back, it means that R and all the dependencies have been successfully removed from your computer.

Conclusion

Having successfully installed R on your server, you can proceed further and install the RStudio to expand upon the development experience. You can even look into setting up a Shiny server to convert your code into amazing web pages.

Like always, if you run into issues at any step of the guide, feel free to engage us through the comment section below, and we will be happy to help.

Share Button

Source: linuxhint.com

Leave a Reply