1. 程式人生 > >【搭建個人雲筆記】Jupyter在linux部署安裝過程文檔

【搭建個人雲筆記】Jupyter在linux部署安裝過程文檔

啟動腳本 centos msgpack gin min dev 時間 ins zip2

序號 修改人 版本 時間 備註 1. Minggle v1.0 2018.8.23 新建
  • 部署環境
    • 系統環境
      • CentOS Linux release 7.5.1804
    • 依賴包
      • Compatibility libraries
      • Debugging Tools
      • Development tools
  • 安裝所需依賴軟件
    yum -y install wget bzip2`
  • 獲取安裝包並安裝
    cd /usr/local/src/
    wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh
    chmod +x Anaconda3-5.2.0-Linux-x86_64.sh
    sh Anaconda3-5.2.0-Linux-x86_64.sh #安裝目錄可修改(修改為/opt/anaconda3),環境變量選擇寫入~/.bashrc
  • 使環境變量生效
    source ~/.bashrc
  • 安裝運行插件
    pip install msgpack
    conda install -c anaconda msgpack-python
    pip install jupyter_contrib_nbextensions
    jupyter contrib nbextension install --user
  • 設置密碼
    ipython
    In [1]: from notebook.auth import passwd
    In [2]: passwd() #密碼sha1需要copy下來,下面配置需要用到
  • 編輯配置文件
    jupyter notebook --generate-config --allow-root #root方式查看配置文件路徑
    vim /root/.jupyter/jupyter_notebook_config.py
    • 需要修改的內容如下
      c.NotebookApp.ip = ‘0.0.0.0‘
      c.NotebookApp.port = 80 # 端口請隨意,畢竟雲筆記為個人筆記,端口隱蔽一些自己記住就好,註意
      c.NotebookApp.notebook_dir = u‘/root/jupyter_dir‘
      c.NotebookApp.open_browser = False
      c.NotebookApp.password = u‘sha1:49f6ad7d17bxxxxxxxxxxxxxxxxe7ca8ba575f‘#此sha1從上步驟取得。
  • 編寫啟動腳本
    cat >>/root/jupyter_run.sh<<EOF
    jupyter notebook --allow-root >> /opt/anaconda3/logs/jupyter_log.log 2>&1 &
    echo "start jupyter"
    EOF
  • 創建log目錄及添加運行權限
    mkdir -p /opt/anaconda3/logs
    cd ~ && chmod u+x jupyter_run.sh && mkdir jupyter_dir
    sh jupyter_run.sh
  • 放行防火墻相關端口
    firewall-cmd --zone=public --add-port=80/tcp --permanent # 放行服務端口
    firewall-cmd --reload
  • 外網訪問測試
    技術分享圖片

【搭建個人雲筆記】Jupyter在linux部署安裝過程文檔