DEV Community

Cover image for How to install the Julia latest stable release on Ubuntu & Linux Mint
Colleen Lohr
Colleen Lohr

Posted on

How to install the Julia latest stable release on Ubuntu & Linux Mint

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]+")
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

Create the new directory for Julia.

sudo mkdir /opt/julia
Enter fullscreen mode Exit fullscreen mode

Extract our files.

sudo tar xf julia.tar.gz --strip-components=1 -C /opt/julia
Enter fullscreen mode Exit fullscreen mode

Create symbolic links.

sudo ln -s /opt/julia/bin/* /usr/local/bin
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

You are looking for an output like this:

Terminal example displaying the version.  In this example 1.7.1 is displayed.

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
Enter fullscreen mode Exit fullscreen mode

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`
Enter fullscreen mode Exit fullscreen mode

Edit your main.jl file with:

`println("Hello World!")`
Enter fullscreen mode Exit fullscreen mode

Save your file and exit. From the terminal run the julia command:

`julia main.jl`
Enter fullscreen mode Exit fullscreen mode

If everything installed correctly you should see 'Hello World!' in the terminal output.

Terminal output example displaying a 'Hello World!'


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!



Feel free to reach out!

GitHub button for https://github.com/cmlohr

Twitter button for https://twitter.com/cmlohr

LinkedIn button for https://www.linkedin.com/in/cmlohr/

Top comments (1)

Collapse
 
sosiristseng profile image
Wen Wei Tseng

FYI there is a new Julia installer (juliaup).

curl -fsSL https://install.julialang.org | sh
Enter fullscreen mode Exit fullscreen mode