Julia is a dynamic, highly advanced programming language that solves complex scientific computation problems. It is fast, just like C and C++ programming languages, and simple to understand, like Python. In this blog, the installation method of Julia’s programming language has been explained for Ubuntu 22.04.
- Method 1: How to Download and Install Julia on Ubuntu 22.04 Using Snap?
- Method 2: How to Install Julia on Ubuntu 22.04 Using the Source Code?
- How to Use Julia on Ubuntu 22.04?
Let’s start!
Method 1: How to Download and Install Julia on Ubuntu 22.04 Using Snap?
The easiest method to install Julia on Ubuntu is by downloading its snap from the snapcraft store to install it. To install Julia on Ubuntu, use the snapd utility with the help of the command:
$ sudo snap install julia --classic
It is displayed on the screen that the 1.0.4 version of Julia has been installed on Ubuntu.
Removing Julia Using Snapd
To remove Julia from Ubuntu 22.04 (if installed from snapd), use the snapd utility with its remove option:
$ sudo snap remove julia
The Julia package has been removed from Ubuntu.
Method 2: How to Install Julia on Ubuntu 22.04 Using the Source Code?
Another method for installing Julia on Ubuntu is using the source code. For this method, you have to execute all the steps mentioned below:
Step 1: Download the Julia Linux Binaries
First, download the latest Linux binaries of the Julia using the wget command:
$ wget https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.3-linux-x86_64.tar.gz
Step 2: Extract the Downloaded File
After downloading the binaries in compressed files, extract them using the tar command:
$ tar -xvzf julia-1.8.3-linux-x86_64.tar.gz
Step 3: Copy the Extracted Components
Now, copy all the extracted components of the Julia Linux Binaries to the /opt directory:
$ sudo cp -r julia-1.8.3 /opt/
Step 4: Create a Symbolic Link
For the ease of usage, create its symbolic link on /usr/local/bin/julia:
$ sudo ln -s /opt/julia-1.8.3/bin/julia /usr/local/bin/julia
Step 5: Launch the Julia
After the installation is completed, launch the Julia application:
$ julia
Similarly, to exit the Julia environment, use the exit function:
exit()
How to Delete Julia On Ubuntu?
To delete the installed Julia using its binary, we simply remove the directory of /opt/julia-1.8.3:
$ sudo rm -r /opt/julia-1.8.3
In the above command, the r option is used with the rm command because we are deleting the non-empty directory.
How to Use Julia on Ubuntu 22.04?
Here, various steps are demonstrated to use Julia on Ubuntu.
Step 1: Create a jl File
Using the nano text editor (any other text editor can also be used), create a new file with the extension of “jl”. In the below-mentioned command, a file with the name “myJuliaCode” is created with a nano text editor:
$ nano myJuliaCode.jl
Type the Julia code to display the message on the screen “Welcome to itsLinuxFoss” with the script below:
println(“Welcome to itsLinuxFoss”)
Save the file with the shortcut key of CTRL+S and exit the nano text editor with the shortcut key of CTRL+X.
Step 2: Run the Julia Code
To run the code, execute the command:
$ julia myJuliaCode.jl
The message has been displayed on the screen.
Conclusion
On Ubuntu, the Julia package can be installed by downloading and installing it from the snap store using the command “sudo snap install julia –classic”. Another method of installing Julia on Ubuntu is using the source code method to download its Linux binaries and install it. In this blog, the installation methods of Julia have been explained for Ubuntu 22.04.