Skip to content

Instantly share code, notes, and snippets.

@apoorvalal
Forked from adriantorrie/install-julia.sh
Last active June 16, 2018 16:46
Show Gist options
  • Save apoorvalal/1bbf1313e9c20f49f5259122a22d78f4 to your computer and use it in GitHub Desktop.
Save apoorvalal/1bbf1313e9c20f49f5259122a22d78f4 to your computer and use it in GitHub Desktop.
Ubuntu 14.04 - Install The Julia Language (julia-lang)
sudo add-apt-repository ppa:staticfloat/juliareleases
sudo apt-get update
sudo apt-cache show julia
sudo apt-get install julia julia-doc -y
julia -E 'Pkg.update()'
julia
Pkg.update()
Pkg.add("DataFrames")
Pkg.add("Gadfly")
Pkg.add("Plots")
Pkg.add("GLM")
Pkg.add("KernelEstimator")
Pkg.add("Optim")
Pkg.add("Ipopt")
Pkg.build("Ipopt")
Pkg.add("JuMP")
Pkg.build("JuMP")
Pkg.add("Cairo")
Pkg.build("Cairo")
Pkg.add("Fontconfig")
Pkg.build("Fontconfig")
#! /bin/sh
JULIA_DOWNLOAD=${JULIA_DOWNLOAD:-"$HOME/packages/julias"}
JULIA_INSTALL=${JULIA_INSTALL:-"/usr/local/bin"}
function header() {
echo "Jill - Julia Installer 4 Linux - Light"
echo "Copyright (C) 2017 Abel Soares Siqueira <abel.s.siqueira@gmail.com>"
echo "Distributed under terms of the GPLv3 license."
}
function badfolder() {
echo "The folder '$JULIA_INSTALL' is not on your PATH, you can"
echo "- 1) Add it to your path; or"
echo "- 2) Run 'JULIA_INSTALL=otherfolder ./jill.sh'"
}
function hi() {
header
if [[ ! ":$PATH:" == *":$JULIA_INSTALL:"* ]]; then
badfolder
exit 1
fi
echo "This script will:"
echo ""
# TODO: Expand to install older Julia?
echo " - Download latest stable Julia"
echo " - Create a link for julia"
echo " - Create a link for julia-VER"
echo ""
echo "Download folder: $JULIA_DOWNLOAD"
echo "Link folder: $JULIA_INSTALL"
echo ""
if [ ! -d $JULIA_DOWNLOAD ]; then
echo "Download folder will be created if required"
fi
if [ ! -w $JULIA_INSTALL ]; then
echo "You'll be asked for your sudo password to install on $JULIA_INSTALL"
fi
}
function confirm() {
read -p "Do you accept these terms? (Y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy] ]]; then
echo "Aborted"
exit 1
fi
}
function download_and_install() {
mkdir -p $JULIA_DOWNLOAD
cd $JULIA_DOWNLOAD
wget https://julialang.org/downloads/ -O page.html
url=$(grep "https.*linux/x64.*gz" page.html -m 1 -o)
[[ $url =~ julia-(.*)-linux ]] && version=${BASH_REMATCH[1]}
major=${version:0:3}
wget -c $url -O julia-$version.tar.gz
mkdir -p julia-$version
tar zxf julia-$version.tar.gz -C julia-$version --strip-components 1
if [ ! -w $JULIA_INSTALL ]; then
SUDO=sudo
fi
$SUDO rm -f $JULIA_INSTALL/julia{,-$major,-$version}
julia=$PWD/julia-$version/bin/julia
$SUDO ln -s $julia $JULIA_INSTALL/julia
$SUDO ln -s $julia $JULIA_INSTALL/julia-$major
$SUDO ln -s $julia $JULIA_INSTALL/julia-$version
}
# --------------------------------------------------------
hi
confirm
download_and_install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment