How to Install Julia on Linux

Setting Up Julia

Julia is a open source programming language which is used in the field of scientific computing. It is high performance, dynamically typed, simple to write and has abundance of scientific package which makes it perfect for data analysts, scientists and for anyone trying to manipulate a bunch of data efficiently. According to the Stack Overflow 2022 Developer Survey, Julia is fourth most loved language among developers.

In this article, we will go over how to install and setup Julia on Linux.

Installing Julia on Linux

The official way to install Julia is using the pre-compiled binaries they offer on their website. You can also download it from snap store or from Ubuntu repository (using apt install), however there is no guarantee that it will be the latest version.

Installing Julia using pre-compiled binaries (recommended)

To download the pre-compiled binaries, go to the Julia website and download the preferred version. You can either download the current stable release (recommended for almost everyone unless you know what you are doing) , the long-term support release or an upcoming beta release.

Julia Stable Download 1
Julia Stable Download
  • NOTE : Unless you are using an offbeat distro like Void Linux which has musl; get the 64-bit(glibc) version.

After downloading it, navigate to the directory in which the tar file is stored (usually the Downloads folder) and extract the file using the following command :

tar -xvzf /path/to/tar/file

This is how it looks for the 1.8.5 version.

Julia Install
Julia Install

To work with Julia, navigate to the folder in which the files were extracted to, go to bin and execute ./julia like shown below.

Starting Julia
Starting Julia

However it is a better idea to add link the Julia binary in the local binaries directory, so you don’t have to navigate to Downloads every time you have to work with Julia.

To do that run the following,

sudo ln -s <path/to/binary/file> /usr/local/bin/julia

This command will make an executable file in /usr/local/bin named Julia and link it to the executable that you have in the extracted folder. Now you can simply use Julia by executing julia in the terminal regardless of which directory you are in.

Adding Julia To Path
Adding Julia To Path

Installing Julia using snap

Installing Julia using snap is a convenient method to get the latest version of Julia on your system. Here are the steps to install Julia using snap:

Verify that snap is installed on your system:

  • Open a terminal window
  • Type the command snap version and press enter
  • If snap is installed, you will see the version of snap and other information about your installation

Install Julia using snap:

  • Open a terminal window
  • Type the command sudo snap install julia --classic and press enter
  • This command will download and install the latest version of Julia on your system
  • You may be prompted to enter your password, enter it and press enter
  • Snap will take care of downloading and installing Julia, this process may take a few minutes depending on your internet connection

If you are having any difficulties with installing, setting up or understanding Snap, please refer to : Snaps in Linux: A Basic Introduction

Using Julia

There are two ways to use Julia. You can use the Julia in the interactive mode by simple executing it in the terminal. You can also write your code in a .jl file and run it using the following command

julia /path/to/script.jl

Both of the methods are shown below.

Julia Working
Julia Working

Conclusion

In this article, we learned how to install and setup Julia, which is a high performance language made for scientific computing. As data science and machine learning become more commonplace in academia, the popularity of Julia is just going to rise. You can learn about Julia in depth by following their official documentation. One of the language which rivals Julia is R. To learn more about R, check out this article. Happy coding!