Table of Contents
In this article, we will see how to install a specific version of llvm on Ubuntu or Debian Linux. LLVM (Low-Level Virtual Machine) is a collection of modular and reusable compiler and toolchain technologies used for developing front-end and back-end compilers. It was design with the goal of providing a modern, SSA-based compilation strategy capable of supporting both static and dynamic compilation of arbitrary programming languages. More on official website.
LLVM is required as a pre-requisites by many application and software to work properly on Ubuntu or Debian based linux systems. Different applications requires different versions of llvm which may not be available immediately through default ubuntu repo. In that case, you have to install a specific version of llvm as required by applications. Here we will see how to install a specific version of llvm in your Ubuntu or Debian based linux systems.
How to Install a Specific Version of LLVM on Ubuntu or Debian Linux
Also Read: How to Install vLLM on Linux Using 4 Easy Steps
If you are looking to install some specific version, let's say version 19
then to install this specific version you have to follow below installation steps.
Step 1: Download Script
You have to first download the script from official download page using wget
utility as shown below.
cyberithub@ubuntu:~$ wget https://apt.llvm.org/llvm.sh --2025-03-13 03:12:02-- https://apt.llvm.org/llvm.sh Resolving apt.llvm.org (apt.llvm.org)... 146.75.122.49, 2a04:4e42:8e::561 Connecting to apt.llvm.org (apt.llvm.org)|146.75.122.49|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 5851 (5.7K) [application/octet-stream] Saving to: ‘llvm.sh’ llvm.sh 100%[========================================================>] 5.71K --.-KB/s in 0s 2025-03-13 03:12:03 (56.0 MB/s) - ‘llvm.sh’ saved [5851/5851]
Step 2: Provide execute permission
Then you have to provide execute permission to the downloaded script using chmod +x llvm.sh
command to allow it to run as shown below.
cyberithub@ubuntu:~$ chmod +x llvm.sh
Step 3: Install a specific version
If you are looking to install some specific version, let's say version 19
then all you have to do is to run the llvm.sh
script by passing the version number as shown below.
cyberithub@ubuntu:~$ sudo ./llvm.sh 19 + CURRENT_LLVM_STABLE=18 + BASE_URL=http://apt.llvm.org + needed_binaries=(lsb_release wget add-apt-repository gpg) + missing_binaries=() + for binary in "${needed_binaries[@]}" + which lsb_release + for binary in "${needed_binaries[@]}" + which wget + for binary in "${needed_binaries[@]}" + which add-apt-repository + for binary in "${needed_binaries[@]}" + which gpg + [[ 0 -gt 0 ]] + LLVM_VERSION=18 + ALL=0 ++ lsb_release -is + DISTRO=Ubuntu ++ lsb_release -sr + VERSION=22.04 + UBUNTU_CODENAME= + CODENAME_FROM_ARGUMENTS= + source /etc/os-release ++ PRETTY_NAME='Ubuntu 22.04.4 LTS' ++ NAME=Ubuntu ++ VERSION_ID=22.04 ++ VERSION='22.04.4 LTS (Jammy Jellyfish)' ++ VERSION_CODENAME=jammy ++ ID=ubuntu ++ ID_LIKE=debian ++ HOME_URL=https://www.ubuntu.com/ ++ SUPPORT_URL=https://help.ubuntu.com/ ++ BUG_REPORT_URL=https://bugs.launchpad.net/ubuntu/ ++ PRIVACY_POLICY_URL=https://www.ubuntu.com/legal/terms-and-policies/privacy-policy ++ UBUNTU_CODENAME=jammy + DISTRO=ubuntu + case ${DISTRO} in + [[ -n jammy ]] + CODENAME=jammy + [[ -n jammy ]] + LINKNAME=-jammy + '[' 1 -ge 1 ']' + '[' 1 '!=' - ']' + '[' 19 '!=' all ']' + LLVM_VERSION=19 ..........................................
Step 4: Check Version
After successful installation, you can check the installed version by using llvm-config-19 --version
command as shown below. If you installed a different version, then you can run llvm-config-<version> --version
command to check the installed version.
cyberithub@ubuntu:~$ llvm-config-19 --version 19.1.7
Install latest version
Instead of installing a specific version, you can also choose to install latest version by using sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
command as shown below.
cyberithub@ubuntu:~$ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
--2025-03-25 02:59:06-- https://apt.llvm.org/llvm.sh
Resolving apt.llvm.org (apt.llvm.org)... 146.75.122.49, 2a04:4e42:8e::561
Connecting to apt.llvm.org (apt.llvm.org)|146.75.122.49|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7394 (7.2K) [application/octet-stream]
Saving to: ‘STDOUT’
- 100%[===============================================>] 7.22K --.-KB/s in 0s
2025-03-25 02:59:06 (128 MB/s) - written to stdout [7394/7394]
+ CURRENT_LLVM_STABLE=19
+ BASE_URL=http://apt.llvm.org
+ NEW_DEBIAN_DISTROS=("trixie" "unstable")
+ LLVM_VERSION=19
+ ALL=0
++ lsb_release -is
+ DISTRO=Ubuntu
...................................
Install from apt or apt-get package manager
If you are fine with current available version of llvm in default ubuntu repo, then you can choose to install it from there by using sudo apt install llvm
command as shown below.
cyberithub@ubuntu:~$ sudo apt install llvm Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: llvm-runtime The following NEW packages will be installed: llvm llvm-runtime 0 upgraded, 2 newly installed, 0 to remove and 88 not upgraded. Need to get 6,962 B of archives. After this operation, 112 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 llvm-runtime amd64 1:14.0-55~exp2 [3,204 B] Get:2 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 llvm amd64 1:14.0-55~exp2 [3,758 B] Fetched 6,962 B in 1s (9,951 B/s) Selecting previously unselected package llvm-runtime:amd64. (Reading database ... 255032 files and directories currently installed.) Preparing to unpack .../llvm-runtime_1%3a14.0-55~exp2_amd64.deb ... Unpacking llvm-runtime:amd64 (1:14.0-55~exp2) ... Selecting previously unselected package llvm. Preparing to unpack .../llvm_1%3a14.0-55~exp2_amd64.deb ... Unpacking llvm (1:14.0-55~exp2) ... Setting up llvm-runtime:amd64 (1:14.0-55~exp2) ... Setting up llvm (1:14.0-55~exp2) ... Processing triggers for man-db (2.10.2-1) ...
At the time of writing this article, current available version
is 14
so to check the current installed version, run llvm-config-14 --version
command as shown below.
cyberithub@ubuntu:~$ llvm-config-14 --version 14.0.0