Installing R

We use apt to install, and the steps are as follows:

You first need to add it at the end of /etc/apt/sources.list

deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu artful/
deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu xenial/
deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu trusty/
Copy the code

In /etc/apt/sources.list, replace

with the actual URL of your favorite CRAN mirror. For a list of CRAN images, see https://cran.r-project.org/mirrors.html. This place is used tsinghua deb https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/linux/ubuntu xenial/HTTPS sources. Then perform the following steps:

Sudo apt-get update sudo apt-get install r-base # Users who need to compile R packages from source code [such as package maintainers or anyone using install.packages () # The person who installed the package) should also install r-base-dev: sudo apt-get install r-base-devCopy the code

After that, it’s optional

Ubuntu’s R package is similar to Debian software. You can the Debian in https://cran.R-project.org/bin/linux/debian/ to find more information in the README file.

Installation and compilation of R or some of its packages may require Ubuntu packages from the “Backports” repository. Therefore, it is recommended to activate the Backports repository with similar entries

deb https://<my.favorite.ubuntu.mirror>/ trusty-backports main restricted universe
Copy the code

In your /etc/apt/sources.list file. On Ubuntu mirror list, please refer to https://launchpad.net/ubuntu/+archivemirrors.

After the successful installation, tsinghua source default 3.4.4, still relatively new, if there are installation dependency problems please refer to [my other article], not too much description here. (Blog.csdn.net/fontthrone/…)

For other installation methods, please refer to the official instructions (here is the HTTPS address of Tsinghua University

Install RStudio

The installation

To install RStudio, you need to install THE R language

RStudio installation is also very convenient, directly click on the official website to download the installation, RStudio-Server can also use the following command:

# rstudio - server installation sudo apt - get the install gdebi - core wget HTTP: / / https://download2.rstudio.org/rstudio-server-1.1.453-amd64.deb Sudo gdebi rstudio server - 1.1.453 - amd64. DebCopy the code

RStudio can be downloaded here

I use RStudio – Server, which will be started by default after installation. The default login account and password are the system login account and password. At this time visithttp://localhost:8787/After login, the effect is as follows:

Common commands

View the port: ps – aux | grep rstudio

Create a user account: useradd -d /home/r -m R, specify the home directory passwd R and set the password when creating the user account

System Settings: there are two main configuration file, the default file does not exist the/etc/rstudio/rserver conf/etc/rstudio/rsession. Conf

Set port and IP control: Vi/etc/rstudio rserver. Conf WWW - port = # 8080 # listener port WWW - address = 127.0.0.0 allows access to the IP address, default 0.0.0.0 restart the server, Effective rstudio - server restart session configuration management * * * * vi/etc/rstudio/rsession conf session timeout - minutes = 30 # session timeout R - cran - repos = < https://. My favorite. Cran. Mirror > # cran repository # we used here is tsinghua source: https://mirrors.tuna.tsinghua.edu.cn/CRAN/Copy the code

System management:

Rstudio-server start # Start rstudio-server stop # Stop rstudio-server restart # Restart rstudio-server active-sessions Rstudio-server dessy-session < PID > Stops all running R processes. Rstudio-server dessy-all Forces running R processes to be stopped, with the highest priority. Rstudio-server force-doussie-session <pid> rstudio-server force-doussie-all Rstudio server is offline temporarily, and web access is not allowed. Rstudio-server offline RStudio Server offline rstudio-server onlineCopy the code

reference

  1. R language installation official address – Tsinghua HTTPS source
  2. RStudio installation official address
  3. RStudio Server installation and use on Linux