- 安装conda
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
bash Miniconda2-latest-Linux-x86_64.sh
- 修改文件~/.condarc
auto_activate_base: false
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- defaults
show_channel_urls: true
ssl_verify: false
report_errors: false
- 安装JupyterLab
conda install jupyterlab
- 生成配置文件
jupyter lab --generate-config
- 生成登录密码
jupyter lab password
# jupyter_server_config.json
- 在配置文件中找到哈希值。
{
"ServerApp": {
"password": "sha1:****************91db429e"
}
}#
有可能哈希值长下面这样,一样的可以用的。
"password": "argon2:$argon2id$v=19$m=10240,t=10,p=8$X/O4IXwqqvVVjPAJi
- 设置配置文件
# 编辑文件
vim ~/.jupyter/jupyter_lab_config.py
c.NotebookApp.ip = '*' #哪些IP可以访问
c.NotebookApp.allow_root = True # root用户启动
c.NotebookApp.open_browser = False # 不开启浏览器
c.NotebookApp.port = 9999 # 端口
c.NotebookApp.password = u'sha1:****************b429e' # 上一步的哈希值
c.ContentsManager.root_dir = '/srv/jupyterlab/' # 文件存放的位置
c.ServerApp.allow_remote_access = True
- 后台启动jupyterlab
nohup jupyter lab --allow-root > jupyter.log 2>&1 &
- 设置开机自动启动Jupyterlab
# 创建文件/etc/systemd/system/jupyterlab.service,写入下面的内容
[Unit]
Description=Jupyter Notebook
After=network.target
[Service]
Type=simple
ExecStart=/home/lixiang/miniconda3/bin/jupyter-lab --config=/home/lixiang/.jupyter/jupyter_lab_config.py --no-browser
User=lixiang
Group=lixiang
WorkingDirectory=/home/lixiang/jupyterlab/
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- 安装Julia
sudo apt-get install julia
- 安装JupyterLab中的julia内核
using Pkg
Pkg.add("IJulia")
Pkg.build("IJulia")
- Nginx端口转发
# jupyterlab
server {
server_name xxxx;
listen 443 ssl;
ssl_certificate /etc/nginx/sites-available/cert/xxxx_bundle.crt; # 腾讯云给出的证书(名字要改成自己的)
ssl_certificate_key /etc/nginx/sites-available/cert/xxxx.key; # 腾讯云给出的私钥(名字要改成自己的)
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:9999;
proxy_redirect http://localhost:9999/ $scheme://$host/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_ssl_verify off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
- 安装R内核
install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
install.packages('IRkernel')
IRkernel::installspec(user = FALSE)
- 升级Nodejs
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs