In this guide we’ll explore installation of Julia Programming Language on CentOS 8 | CentOS 7 Linux systems. Julia is dynamically typed, general-purpose programming language with a clean syntax created for numerical analysis, computational science, and even use in general scripting and web development.

Julia has a powerful set of features, very friendly syntax, and programs written in Julia executes very fast. This programming language integrates well with open-source libraries for analysis, data wrangling, and visualization. The community around it is growing drastically.

Recommended books: Best books to Learn Julia Programming

Install Julia Programming Language on CentOS 8 | CentOS 7

The easiest and recommended method of installing Julia Programming Language on CentOS 8 | CentOS 7 is from publicly provided Julia Linux Binaries.

You’ll need wget tool to download file to your machine.

sudo yum install wget -y

You can then pull the latest Julia Programming language binary archive from the releases download page.


Wait for the download to finish then extract the file.

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

Move the folder created from extraction of the archive to the /opt directory.

sudo mv julia-1.5.3 /opt/julia

Add /opt/julia/bin directory to your PATH.

# For Bash
$ vi ~/.bashrc
export PATH=$PATH:/opt/julia/bin

# For Zsh
$ vi ~/.zshrc
export PATH=$PATH:/opt/julia/bin

Source the bashrc file to update the settings.

$ source ~/.bashrc

If you’re on  the Zsh shell update the ~/.zshrc file.

$ source ~/.zshrc

Check current PATH settings.

$ echo $PATH

If julia was installed correctly you should be able to check software version:

$ julia --version
julia version 1.5.3

To start Julia shell run the following command in your terminal:

$ julia
   _       _ _(_)_     |  Documentation:
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  Official release
|__/                   |

Test our installation by printing “hello world” message.

julia> println("hello world")
hello world

All Julia programs have an extension .jl. I’ll create a new function file called myfuctions.jl.

$ vim myfuctions.jl

With below contents

# [function]( to calculate the volume of a sphere
function sphere_vol(r)
    # julia allows [Unicode names]( (in UTF-8 encoding)
    # so either "pi" or the symbol π can be used
    return 4/3*pi*r^3

# functions can also be defined more succinctly
quadratic(a, sqr_term, b) = (-b + sqr_term) / 2a

# calculates x for 0 = a*x^2+b*x+c, [arguments types]( can be defined in function definitions
function quadratic2(a::Float64, b::Float64, c::Float64)
    # unlike other languages 2a is equivalent to 2*a
    # a^2 is used instead of a**2 or pow(a,2)
    sqr_term = sqrt(b^2-4a*c)
    r1 = quadratic(a, sqr_term, b)
    r2 = quadratic(a, -sqr_term, b)
    # multiple values can be returned from a function using tuples
    # if the [return]( keyword is omitted, the last term is returned
    r1, r2

vol = sphere_vol(3)
# @printf allows number formatting but does not automatically append the \n to statements, see below
using Printf
@printf "volume = %0.3f\n" vol 
#> volume = 113.097

quad1, quad2 = quadratic2(2.0, -2.0, -12.0)
println("result 1: ", quad1)
#> result 1: 3.0
println("result 2: ", quad2)
#> result 2: -2.0

This is how we will execute a Julia program.

$ julia myfuctions.jl
volume = 113.097
result 1: 3.0
result 2: -2.0

The Julia samples page contains more informative examples that can help you get started in your Julia programming journey.

Also check:

Best books to Learn Julia Programming

Best Books To Learn Kotlin Programming

Install PyCharm IDE on Ubuntu | Debian

Top 10 Android Applications For Engineering Students


Please enter your comment!
Please enter your name here