一. 配置准备:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
- Oracle 云服务账号
- 云主机一台:操作系统 CentOS7
- Xshell 连接
- Chrome 浏览器
二. 安装步骤文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
- 创建云主机
- 创建OCI虚拟网络VCN
新建VCN网络:
配置Security List(打开访问端口即可):
- 创建计算实例
- 通过Xshell连接到此实例
并通过修改配置文件,允许root用户的登录。
- 创建OCI虚拟网络VCN
- 安装Python3
创建安装目录,下载 Python3.6.5 安装包,并将压缩包解压到对应目录中文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html1 mkdir /opt/Python3 2 cd /opt/Python3/ 3 wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz 4 tar -xvf Python-3.6.5.tgz 5 ls -l
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
安装 Python3 依赖包文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
1 yum -y install zlib zlib-devel 2 yum -y install bzip2 bzip2-devel 3 yum -y install ncurses ncurses-devel 4 yum -y install readline readline-devel 5 yum -y install openssl openssl-devel 6 yum -y install openssl-static 7 yum -y install xz lzma xz-devel 8 yum -y install sqlite sqlite-devel 9 yum -y install gdbm gdbm-devel 10 yum -y install tk tk-devel 11 yum -y install gcc
配置Python安装环境,并编译、安装Python3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
1 cd Python-3.6.5/ 2 ./configure --with-ssl --prefix=/opt/Python3 3 make 4 make install
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
配置Python3环境变量文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
1 [root@demo-instance ~]# vim ~/.bash_profile
# .bash_profile文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html# User specific environment and startup programs文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
export python=/opt/Python3/bin文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
PATH=$PATH:$HOME/bin:/opt/Python3/bin文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
export PATH文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
编辑关联文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
1 mv /usr/bin/python /usr/bin/python_bak 2 ln -s /opt/Python3/bin/python3 /usr/bin/python 3 ln -s /opt/Python3/bin/python3 /usr/bin/python3
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
升级pip文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
1 python -m pip install --upgrade pip
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
- 安装Jupyter Notebook
通过pip安装Jupyter Notebook文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html1 python3 -m pip install jupyter 2 ln -s /opt/Python3/bin/jupyter /usr/bin/jupyter
通过jupyter notebook命令启动Jupyter服务器,查看是否安装成功文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
1 [root@demo-instance Python-3.6.5]# jupyter notebook --allow-root 2 [I 09:03:32.473 NotebookApp] Serving notebooks from local directory: /opt/Python3/Python-3.6.5 3 [I 09:03:32.473 NotebookApp] The Jupyter Notebook is running at: 4 [I 09:03:32.473 NotebookApp] http://localhost:8888/?token=9fb8cc50c87a1f5a35c2d57d0722dc1c0f58f5be892a6532 5 [I 09:03:32.473 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). 6 [W 09:03:32.479 NotebookApp] No web browser found: could not locate runnable browser. 7 [C 09:03:32.479 NotebookApp] 8 9 To access the notebook, open this file in a browser: 10 file:///root/.local/share/jupyter/runtime/nbserver-24125-open.html 11 Or copy and paste one of these URLs: 12 http://localhost:8888/?token=9fb8cc50c87a1f5a35c2d57d0722dc1c0f58f5be892a6532
至此,Jupyter Notebook安装成功。
- 配置外部访问
关闭防火墙(CentOS7)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html1 systemctl stop firewalld.service 2 systemctl disable firewalld.service
生成Jupyter Notebook配置文件文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
1 jupyter notebook --generate-config
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
通过 ipython 创建登录密码:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
编辑生成的配置文件 /root/.jupyter/jupyter_notebook_config.py,并在文件头添加如下配置信息:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
c.NotebookApp.ip='0.0.0.0' # 就是设置所有ip皆可访问 c.NotebookApp.password = u'sha1:7b115a66b162:e6bc039abf83eab1947dd9445d9fe408c659e3d2' #前边保存的密码信息 c.NotebookApp.open_browser = False #禁止自动打开浏览器 c.NotebookApp.port =8888 #随便指定一个端口,默认为8888
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
先 reboot 机器,然后使用命令 jupyter nodebook 启动服务器文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html
通过浏览器访问地址:http://ipaddress:8888/
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/10063.html输入创建的密码,即可登录Jupyter Notebook的工作区: