Tutorial

How to Install Julia Programming Language on Ubuntu 22.04

Published on October 1, 2022
How to Install Julia Programming Language on Ubuntu 22.04

Introduction

Julia is a programming language designed to be high performance in computation and analysis. It is popular in data science, scientific research, visualization, machine learning, and also for more general purpose application building. The official site provides a live demo for you to try out the Julia language, but for practical use and development you will need to install it onto your system.

This tutorial will cover downloading and installing Julia on your machine. This will include making Julia discoverable to your system, and invoking an interactive REPL session for you to code using Julia.

Prerequisites

Step 1 — Downloading and Installing Julia

Pre-compiled binaries are the recommended method of installing Julia, though there is an option to compile Julia from source if your needs require that. In this tutorial you will download the official pre-compiled binaries from Julia’s official download page. Make sure you are in your home directory, then start the download:

  1. wget https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.1-linux-x86_64.tar.gz

This command uses wget to download the official pre-compiled binary. To complete the installation, extract the downloaded archive. This is done with the tar command:

  1. tar zxvf julia-1.8.1-linux-x86_64.tar.gz

Julia’s installation is now complete, in a new directory named julia-1.8.1. This location is referred to as your julia directory, and will be referenced later. Julia is entirely contained in this single directory. In the future if you wish to uninstall Julia, you can delete this directory for a complete uninstall.

Step 2 — Adding Julia to your PATH

While installation is complete, your system will need to be able to find the julia executable. This can be done by adding the full path of Julia’s bin directory to the PATH environment variable ~/.bashrc. This is one of the locations Linux allows adjustments to your PATH. Open it using nano or your preferred text editor:

  1. nano ~/.bashrc

Add this line to the bottom of the file, using the julia directory you installed Julia to as the basis:

. . .
export PATH="$PATH:/home/sammy/julia-1.8.1/bin"

You are required to use the absolute path to your bin folder. In this example, the home directory is used, so be sure to update the directory name accordingly if you chose a different location for your julia directory.

Once you are done, save and exit by pressing CTRL+O then CTRL+X.

In order for this change to go into effect, you have to source your .bashrc file:

  1. source ~/.bashrc

Now your system can find the julia executable.

Step 3 — Running the Julia REPL

To confirm Julia is installed correctly and to start experimenting with the language itself, start an interactive REPL (read-evaluate-print-loop) session. This will allow you to get immediate feedback and use the language itself.

With julia now on your PATH, you can start your session with this command:

  1. julia
Output
_ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.8.1 (2022-09-06) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ | julia>

As an example and to verify it works, you can start with doing basic arithmetic using Julia, which is a staple for any programming language:

  1. 1 + 1
Output
2

Once you are done experimenting, you can hit CTRL+D to exit the session.

Conclusion

Julia is a programming language used for data science and application building. While this guide is only covering the installation and basic usage, you can learn more about programming and creating with Julia on the official Julia learning site. If you are interested in installing other languages, especially for data science, check out our tutorials on how to install R.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors
Default avatar
Tony Tran

author

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
Leave a comment


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.