最近由于对深度学习的深入,发现越来越需要一个方便、快捷、便宜、高效的平台进行调试和搭建网络。所以在安利完 使用Amazon AWS搭建GPU版tensorflow深度学习环境 之后,进一步在AWS上搭建Jupyter Notebook, 这样以后再也不用担心电脑性能不足,而且还可以随时随地的学习啦~
由于自己没有时间写教程,所以找了两篇很好的教程给大家一起学习。
中文版:
如何在云端服务器运行Jupyter Notebook?
英文版:
Running an iPython Notebook Server on AWS - EC2 Instance
视频版(youtube视频,需):
Running an iPython Notebook Server on AWS - EC2 Instance
强烈建议看视频,和英文版的进行操作,小哥教程很详细~,还不懂的话,可以本文评论留言,或者Q我: 3062984605
下面给出英文原文:
I hope everyone is familiar with the AWS (Amazon Web Services) and how to use iPython (Now Jupyter) Notebooks. If you are not familiar with Jupyter Notebook and you work with Python, then you are definitely missing a very important tool in you work. Please go through this video which is a short tutorial on iPython (Jupyter) Notebook.
OK, to begin with, I’ll list all the steps to create an Jupyter Notebook Server on an EC2 Instance in a step-wise fashion. I have also created a Youtube Video for this post, which you can check it out here. (update in progress to the video. please don’t refer it for now)
The reason for deploying Jupyter Notebook Server on AWS is to access all my Notebooks from anywhere in the World, just using my browser and also be able to work with them.
Enough of talking, let’s begin:
1. Login to your Amazon Management Console. If you don’t have an account yet, you can create one for it. You get 1 yr of free access to some of the services, which you can check out at this link
2. Create a new EC2 Instance with Ubuntu. If you are not familiar with how to create an EC2 instance, you can check out the video of this blog, in which I go through the steps from the beginning.
3. The important thing to remember while creating the instance is to assign the security group settings as mentioned in the image below
$ wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda2-2.4.1-Linux-x86_64.sh
$ bash Anaconda2-2.4.1-Linux-x86_64.sh
$ which python
$ source .bashrc
$ ipython
In [1]:from IPython.lib import passwd
In [2]:passwd()
$ jupyter notebook --generate-config
$ mkdir certs
$ cd certs
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
$ cd ~/.jupyter/
$ vi jupyter_notebook_config.py
c = get_config()
# Kernel config
c.IPKernelApp.pylab = 'inline' # if you want plotting support always in your notebook
# Notebook config
c.NotebookApp.certfile = u'/home/ubuntu/certs/mycert.pem' #location of your certificate file
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False #so that the ipython notebook does not opens up a browser by default
c.NotebookApp.password = u'sha1:68c136a5b064...' #the encrypted password we generated above
# It is a good idea to put it on a known, fixed port
c.NotebookApp.port = 8888
$ cd ~ $ mkdir Notebooks $ cd Notebooksand now I’ll start my notebook server
$ jupyter notebook
$ nohup jupyter notebook
This will put your server process as no-hangup and will keep it running even if you close the ssh access to the instance
$ lsof nohup.out
which will list the PID of the nohup process which is running(if any).
Then you can use the kill command to kill this process and stop your ipython notebook server.
$ kill -9 "PID"
replace “PID” with the ID of the process you get from the “lsof” command.
So, that is all you need to run an iPython Notebook on AWS EC2 instance. Please leave your comments about this blog post and do remember to check out its video.(update in progress to the video. please don’t refer it for now)
Until next time… :)