Skip to content

Instantly share code, notes, and snippets.

@noslin005
Created June 23, 2021 12:31
Show Gist options
  • Save noslin005/b0d315c814cd1cb37a7aafdae5df4ef0 to your computer and use it in GitHub Desktop.
Save noslin005/b0d315c814cd1cb37a7aafdae5df4ef0 to your computer and use it in GitHub Desktop.
Install Mellanox Ofed on Ubuntu Machines
#!/bin/bash
# ofed-ubuntu.sh
# Install Mellanox Ofed on Ubuntu Machines
#
# Author: Nilson Lopes (06/17/2021)
ubuntu_release=$(awk -F '"' '/VERSION_ID/ {print $2}' /etc/os-release)
mofed_package_version='latest'
mofed_repo_base_url="https://linux.mellanox.com/public/repo/mlnx_ofed"
mofed_repo_gpg_url="https://www.mellanox.com/downloads/ofed/RPM-GPG-KEY-Mellanox"
ubuntu_repo_dist_name="ubuntu${ubuntu_release}"
ubuntu_repo_file_name="mellanox_mlnx_ofed.list"
ubuntu_repo_file_path="/etc/apt/sources.list.d/${ubuntu_repo_file_name}"
echo "adding apt key"
wget -qO - ${mofed_repo_gpg_url} | apt-key add -
url="${mofed_repo_base_url}/${mofed_package_version}/${ubuntu_repo_dist_name}/${ubuntu_repo_file_name}"
wget -qO ${ubuntu_repo_file_path} ${url}
chmod 644 ${ubuntu_repo_file_path}
echo "update apt cache"
apt update -y
echo "install packages"
OFED_PKGS=(libc6-dev
mlnx-ofed-kernel-dkms
mlnx-ofed-kernel-utils
mlnx-ofed-basic
rdma-core
ibverbs-utils
ibverbs-providers
)
apt install -y ${OFED_PKGS[@]}
echo "configure ib devices ..."
systemctl restart openibd
@Antonytm
Copy link

works like a charm!

@flakrat
Copy link

flakrat commented Jan 13, 2025

Worked great on Ubuntu 24.04 LTS.

@danhthevodanh
Copy link

Thank you

@AxoyTO
Copy link

AxoyTO commented Sep 5, 2025

Works well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment