没有管理员权限,在服务器安装使用 Jupyter + R 内核

问题:想在借用的服务器上安装Rstudio server(服务器安装了R4.2.0版本),但无管理员权限,并且也无权限执行 Docker 命令,只能选用Jupyter + R 内核方案。

步骤:

bash 复制代码
# 安装 miniconda(用户空间)
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda
source ~/miniconda/bin/activate

# 创建环境
conda create -n r-env python=3.9
conda activate r-env


# 安装 Jupyter
conda install -c conda-forge jupyter -y

# 安装 R 内核
conda install -c conda-forge r-irkernel
R -e "IRkernel::installspec()"

# 启动 Jupyter
jupyter notebook --no-browser --port=8889

启动jupyter后,如果出现以下问题:

fail to get yarn configuration. /usr/bin/node: relocation error: /lib64/libnode.so.93: symbol FIPS_selftest, version OPENSSL_1_1_0g not defined in file libcrypto.so.1.1 with link time reference

原因:看起来是系统自带的`/usr/bin/node`(Node.js)与系统openssl库版本不兼容。

解决方式:使用conda安装的nodejs

bash 复制代码
conda install -c conda-forge nodejs -y

重新启动Jupyter即可,Jupyter Notebook成功启动并正在运行后,以下为访问 Jupyter Notebook 的步骤:

1. 在您的本地电脑上创建 SSH 隧道

打开一个新的终端窗口(在您的本地电脑上,不是服务器上),运行:

bash 复制代码
ssh -N -L 8889:localhost:8889 您的用户名@服务器IP地址 -p 端口号

例如:

bash 复制代码
ssh -N -L 8889:localhost:8889 yanzijun@192.168.1.100 -p 13579

2. 在浏览器中访问 Jupyter

打开您本地电脑上的浏览器,访问以下 URL(token在启动jupyter输出内容里):

复制代码
http://localhost:8889/tree?token=9e44dc508cca5f7b57be9dfffe334093f0abbb6e36fa9ef0

注意:

不要关闭终端窗口 :服务器上的终端窗口(运行 Jupyter 的那个)必须保持打开状态,Jupyter 服务才能继续运行。如果您需要关闭终端但保持 Jupyter 运行,可以使用 nohup,这样 Jupyter 会在后台运行,输出会保存到 jupyter.log 文件中。当完成工作后,在运行 Jupyter 的终端窗口中按Ctrl+C 一次则为停止服务,Ctrl+C 两次为强制停止。

bash 复制代码
nohup jupyter notebook --no-browser --port=8889 > jupyter.log 2>&1 &
相关推荐
Sweety丶╮79440 分钟前
【Ansible】实施 Ansible Playbook知识点
服务器·云原生·ansible
optiz2 小时前
细菌基因组genome二代测序数据分析
linux·运维·服务器
m0_661316232 小时前
modbus_tcp和modbus_rtu对比&移植AT-socket,modbus_tcp&杂记
服务器·网络·tcp/ip
IT成长日记2 小时前
【Linux基础】Linux系统管理:GPT分区实践详细操作指南
linux·运维·服务器·gpt·parted·磁盘分区·fdisk
人工智能训练师3 小时前
在Ubuntu中如何使用PM2来运行一个编译好的Vue项目
linux·运维·服务器·vue.js·ubuntu·容器
程序媛Dev3 小时前
50.4k Star!我用这个神器,在五分钟内搭建了一个私有 Git 服务器!
运维·服务器·git
hmcjn(小何同学)4 小时前
轻松Linux-9.进程间通信
linux·运维·服务器·c++·bash
月光在发光5 小时前
19_内核模块挂载问题处理
linux·运维·服务器
Liang_GaRy5 小时前
心路历程-Linux如何赋予权限?
linux·运维·服务器