Julia is an open-source, high-level, dynamically typed programming language. Julia is commonly used for numerical analysis and scientific computing.
This tutorial demonstrates how to install Julia on Ubuntu 20.04.
Install Julia
Get the latest version of Julia from GitHub. Also extract minor version (1.6.2 -> 1.6) and assign it to variable.
JULIA_VERSION=$(curl -s "https://api.github.com/repos/JuliaLang/julia/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
JULIA_MINOR_VERSION=$(echo $JULIA_VERSION | grep -Po "^[0-9]+.[0-9]+")
Above variables are used to download the latest version of Julia from official page:
curl -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/x64/${JULIA_MINOR_VERSION}/julia-${JULIA_VERSION}-linux-x86_64.tar.gz"
Create a new directory to store Julia and extract the tar.gz
file:
sudo mkdir /opt/julia
sudo tar xf julia.tar.gz --strip-components=1 -C /opt/julia
In /usr/local/bin
directory we can create a symbolic links to the commands located in Julia's bin
directory:
sudo ln -s /opt/julia/bin/* /usr/local/bin
Now Julia will be available for all users as a system-wide command.
We can check Julia version:
julia --version
The tar.gz
file is no longer necessary, remove it:
rm -rf julia.tar.gz
Testing Julia
Create a main.jl
file:
nano main.jl
Add the following line of code:
println("Hello world")
Run script using julia
command:
julia main.jl
Uninstall Julia
If you want to completely remove Julia, delete the installation directory:
sudo rm -rf /opt/julia
Remove symbolic links to the commands:
sudo find /usr/local/bin -lname '/opt/julia/bin/*' -delete
The 1 Comment Found
Thanks a lot for this description! - Everything worked fine 🙂
Leave a Comment
Cancel reply