Skip to content

Instantly share code, notes, and snippets.

@ohnorobo
Last active January 29, 2016 01:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ohnorobo/8231600 to your computer and use it in GitHub Desktop.
Save ohnorobo/8231600 to your computer and use it in GitHub Desktop.
setting up an IJulia server on a default digitalocean instance

start up an instance with ubuntu 12.04 LTS

###Install Julia 0.2

http://julialang.org/downloads/

sudo add-apt-repository ppa:staticfloat/juliareleases
sudo add-apt-repository ppa:staticfloat/julia-deps
sudo apt-get update
sudo apt-get install julia

###Install python

apt-get install python
apt-get install python-pip

###Setup IJulia

https://github.com/JuliaLang/IJulia.jl

pip install jinja2 tornado pyzmq

fron inside julia run

Pkg.add("IJulia")

to test run

ipython console --profile julia

and from within that run

sin(3)

which will work in julia but not python

###Setup IPython as a server

http://ipython.org/ipython-doc/rel-1.1.0/interactive/public_server.html

####Get the sha of the password you want to use for your instance

run python

from IPython.lib import passwd
passwd()

input a password and you should see something like

'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

####Self-sign a certificate

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

####Configure

edit .ipython/profile_julia/ipython_config.py and add the following

# Kernel config
c.IPKernelApp.pylab = 'inline'  # if you want plotting support always
# Notebook config
c.NotebookApp.certfile = u'/absolute/path/to/your/certificate/mycert.pem'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:bcd259ccf...[your hashed password here]'
# It is a good idea to put it on a known, fixed port
c.NotebookApp.port = 443

edit .ipython/profile_julia/ipython_notebook_config.py and change the line

c.NotebookApp.port = 8998

to

c.NotebookApp.port = 443

run server with

sudo ipython notebook --profile=julia

####Test

your server should now be accessable externally at https://your-ip, you will have to ignore a browser alert because of the self signed cert.

Sign in and input

sin(3) 

to see that julia is running. (Shift-enter executes code.)

###Running Remotely

to keep your server running

screen
sudo ipython notebook --profile=julia

then hit ctrl-a-d to detatch from the session, you can now logout and your IJulia server will stay up.

when coming back to a session run

screen -ls
screen -r name-of-session

to reconnect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment