Ubuntu native installation#

Applies to Linux

2024-06-25

7 min read time

Registering repositories#

Package signing key#

Download and convert the package signing key.

# Make the directory if it doesn't exist yet.
# This location is recommended by the distribution maintainers.
sudo mkdir --parents --mode=0755 /etc/apt/keyrings

# Download the key, convert the signing-key to a full
# keyring required by apt and store in the keyring directory
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | \
    gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null

Note

The GPG key may change; ensure it is updated when installing a new release. If the key signature verification fails while updating, re-add the key from the ROCm to the apt repository as mentioned above.

Register kernel-mode driver#

Add the AMDGPU repository for the driver.

echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/amdgpu/6.1/ubuntu jammy main" \
    | sudo tee /etc/apt/sources.list.d/amdgpu.list
sudo apt update
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/amdgpu/6.1/ubuntu focal main" \
    | sudo tee /etc/apt/sources.list.d/amdgpu.list
sudo apt update

Register ROCm packages#

Add the ROCm repository.

echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.1 jammy main" \
    | sudo tee --append /etc/apt/sources.list.d/rocm.list
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' \
    | sudo tee /etc/apt/preferences.d/rocm-pin-600
sudo apt update
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.1 focal main" \
    | sudo tee --append /etc/apt/sources.list.d/rocm.list
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' \
    | sudo tee /etc/apt/preferences.d/rocm-pin-600
sudo apt update

Installing#

Install kernel driver#

sudo apt install amdgpu-dkms
sudo reboot

Install ROCm packages#

sudo apt install rocm

Complete the Post-installation instructions.

Multi-version install#

Multi-version install is for the special case, when you need multiple versions of ROCm on the same machine, not just the newest. If you just want to install the latest use the steps in Registering repositories and Installing.

Package signing key#

This step is the same as previously described, follow the steps in Package signing key..

Register kernel-mode driver#

Add the AMDGPU repository for the driver.

for ver in 6.1.0 6.0.2; do
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/amdgpu/$ver/ubuntu jammy main" \
    | sudo tee /etc/apt/sources.list.d/amdgpu.list
done
sudo apt update
for ver in 6.1.0 6.0.2; do
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/amdgpu/$ver/ubuntu focal main" \
    | sudo tee /etc/apt/sources.list.d/amdgpu.list
done
sudo apt update

Register ROCm packages#

Add the ROCm repository.

for ver in 6.1.0 6.0.2; do
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/$ver jammy main" \
    | sudo tee --append /etc/apt/sources.list.d/rocm.list
done
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' \
    | sudo tee /etc/apt/preferences.d/rocm-pin-600
sudo apt update
for ver in 6.1.0 6.0.2; do
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/$ver focal main" \
    | sudo tee --append /etc/apt/sources.list.d/rocm.list
done
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' \
    | sudo tee /etc/apt/preferences.d/rocm-pin-600
sudo apt update

Installing#

Install the kernel driver.

sudo apt install amdgpu-dkms
sudo reboot

Install ROCm packages.

for ver in 6.1.0 6.0.2; do
    sudo apt install rocm$ver
done

Complete the Post-installation instructions.

Upgrading#

To upgrade an existing ROCm installation to a newer version, follow the steps in Registering repositories and Installing.

Note

Upgrading the kernel driver may also upgrade the GPU firmware, which requires a system reboot to take effect.

Uninstalling#

Uninstall specific meta packages#

# sudo apt autoremove <package-name>
# For example:
sudo apt autoremove rocm
# Or for version specific packages:
sudo apt autoremove rocm6.1

Uninstall ROCm packages#

sudo apt autoremove rocm-core
# Or for version specific packages:
sudo apt autoremove rocm-core6.1

Uninstall kernel-mode driver#

sudo apt autoremove amdgpu-dkms

Remove ROCm and AMDGPU repositories#

# Remove the repositories.
sudo rm /etc/apt/sources.list.d/rocm.list
sudo rm /etc/apt/sources.list.d/amdgpu.list

# Clear the cache and clean the system.
sudo rm -rf /var/cache/apt/*
sudo apt-get clean all

# Restart the system.
sudo reboot