Julia is an open-source, high-level, dynamically typed programming language. Julia is used in data science, machine learning and scientific computing. In this tutorial, we will install the latest stable release of Julia (currently v1.7.1) and print the customary "Hello World!".
Installation
Lets begin by opening up the terminal and enter the following commands:
These two commands will assign the variables to get the latest stable release from JuliaLang.org.
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]+")
Here we download the tar.gz file.
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 the new directory for Julia.
sudo mkdir /opt/julia
Extract our files.
sudo tar xf julia.tar.gz --strip-components=1 -C /opt/julia
Create symbolic links.
sudo ln -s /opt/julia/bin/* /usr/local/bin
Check It
Now the latest version of Julia should be installed. We can check the installation by checking the version.
Check the version by entering the following into the terminal:
julia -- version
You are looking for an output like this:
If you don't see an output similar to the picture above, start at the top and try again.
We don't need the tar.gz anymore. Clean up by typing:
rm -rf julia.tar.gz
Test It
Create a test file, we'll call it main.jl
.
In this tutorial I'm using Neovim (nvim) to edit text but you can use whatever your favorite text editor is. Open your test file with your favorite editor:
`nvim main.jl`
Edit your main.jl
file with:
`println("Hello World!")`
Save your file and exit. From the terminal run the julia
command:
`julia main.jl`
If everything installed correctly you should see 'Hello World!' in the terminal output.
Keep Learning
Congratulations, you've made it this far! Are you ready to level up your skills? To learn more about coding with Julia check out JuliaLang.org. There you'll find Julia Academy, Exercism.io, YouTube videos and other resources available to continue your Julia journey.
Thanks for reading!
Top comments (1)
FYI there is a new Julia installer (juliaup).