您的位置:首页 > 大数据 > 云计算

ubuntu环境下科学计算云平台安装配置

2016-11-01 14:53 776 查看
最近在学习斯坦福大学的cs231n课程,其中课程作业是在jupyter(ipython)下完成。由于申请了腾讯云服务器但是由于不会写后台代码就一直没放网页上去,空着也是空着,于是决在上面搭建jupyter notebook远程访问平台。

首先安装python这个很简单一句话:

sudo apt-get install python python-pip

接着安装科学计算必备的3个python模块包:

sudo apt-get install python-numpy python-scipy python-matplotlib

然后就是jupyter的安装,先切换到root模式:

su root

切换后输入 pip install ipython[notebook]

漫长的等待后安装完毕,现在在本地你就能通过网页编写运行python代码了,接下来是远程环境配置:

创建登陆密码

首先输入:

ipython

出现如下输入提示,按要求输入后:

In [1]: from IPython.lib import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: ‘sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed‘


(记住Out[2]输出的字符串后面要用到)

创建自签名证书

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

创建ipython notebook服务器

ipython profile create nbserver

创建jupyter notebook配置文件

jupyter notebook –generate-config

将刚才生成的ssl证书mycert.pem移动至.jupyter文件夹下(在你当前用户目录下)

mv mycert.pem .jupyter

修改配置文件jupyter_notebook_config.py

vim ~/.jupyter/jupyter_notebook_config.py

将下面代码复制进去:

c = get_config()

# Kernel config
c.IPKernelApp.pylab = 'inline'  # if you want plotting support always

# Notebook config
c.NotebookApp.certfile = u'地址/mycert.pem'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:....(上面Out[2]后的字符串)'
# It's a good idea to put it on a known, fixed port
c.NotebookApp.port = 9999
c.NotebookApp.notebook_dir = u'默认打开的文件位置'


大功告成,输入

ipython notebook –profile=nbserver打开远程服务,

在浏览器输入https://ip:9999进入,此时会提示证书有问题,忽略加入例外后输入登录密码后就可以访问了。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: