How to Install julia on Ubuntu 16.04

In this tutorial we’ll learn how to install Julia Language on Ubuntu 16.04.

We will learn to install Julia from Ubuntu repository and latest version of Julia by downloading binary from Julia website.

Overview

In this tutorial we’ll learn how to install Julia on Ubuntu 16.04 (Xenial Xerus).

Julia is a high-level, high-performance dynamic programming language for numerical computing. It provides a sophisticated compiler, distributed parallel execution, numerical accuracy and an extensive mathematical function library.

Several features of Julia

  • Multiple dispatch, ability to define function behavior across many combination of argument types
  • Dynamic type system
  • Good performance, approaching statically-compiled language like C
  • Built in package manager
  • Can call Python function and C function
  • Designed for parallelism and distributed computation

Prerequisite

  • Ubuntu 16.04 including variant like Kubuntu and Xubuntu.

Install Julia From Ubuntu Repository

Julia is available from [Ubuntu 16.04 repository][1]. To install Julia we can run commands below

Update apt database using the command below


$ <span class="token function">sudo</span> <span class="token function">apt-get</span> update

```

Install Julia using the command below


$ <span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> julia

```

[install Julia Ubuntu 16.04][2]

Julia and its dependencies will be installed. Press **Y** to continue.

Now we can run Julia interactive by running `julia`.

[Julia Interactive Ubuntu 16.04][3]

To print simple Hello world on Julia we can use println function from Julia interactive.


julia> println("Hello Julia! - howtodojo.com")
Hello Julia! - howtodojo.com

```

Now Julia is ready to be used but the current installed version is not the latest stable version of Julia. As you can see above Julia version shipped in Ubuntu repository is version 0.4.5 while at the time of this writing, the latest stable version of Julia is version 0.6.1. If you want or need to use latest version of Julia you can continue reading the next section.

## Install Julia Binary for Linux

In this section we'll learn how to install latest version of Julia on Ubuntu 16.04.

To get latest version of Julia we can go to [Julia download page][4].

Let's download Julia binary for Linux 64 bit

    
    $ wget -c https://julialang-s3.julialang.org/bin/linux/x64/0.6/julia-0.6.1-linux-x86_64.tar.gz
    

Extract the downloaded package.

    
    $ tar xzf julia-0.6.1-linux-x86_64.tar.gz
    

Rename extracted folder as `julia`

    
    $ mv julia-0d7248e2ff julia
    

Move julia directory to /opt

    
    $ sudo mv julia /opt
    

### Adding julia to PATH

open `.profile` on home directory.

find line

    
    PATH="$HOME/bin:$HOME/.local/bin:$PATH"
    

replace with

    
    PATH="$HOME/bin:$HOME/.local/bin:/opt/julia/bin:$PATH"
    

You can relogin so that `.profile` will be re-read by shell or you can run command below

    
    source ~/.profile
    

## Summary

In this tutorial we learned how to install Julia programming language Ubuntu 16.04 from Ubuntu repository and also how to install the latest stable version of Julia by downloading binary from Julia website.

 [1]: https://launchpad.net/ubuntu/xenial/+source/julia
 [2]: https://www.howtodojo.com/wp-content/uploads/2017/10/install-julia-ubuntu-16.04-01.png
 [3]: https://www.howtodojo.com/wp-content/uploads/2017/10/install-julia-ubuntu-16.04-02.png
 [4]: https://julialang.org/downloads/