Skip to content

Instantly share code, notes, and snippets.

@dbartow
Last active November 9, 2016 10:59
Show Gist options
  • Save dbartow/166114161e0c438600db to your computer and use it in GitHub Desktop.
Save dbartow/166114161e0c438600db to your computer and use it in GitHub Desktop.
Setting up an IPython / IJulia notebook server on Ubuntu Server 14.04.1 'trusty' for IPython Development
IPython Installation
1. Install Git
1. sudo apt-get install git
2. Install IPython from GitHub server
1. git clone --recursive https://github.com/ipython/ipython.git (this clones the git repo into a directory called ‘ipython’ located in the directory you run the command from)
3. Run the IPython setup script
1. cd into the ‘ipython’ directory created in the previous step
2. sudo python setup.py install
4. Set up a self-signed certificate for SSL (still results in warning in the browser but allows for SSL)
1. cd ~/.ipython/profile_nbserver
2. openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
5. Set up a notebook server to run on port 443 (taken from http://ipython.org/ipython-doc/1/interactive/public_server.html and summarized below)
1. ipython profile create nbserver
2. Copy the template text for ipython_config.py from the bottom of this section and place it at the bottom of ~/.ipython/profile_nbserver/ipython_config.py
3. Change the hard path to your mycert.pem file in ~/.ipython/profile_nbserver/ipython_config.py to match where you ran step 4.2 above from and created the file.
4. Run python and create an encrypted pass string for your notebook server - then substitute it in python_config.py
1. python
In [1]: from IPython.lib import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
6. General apt-get update (otherwise the pip install in the next step fails so this must be done first)
1. sudo apt-get update
7. Install pip for python package management
1. sudo apt-get install python-pip
8. Install python-dev for header files used building dependencies below
1. sudo apt-get install python-dev
9 Install dependencies as detailed here (the summarized steps below should work): http://ipython.org/ipython-doc/stable/install/install.html#installation-from-source
1. pyzmq
1. sudo pip install pyzmq --install-option="--zmq=bundled"
2. jinja2 (http://jinja.pocoo.org)
1. sudo pip install Jinja2
3. Tornado
1. sudo pip install tornado
4. jsonschema
1. sudo pip install jsonschema
10. Install submodules
1. in ~/ipython
1. run sudo python setup.py submodule
You should now be able to start an IPython notebook server by doing:
cd ~/.ipython/profile_nbserver
sudo ipython notebook --profile=nbserver
Navigate a browser to https://{hostname-or-ip} and you should get a login page for IPython. The password is whatever you created above in step 5.4. Have fun!
Control-c will stop the notebook server. You can run it in the background so that it stays running when you log out by putting an & at the end of the line above, such as: sudo ipython notebook --profile=nbserver &
***** template text below for ~/.ipython/profile_nbserver/ipython_config.py
# Notebook server config below
# Kernel config
c.IPKernelApp.pylab = 'inline' # if you want plotting support always
# Notebook config
c.NotebookApp.certfile = u'/home/ubuntu/.ipython/profile_nbserver/mycert.pem'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u’YOUR-ENCRYPTED-PASS-GOES-HERE’
# It is a good idea to put it on a known, fixed port
c.NotebookApp.port = 443
Julia Installation
(taken from instructions at https://github.com/JuliaLang/IJulia.jl)
1. Unless changed from the above Julia repo README, navigate to https://launchpad.net/~staticfloat/+archive/ubuntu/juliareleases for Ubuntu install instructions, which at last check are:
1. sudo add-apt-repository ppa:staticfloat/juliareleases
2. sudo apt-get update
3. sudo apt-get install julia
Type julia at the command-line and an interactive shell should open. Success! Type quit() to exit.
IJulia Installation
1. run julia
2. In the Julia shell, type Pkg.add("IJulia”)
3. quit() from Julia, and copy everything in ~/.ipython/profile_nbserver/ipython_config.py at the bottom, and paste it at the end of the file at ~/.ipython/profile_julia/ipython_notebook_config.py
4. Delete the line that says c.NotebookApp.port = 8998 so there is no port conflict
5. Copy ~/.ipython/profile_nbserver/mycert.pem to ~/.ipython/profile_julia/mycert.pem
6. Change the line at the bottom of ~/.ipython/profile_julia/ipython_notebook_config.py that points to the cert from c.NotebookApp.certfile = u'/home/ubuntu/.ipython/profile_nbserver/mycert.pem’ to c.NotebookApp.certfile = u'/home/ubuntu/.ipython/profile_julia/mycert.pem’
run sudo ipython notebook --profile julia
The server should now be running - point your browser to https://{hostname} and you should get a login page for IJulia now instead of IPython. All other start and stop rules apply.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment