How to Install Latest Julia Version on Ubuntu

I know how frustrated you are trying to successfully install latest version of Julia programming language on Ubuntu.

Installation of Julia is straight-forward in Windows, as you just have to double click the downloaded exe file and follow the instructions.

There are instructions for installation of Julia on different specific linux distributions such as fedora etc. which are easier to follow.

But when we want to install Julia on Ubuntu-one of the most popular linux distributions, there are no specific instructions.

There is an easy way listed on some sites through a PPA available at : https://launchpad.net/~staticfloat/+archive/ubuntu/juliareleases, which has some some direct commands to be executed for installing Julia, but the version of the Julia you will get may not be the latest and also this is unsupported and untrusted as mentioned on the above link.

If you try to install Julia from the “Ubuntu Software Centre” or “Synaptic Package Manager” or directly using the command “sudo apt-get install julia”, you are probably going to get a very old version of julia.

I also faced all these problems as I wanted to install an official, pure, untouched fresh copy of latest version of Julia to learn and use it.

So finally I embarked upon the hard way of getting latest Julia stable release version installed on my Ubuntu laptop.

Firstly, we have to download the latest released Julia version from the location “https://julialang.org/downloads/

I used the “Generic Linux Binaries for x86” version. The choice between x86 and ARM depends on the processor of your machine. Also choose between 32 bit and 64 bit versions based on the Operating system and processor you have on your machine.

READ  Best Free Video Tutorials for Learning WordPress

After download, you will get a compressed tar.gz archive having name similar to “julia-0.6.2-linux-x86_64.tar.gz”. As the “julia-0.6.2-linux-x86_64.tar.gz” name suggests that I downloaded the Julia version 0.6.2 which is latest at the time of writing this article, generic linux binaries i.e. this can be used for any linux system including Ubuntu, fedora, centos and more, x86 system and 64 bit operating system.

The names may differ. Adapt the names accordingly.

Remember these are binaries, these don’t need to be installed as they can be directly used from the directory they are extracted.

These instructions can be followed for getting Julia working on most of the linux operating systems with little or no modifications, but I cannot guarantee the perfect result. Try it at your own risk.

I am assuming that the downloaded file is in your Downloads directory of Ubuntu.

Open the terminal and navigate to the directory where the downloaded tar.gz file resides, in present case the Downloads directory.

The terminal when just opened will show

[email protected]:~$

where x should be replaced by your username and xpc should be replaced by your computer name

Navigate to the Downloads directory using “cd Downloads” command on the terminal written as

[email protected]:~$ cd Downloads

and then press enter to get following terminal

[email protected]:~/Downloads$

extract the tar.gz file using the command “tar -zxvf julia-0.6.2-linux-x86_64.tar.gz” as shown below

[email protected]:~/Downloads$ tar -zxvf julia-0.6.2-linux-x86_64.tar.gz

Now a directory with extracted contents will be generated in the same parent directory as of the compressed archive with a name similar to “julia-xxxxxxxxxx” where xxxxxxxxxx may be a combination of alphabets and numerals.

This is the final directory you need to run the latest Julia version, no installation is needed.

READ  Best Free Video Tutorials for Learning WordPress

To run  Julia, you can directly run using the julia file in location “julia-xxxxxxxxxx/bin/julia” as discussed below

Navigate to the bin directory in the extracted directory using the command “cd /Downloads/julia-xxxxxxxxxx/bin” as expressed below

[email protected]:~$ cd /Downloads/julia-xxxxxxxxxx/bin

The terminal will now be like

[email protected]:~/Downloads/julia-xxxxxxxxxx/bin$

Now run the command “./julia” to run julia on the terminal as shown below

[email protected]:~/Downloads/julia-xxxxxxxxxx/bin$ ./julia

The terminal will now change to julia as presented below. I know the representation is little different here as this is all I can manage to copy from the terminal to present it to you.

_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type “?help” for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.2 (2017-12-13 18:08 UTC)
_/ |\__’_|_|_|\__’_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu

julia> 

But the problem is that I have to navigate to the directory every-time to run Julia.

Many people have discussed on the internet about defining the path and alias through very complex procedures and as I am not a hardcore computer geek, it was really difficult for me to understand.

I came to know about making a soft-link.

So I decided to make a soft-link to the Julia to run it directly from anywhere with a short command without navigating to the directory containing it.

I always try to do things neatly, so I decided to keep the extracted directory named “julia-xxxxxxxxxx” in the “/opt” directory of my system as most of my important programs reside in that.

You need super user terminal to copy a file into the “/opt” directory.

So I used the command “sudo su” and then provided password to get the super user privileges as expressed below

READ  Best Free Video Tutorials for Learning WordPress

[email protected]:~$ sudo su
[sudo] password for x:
[email protected]:/home/x#

Now navigate to the directory presently containing the extracted directory as expressed below

[email protected]:/home/x# cd /Downloads/

[email protected]:/home/x/Downloads#

Copy the directory using the command “cp -r julia-xxxxxxxxxx /opt” as shown below

[email protected]:/home/x/Downloads# cp -r julia-xxxxxxxxxx /opt

After the directory is copied to the destination, now we will make the soft-link in a directory which is in the system path so that the soft-link can be called from any location to run Julia.

To find out the directories in the system PATH use command “echo $PATH“, you will get a list of paths of directories separated by colon(:) such as “/usr/local/bin“. You can use any of them. I used “/usr/local/bin” for the soft-link.

Navigate to the chosen folder

[email protected]:/home/x# cd /usr/local/bin

The terminal will become

[email protected]:/home/x/usr/local/bin#

Create the soft-link using the command “sudo ln -s /opt/julia-xxxxxxxxxx/bin/julia julia” as shown below

[email protected]:/home/x/usr/local/bin# sudo ln -s /opt/julia-xxxxxxxxxx/bin/julia julia

Now return to the normal user terminal using command “ctrl+D” at the empty terminal “[email protected]:/home/x/usr/local/bin#“.

The terminal will become

[email protected]:~$

Type the newly made soft-link i.e. “julia“on the terminal as shown below

[email protected]:~$ julia

This is where the magic happens and you get this

_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type “?help” for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.2 (2017-12-13 18:08 UTC)
_/ |\__’_|_|_|\__’_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu

julia>

Don’t forget to subscribe if you like this article and want to get updates in future.

One Response

  1. short quotes 03/03/2018

Add Comment

4 × 2 =