zoukankan      html  css  js  c++  java
  • Ubuntu16.04 安装R与RStudio

    安装R语言

    我们使用apt的方式进行安装,步骤如下:

    首先需要在/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/

    在/etc/apt/sources.list文件中,用您喜欢的CRAN镜像的实际URL替换

    sudo apt-get update
    sudo apt-get install r-base
    # 需要从源代码编译R软件包的用户[例如软件包维护人员或任何使用install.packages()
    # 安装软件包的人)也应该安装r-base-dev软件包:
    sudo apt-get install r-base-dev

    之后为可选内容

    Ubuntu的R软件包与Debian软件相似。您可以在位于https://cran.R-project.org/bin/linux/debian/的Debian README文件中找到更多信息。

    R或其某些软件包的安装和编译可能需要来自“backports”存储库的Ubuntu软件包。因此,建议使用类似条目激活backports存储库

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

    在你的/etc/apt/sources.list文件中。有关Ubuntu镜像列表,请参阅https://launchpad.net/ubuntu/+archivemirrors

    安装成功之后,清华源默认3.4.4,还算比较新,如果有安装依赖问题请参考[我的另外一篇文章],此处不在过多描述。(https://blog.csdn.net/fontthrone/article/details/80412340)
    安装R语言

    其他安装方式建议参考官方说明(此处链接为清华的HTTPS地址

    安装RStudio

    安装

    想要安装RStudio需要先安装R语言

    RStudio的安装也十分的便捷,直接点进去官网地址下载安装即可即可,RStudio-Server也可以使用以下命令如下:

    # 安装rstudio-server
    sudo apt-get install gdebi-core
    wget https://download2.rstudio.org/rstudio-server-1.1.453-amd64.deb
    sudo gdebi rstudio-server-1.1.453-amd64.deb

    RStudio的下载地址在这里

    本人使用的是rstudio-server,安装完成之后会默认启动,默认登录账户密码为系统登录的账户与密码。此时请访问http://localhost:8787/ 登陆之后效果如下:
    rstudio-server

    常用命令

    查看端口ps -aux|grep rstudio

    查看rstudio进程

    新建账户:
    useradd -d /home/R -m R,创建用户的同时指定主目录
    passwd R,设置密码

    系统设置:
    主要有两个配置文件,默认文件不存在
    /etc/rstudio/rserver.conf
    /etc/rstudio/rsession.conf

    设置端口和ip控制:
    vi /etc/rstudio/rserver.conf
    www-port=8080#监听端口
    www-address=127.0.0.0#允许访问的IP地址,默认0.0.0.0
    重启服务器,生效
    rstudio-server restart
    
    **会话配置管理**
    vi /etc/rstudio/rsession.conf
    session-timeout-minutes=30#会话超时时间
    r-cran-repos=https://<my.favorite.cran.mirror>#CRAN资源库
    # 我们此处使用的是清华的源:https://mirrors.tuna.tsinghua.edu.cn/CRAN/

    系统管理:

    rstudio-server start #启动
    rstudio-server stop #停止
    rstudio-server restart #重启
    
    查看运行中R进程
    rstudio-server active-sessions
    指定PID,停止运行中的R进程
    rstudio-server suspend-session <pid>
    停止所有运行中的R进程
    rstudio-server  suspend-all
    强制停止运行中的R进程,优先级最高,立刻执行
    rstudio-server force-suspend-session <pid>
    rstudio-server force-suspend-all
    RStudio Server临时下线,不允许web访问,并给用户友好提示
    rstudio-server offline
    RStudio Server临时上线
    rstudio-server online

    参考

    1. R语言安装官方地址-清华HTTPS源
    2. RStudio安装官方地址
    3. RStudio Server在linux上的安装与使用
  • 相关阅读:
    mysql单个表内去重多个重复的字段
    scrapy xpath有空格处理
    有道选择语言性翻译
    豆瓣源
    scrapy 编码
    西祠代理获取
    有道翻译
    远程连接服务器for Linux
    ECshop通过文章分类的ID实现不同模板
    创建WordPress管理员账号
  • 原文地址:https://www.cnblogs.com/fonttian/p/9162718.html
Copyright © 2011-2022 走看看