Skip to content

Instantly share code, notes, and snippets.

@zacsketches
Forked from jiahao/setup_julia.sh
Created October 29, 2016 01:06
Show Gist options
  • Save zacsketches/0577a29bf256342207acdd28b38a809c to your computer and use it in GitHub Desktop.
Save zacsketches/0577a29bf256342207acdd28b38a809c to your computer and use it in GitHub Desktop.
Setting up Julia on an Amazon EC2 instance
#Set up data partition
sudo mkdir /data
sudo chmod 777 /data
sudo "echo /dev/xvdb /data ext4 rw,user,exec,comment=cloudconfig 0 2 >> /etc/fstab"
sudo mount /data
#Install build environment
sudo sed -i "s/enabled=0/enabled=1" /etc/yum.repos.d/epel.epo
sudo yum -y update
sudo yum -y upgrade
sudo yum -y install git gcc-fortran clang m4 patch ncurses-devel python-devel
#Set up Julia
git clone https://github.com/JuliaLang/julia.git
make
#Set up IJulia
sudo easy_install pip
sudo yum install numpy scipy python-matplotlib ipython freetype-devel libpng-devel libatlas-devel texlive
sudo pip install --upgrade distribute jinja2 tornado pyzmq numpy scipy matplotlib ipython
#Set up HTTPS service
mkdir ~/certificates
openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout ~/certificates/ipython.pem -out ~/certificates/ipython.pem
cat << END_IJULIA_SETUP > ~/.ipython/profile_julia/ipython_notebook_config.py
c = get_config()
c.NotebookApp.port = 58786
c.NotebookApp.certfile = u'/home/ec2-user/certificates/ipython.pem'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'sha1:5aed38722075:cb4dc16f649dea93c499819e17c2f0c4fc882ed7'
END_IJULIA_SETUP
#Set up IJulia notebook server
mkdir notebooks
cd notebooks
nohup ipython notebook --profile julia > ijulia.log &
sleep 2
grep "The IPython Notebook is running at: https:\/\/\[all ip addresses on your system\]:58786\/" ijulia.log
echo IJulia should be running on port 58786 (check ijulia.log to be sure)
echo Enable incoming TCP connections on port 58786 in your Amazon EC2 instance, then
echo access the IJulia interface on your web browser at:
echo
echo https://[public-dns-name]:58786
echo
echo The default password is 'juliainthecloud'
echo Change it by updating the 'c.NotebookApp.password' hash in ~/.ipython/profile_julia/ipython_notebook_config.py
echo You can calculate a new hash in ipython with 'from IPython.lib import passwd; passwd()'
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment