- 部署環境
- 系統環境
- 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
- 編寫啓動腳本
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
- 外網訪問測試