Home Ubuntu How to Install Julia Programming Language on Ubuntu 22.04

How to Install Julia Programming Language on Ubuntu 22.04

Brief: This article guide takes us through the necessary steps needed to install and configure Julia programming language on Ubuntu 22.04/20.04 systems. The article also demonstrates how to get started with Julia by running a simple Julia program.

Julia is a considerably new, fast, and high-level programming language intended to unriddle scientific and highly advanced computation problems. It is famous in scientific research, machine learning, data science, visualization, and also for more general-purpose application building.

The official site offers a live demo of Julia language to try out, but for efficient use and development, you will need to install it onto your Linux system.

In a nutshell, Julia programming language is associated with the following features:

  • Fast – With high performance being one of its prioritized design objectives, LLVM (compiler backend) makes it possible to efficiently compile Julia programs for multiple platforms from native code.
  • Dynamic – Julia gives its users an interactive feel due to its dynamically typed attribute that gives the perception of a scripting language.
  • Reproducible – With pre-built binaries, users are able to each time recreate an already-existing Julia environment (reproducible environments).
  • Composable – Functional and object-oriented programming patterns are easily expressed in Julia via the multiple dispatch paradigms. This paradigm has proven to be unreasonably effective.
  • General – Julia makes it possible to build entire Microservices and Applications via its provision of package manager, logging, metaprogramming, profiling, debugging, and asynchronous I/O functional features.
  • Open Source – With 1000+ contributors associated with this open-source project, the MIT license covers Julia’s source code available on the Github platform.

Step 1 – Installing Julia in Ubuntu

It is highly advised to use the official pre-compiled binaries (current stable release) to install Julia on Linux systems.

The following wget command will download the latest version of Julia in your current directory, then extract and install it as shown.

$ wget https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.2-linux-x86_64.tar.gz
$ tar zxvf julia-1.8.2-linux-x86_64.tar.gz
$ cd julia-1.8.2

Think of this directory as your primary Julia installation directory. Deleting it is the same as uninstalling Julia from your system.

Step 2 – Adding Julia to System Path

For your Ubuntu system to find Julia’s executable, the PATH environment variable file ~/.bashrc should contain the full path to Julia’s bin directory (julia-1.8.2/bin):

$ ls -l $HOME/Downloads/julia-1.8.2/bin
Julia Installation Path
Julia Installation Path

Open the ~/.bashrc file using the nano editor or your preferred text editor:

$ nano ~/.bashrc

and add Julia’s bin directory path at the bottom:

export PATH="$PATH:$HOME/Downloads/julia-1.8.2/bin"
Add Julia to System Path
Add Julia to System Path

Update the ~/.bashrc file for the Ubuntu system to be able to trace Julia’s executable.

$ source ~/.bashrc 

Step 3 – Running the Julia REPL

To confirm Julia’s correct configuration on your Ubuntu system, we need to initiate an interactive REPL (Read Evaluate Print Loop) session by executing its binary file:

$ julia 

              _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.2 (2022-09-29)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia>

From the julia shell session, we can even perform some simple arithmetic to test its validity:

julia> 34+56

90

Use Ctrl+D to exit the julia session.

Step 4 – Testing a Simple Julia Program

Julia files/programs have the .jl file extension. We can create a sample Julia program in the following manner:

$ nano my_julia.jl

and add the text:

println("Hello and welcome to LinuxShellTips tutorial on installing Julia on Ubuntu 22.04")

If we run the file, we should be able to see some output:

Test Julia Program
Test Julia Program

With Julia installed on your Ubuntu system, you should now be able to explore its full potential under a Linux ecosystem when it comes to data science and application building.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.