In this article, I will take you through the steps to install Julia Programming Language on Ubuntu 20.04 LTS. Julia is an open source, dynamically typed programming language which is designed to solve highly advanced and scientific computation problems. It is more popular within the Scientific community. It supports concurrent, parallel and distributed computing. Julia applications can compile to efficient native code without sacrificing the ease of usage like Garbage Collection. It also provides an extensive library of mathematical functions with great computation accuracy. We will see more about Julia in upcoming articles. Here we will the steps to install Julia packages in great detail in below section. More on Julia Official Documentation.
How to Install Julia Programming Language on Ubuntu 20.04 LTS
Step 1: Prerequisites
a) You should have a running
Ubuntu 20.04 LTS Server.
b) You should have
root access to run privileged command.
c) You should have
snap utility available in your System.
Step 2: Update Your Server
If you have added any of the repository information then it is absolutely necessary to run
apt-get update once. This will enable package manager to identify all new URL available after repository addition. So that it can download the required package and its dependencies. Even if there is no change, then
apt-get update command will check for all the available updates and install.
root@localhost:~# apt-get update Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease Hit:2 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease Hit:3 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] Ign:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 InRelease Hit:6 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 Release Get:8 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [29.0 kB] Get:9 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [63.6 kB] Get:10 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,464 B] Fetched 209 kB in 3s (71.5 kB/s) ......................................................
Step 3: Install Julia
There are multiple ways you can use to install Julia packages in your System. One of the quick way is through
apt-get package manager where you can just run
apt-get install julia -y command to install all the packages.
root@localhost:~# apt-get install julia -y Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: gcc-10-base git git-man julia-common libcc1-0 libdsfmt-19937-1 liberror-perl libgcc-s1 libgfortran5 libgit2-28 libgomp1 libhttp-parser2.9 libjulia1 libllvm8 libmbedcrypto3 libmbedtls12 libmbedx509-0 libopenlibm3 libquadmath0 libssh2-1 libstdc++6 libutf8proc2 Suggested packages: git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn ess julia-doc vim-julia The following NEW packages will be installed: git git-man julia julia-common libdsfmt-19937-1 liberror-perl libgfortran5 libgit2-28 libhttp-parser2.9 libjulia1 libllvm8 libmbedcrypto3 libmbedtls12 libmbedx509-0 libopenlibm3 libquadmath0 libssh2-1 libutf8proc2 The following packages will be upgraded: gcc-10-base libcc1-0 libgcc-s1 libgomp1 libstdc++6 5 upgraded, 18 newly installed, 0 to remove and 311 not upgraded. Need to get 55.2 MB of archives. After this operation, 346 MB of additional disk space will be used. ................................................................
Second method that you can use is through snap utility if it is available in your system. You can simply run snap install --classic julia command to install the package.
root@localhost:~# snap install --classic julia julia 1.0.4 from The Julia Language (julialang*) installed
Step 4: Check Julia Version
You can check the current installed version of julia by using
julia --version command as shown below. As you can see from below output, it is
root@localhost:~# julia --version julia version 1.4.1
Step 5: Write Your First Program
Now that Julia is successfully installed, it is time to write a sample program. Here we are writing a simple program to display
"Hello World !" on the output.
root@localhost:~# nano hello.jl println("Hello World !")
Then we are running it by using
julia hello.jl command from terminal as shown below.
root@localhost:~# julia hello.jl Hello World !
Step 6: Uninstall Julia
Once you are done using Julia then you can uninstall it by using
apt-get remove julia -y command. But it is important to note here that it will only remove julia package and not the other dependent packages which was installed during Julia installation. So to remove all those dependent packages it is always recommended to use
apt autoremove command as well. It will clean up and remove all the packages which are no longer required.
root@localhost:~# apt-get remove julia -y Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: julia-common libdsfmt-19937-1 libgfortran5 libgit2-28 libhttp-parser2.9 libjulia1 libllvm8 libmbedcrypto3 libmbedtls12 libmbedx509-0 libopenlibm3 libquadmath0 libssh2-1 libutf8proc2 linux-headers-5.8.0-41-generic linux-hwe-5.8-headers-5.8.0-41 linux-image-5.8.0-41-generic linux-modules-5.8.0-41-generic linux-modules-extra-5.8.0-41-generic Use 'apt autoremove' to remove them. The following packages will be REMOVED: julia 0 upgraded, 0 newly installed, 1 to remove and 207 not upgraded. After this operation, 6,161 kB disk space will be freed. (Reading database ... 243229 files and directories currently installed.) Removing julia (1.4.1+dfsg-1) ...