RHEL BasedRocky Linux

How To Install Julia Programming Language on Rocky Linux 9

Install Julia Programming Language on Rocky Linux 9

Julia has rapidly emerged as a powerful programming language, renowned for its high-performance capabilities and dynamic nature. Whether you’re delving into data science, machine learning, or scientific research, Julia offers a robust environment tailored for technical computing. Rocky Linux 9, known for its stability and enterprise-grade features, serves as an excellent platform for running Julia efficiently. This comprehensive guide provides a detailed, step-by-step process to install the Julia programming language on Rocky Linux 9, ensuring a seamless setup for both beginners and seasoned professionals.

Prerequisites

Before embarking on the installation of Julia on Rocky Linux 9, it’s essential to ensure that your system meets certain prerequisites to facilitate a smooth setup process.

System Requirements

  • Hardware: A modern x86_64-based system with at least 2 GB of RAM is recommended for optimal performance.
  • Architecture: Ensure that your Rocky Linux 9 system is compatible with the x86_64 architecture.

User Access

You will need root or sudo privileges to perform the installation steps. This ensures you have the necessary permissions to install software and modify system configurations.

Software Dependencies

  • wget: For downloading the Julia binary.
  • tar: For extracting the downloaded archive.
  • A terminal emulator to execute commands.

Internet Connection

A stable internet connection is required to download the Julia binaries from the official sources.

Step-by-Step Installation Guide

Follow these detailed steps to install Julia Programming Language on your Rocky Linux 9 system.

Step 1: Update System Packages

Updating your system packages ensures that you have the latest updates, security patches, and bug fixes, which enhances both system stability and security.

sudo dnf update -y
sudo dnf upgrade -y

These commands update the package list and upgrade all installed packages to their latest versions.

Step 2: Install Required Tools

Ensure that the necessary tools for downloading and extracting the Julia binaries are installed on your system.

sudo dnf install wget tar -y

This command installs wget and tar if they are not already present.

Step 3: Download the Latest Julia Binary

Navigate to Julia’s official download page to obtain the latest stable version or use the direct download link provided below.

wget https://julialang-s3.julialang.org/bin/linux/x64/1.11/julia-1.11.2-linux-x86_64.tar.gz

This command downloads the Julia binary archive. To verify the integrity of the downloaded file, you can use the following command:

sha256sum julia-1.11.2-linux-x86_64.tar.gz

Compare the output with the checksum provided on Julia’s official website to ensure the file has not been tampered with.

Step 4: Extract the Downloaded File

Once the download is complete, extract the tar.gz file using the tar command. This will unpack the Julia binaries onto your system.

tar -xvzf julia-1.11.2-linux-x86_64.tar.gz

This command extracts the contents of the archive into a directory named julia-1.11.2.

Step 5: Move Julia Files to a System Directory

For better organization and to make Julia accessible system-wide, move the extracted Julia directory to a preferred system directory, such as /opt.

sudo mv julia-1.11.2 /opt/julia

This command relocates the Julia installation to /opt/julia.

Step 6: Create a Symbolic Link for Easy Access

Creating a symbolic link in a directory that’s part of your system’s PATH allows you to run Julia from any location without specifying the full path.

sudo ln -s /opt/julia/bin/julia /usr/local/bin/julia

This command creates a symbolic link named julia in /usr/local/bin, pointing to the Julia executable.

Verify the symbolic link by checking Julia’s version:

julia --version

You should see an output similar to julia version 1.11.2.

Step 7: Add Julia to System PATH (Optional)

Although creating a symbolic link is sufficient, adding Julia’s bin folder to your system PATH ensures that the Julia executable is always accessible.

Edit the .bashrc or .zshrc file in your home directory and add the following line:

echo 'export PATH=$PATH:/opt/julia/bin' >> ~/.bashrc
source ~/.bashrc

This command appends the Julia bin directory to your PATH and reloads the .bashrc file to apply the changes immediately.

Step 8: Test the Installation

To confirm that Julia has been installed correctly, launch the Julia REPL (Read-Eval-Print Loop) by typing:

julia

You should see the Julia prompt. Run a simple command to verify functionality:

println("Julia is successfully installed!")

The output should display:

Julia is successfully installed!

Exit the REPL by pressing Ctrl + D.

Post-installation Tips

After successfully installing Julia, consider the following tips to enhance your Julia programming experience on Rocky Linux 9.

Updating Julia

To keep Julia up-to-date, periodically check for new releases on the official Julia website. Download the latest version and repeat the installation steps, ensuring you replace the existing Julia directory with the newest version.

Installing Julia Packages

Julia’s package manager, Pkg, allows you to install a wide range of packages to extend Julia’s functionality.

To install essential libraries, open the Julia REPL and execute:

using Pkg
Pkg.add("Example")

Replace "Example" with the desired package name.

Configuring IDEs

For an enhanced development experience, integrate Julia with popular code editors such as Visual Studio Code or Jupyter Notebook.

  • Visual Studio Code: Install the Julia extension from the marketplace to enable syntax highlighting, debugging, and more.
  • Jupyter Notebook: Install IJulia by running the following command in the Julia REPL:
using Pkg
Pkg.add("IJulia")

This allows you to use Julia within Jupyter notebooks for interactive computing.

Troubleshooting Common Issues

During the installation of Julia on Rocky Linux 9, you might encounter some common issues. Here are solutions to help you resolve them.

Missing Dependencies

If you encounter errors related to missing dependencies, ensure that all required tools are installed:

sudo dnf install wget tar -y

Re-run the installation steps after installing the necessary dependencies.

Incorrect PATH Configuration

If Julia is not recognized as a command, verify that the PATH variable includes the Julia bin directory:

echo $PATH

If /opt/julia/bin is not listed, revisit Step 7 to add it to your PATH.

Permission Issues While Creating Symlinks

Permission errors can occur when creating symbolic links. Ensure you have sudo privileges and execute the command correctly:

sudo ln -s /opt/julia/bin/julia /usr/local/bin/julia

If issues persist, check the permissions of the target directory:

ls -ld /usr/local/bin

Ensure that you have write permissions for the directory.

Congratulations! You have successfully installed Julia. Thanks for using this tutorial for installing the Julia Programming Language on your Rocky Linux 9 system. For additional Apache or useful information, we recommend you check the official Julia website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button