How to install Julia on Ubuntu Linux?


Julia is a high-level, general-purpose, dynamically typed programming language that can be used for developing any kind of application. It provides functions for matrix manipulation, data visualization, etc so it is best suited for numerical analysis and scientific computing.

Julia is capable of direct calling C and Fortran libraries. You can create scripts in interactive mode (REPL) and by using its embedding API you can use Julia with other programming languages easily.

In this article, I will discuss how to install Julia on Ubuntu Linux.

Features of Julia

  • Free and opensource
  • It is simple and fast
  • Dynamically typed which feels like a scripting language
  • Provides various functions for matrix manipulation and data visualization
  • It can use C and Fortran libraries directly
  • Can be easily embedded into other languages

How to install Julia in Ubuntu

There are multiple ways in which you can install the Julia programming language on Ubuntu. Now use one of the given methods to install it on your system.

Installing Julia from the Ubuntu repository

Julia is available in the default Ubuntu repository you can install it by using the apt command in your terminal.

Before installing any package on your system make sure the apt package repository is updated –

sudo apt update

Next, use the following command to install Julia on your system –

sudo apt install julia

Press y and then enter if it asks for your confirmation.

You can verify the installation by using –

julia -v

julia version

Installing Julia using Snap

Another way to install Julia is by using the Snappy package manager. Snaps are containerized packages that can be used across the different distributions of Linux. This is one of the easiest methods of installing packages on a Ubuntu system.

Now use the following command to install the Julia snap package –

sudo snap install julia --classic

Installing Julia from the source

To download the Julia tarball go to its official download page and click on 64-bit(GPG) in the Linux section as highlighted in the image below.

Julia tarball download

Alternatively, you can download it by using the following command –

wget https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.6-linux-x86_64.tar.gz

Move to the download location and use the following command to extract the downloaded package –

tar -xvf julia-1.6.6-linux-x86_64.tar.gz

The /opt directory is the recommended location for installing software so use the given command to move all extracted files to this directory –

sudo mv julia-1.6.6/ /opt/

Finally, use the following command to create a symbolic link to Julia binary file this will allow you to run the Julia command in your terminal and start Julia REPL –

sudo ln -s /opt/julia-1.6.6/bin/julia /usr/local/bin/julia

Run the hello world program in Julia

So you have set up Julia on your system. Create a file name hello.jl and open it with a text editor –

sudo nano hello.jl

Paste the given code in this file.

# Program in Julia to print Hello World

# using println function
println("Hello World !")

Save the file by pressing Ctrl+s and exit from the editor.

Now use the given command to execute this file –

julia hello.jl

This will display output something like given in the image below.

hello.jl

To know more about how to use Julia view its official documentation.

Conclusion

You have successfully installed Julia on your system. Now if you have a query or suggestion then write us in the comments below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.