1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (C) 2020 Intel Corporation 4# All rights reserved. 5# Copyright (c) 2022 Dell Inc, or its subsidiaries. 6# 7 8disclaimer() { 9 case "$ID" in 10 rhel) 11 cat <<- WARN 12 13 WARNING: $PRETTY_NAME system detected. 14 15 Please, note that the support for this platform is considered to be "best-effort", 16 as in, access to some packages may be limited and/or missing. Review your repo 17 setup to make sure installation of all dependencies is possible. 18 19 WARN 20 21 # Don't trigger errexit, simply install what's available. This is default 22 # behavior of older yum versions (e.g. the one present on RHEL 7.x) anyway. 23 yum() { "$(type -P yum)" --skip-broken "$@"; } 24 # For systems which are not registered, subscription-manager will most likely 25 # fail on most calls so simply ignore its failures. 26 sub() { subscription-manager "$@" || :; } 27 ;; 28 rocky) 29 [[ $VERSION_ID == 8* ]] || return 0 30 yum() { "$(type -P yum)" --setopt=skip_if_unavailable=True "$@"; } 31 ;; 32 esac 33} 34 35is_repo() { yum repolist --all | grep -q "^$1"; } 36 37disclaimer 38 39# First, add extra EPEL, ELRepo, Ceph repos to have a chance of covering most of the packages 40# on the enterprise systems, like RHEL. 41if [[ $ID == centos || $ID == rhel || $ID == rocky ]]; then 42 repos=() enable=("epel" "elrepo" "elrepo-testing") add=() 43 [[ $ID == centos || $ID == rocky ]] && enable+=("extras") 44 if [[ $VERSION_ID == 7* ]]; then 45 repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm") 46 repos+=("https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm") 47 [[ $ID == centos ]] && repos+=("centos-release-ceph-nautilus.noarch") 48 [[ $ID == centos ]] && repos+=("centos-release-scl-rh") 49 # Disable liburing, see https://github.com/spdk/spdk/issues/1564 50 if [[ $INSTALL_LIBURING == true ]]; then 51 echo "Liburing not supported on ${ID}$VERSION_ID, disabling" 52 INSTALL_LIBURING=false 53 fi 54 add+=("https://packages.daos.io/v2.0/CentOS7/packages/x86_64/daos_packages.repo") 55 enable+=("daos-packages") 56 fi 57 if [[ $VERSION_ID == 8* ]]; then 58 repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm") 59 repos+=("https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm") 60 add+=("https://packages.daos.io/v2.0/EL8/packages/x86_64/daos_packages.repo") 61 enable+=("daos-packages") 62 fi 63 64 if [[ $VERSION_ID == 9* ]]; then 65 repos+=("https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm") 66 repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm") 67 [[ $ID != rhel ]] && enable+=("crb") 68 fi 69 70 # Add PowerTools needed for install CUnit-devel 71 if [[ ($ID == centos || $ID == rocky) && $VERSION_ID =~ ^[89].* ]]; then 72 is_repo "PowerTools" && enable+=("PowerTools") 73 is_repo "powertools" && enable+=("powertools") 74 repos+=("centos-release-ceph-pacific.noarch") 75 enable+=("centos-ceph-pacific") 76 fi 77 78 [[ $ID == rhel && $VERSION_ID == 8* ]] && repos+=("https://download.ceph.com/rpm-pacific/el8/noarch/ceph-release-1-1.el8.noarch.rpm") 79 [[ $ID == rhel && $VERSION_ID == 9* ]] && repos+=("https://download.ceph.com/rpm-reef/el9/noarch/ceph-release-1-1.el9.noarch.rpm") 80 81 if [[ $ID == rocky ]]; then 82 enable+=("devel") 83 fi 84 85 if ((${#add[@]} > 0)); then 86 for _repo in "${add[@]}"; do 87 yum-config-manager --add-repo "$_repo" 88 done 89 fi 90 91 if ((${#repos[@]} > 0)); then 92 yum install -y "${repos[@]}" yum-utils 93 yum-config-manager --enable "${enable[@]}" 94 fi 95 # Potential dependencies can be needed from other RHEL repos, enable them 96 if [[ $ID == rhel ]]; then 97 [[ $VERSION_ID == 7* ]] && sub repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" 98 [[ $VERSION_ID == 8* ]] && sub repos --enable codeready-builder-for-rhel-8-x86_64-rpms 99 [[ $VERSION_ID == 9* ]] && sub repos --enable codeready-builder-for-rhel-9-x86_64-rpms 100 fi 101fi 102 103yum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ 104 libuuid-devel libiscsi-devel ncurses-devel json-c-devel libcmocka-devel \ 105 clang clang-devel python3-pip unzip keyutils keyutils-libs-devel fuse3-devel patchelf \ 106 pkgconfig 107 108# Minimal install 109# workaround for arm: ninja fails with dep on skbuild python module 110if [ "$(uname -m)" = "aarch64" ]; then 111 pip3 install scikit-build 112 if echo "$ID $VERSION_ID" | grep -E -q 'centos 7'; then 113 # by default centos 7.x uses cmake 2.8 while ninja requires 3.6 or higher 114 yum install -y cmake3 115 # cmake3 is installed as /usr/bin/cmake3 while ninja directly calls `cmake`. Create a soft link 116 # as a workaround 117 mkdir -p /tmp/bin/ 118 ln -s /usr/bin/cmake3 /tmp/bin/cmake > /dev/null 2>&1 || true 119 export PATH=/tmp/bin:$PATH 120 fi 121fi 122 123# for rhel and centos7 OpenSSL 1.1 should be installed via EPEL 124if echo "$ID $VERSION_ID" | grep -E -q 'centos 7|rhel 7'; then 125 yum install -y openssl11-devel 126fi 127if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rhel 8|rocky 8'; then 128 yum install -y python36 python36-devel 129 #Create hard link to use in SPDK as python 130 if [[ ! -e /usr/bin/python && -e /etc/alternatives/python3 ]]; then 131 ln -s /etc/alternatives/python3 /usr/bin/python 132 fi 133 # pip3, which is shipped with centos8 and rocky8, is currently providing faulty ninja binary 134 # which segfaults at each run. To workaround it, upgrade pip itself and then use it for each 135 # package - new pip will provide ninja at the same version but with the actually working 136 # binary. 137 pip3 install --upgrade pip 138 pip3() { /usr/local/bin/pip "$@"; } 139else 140 yum install -y python python3-devel 141fi 142pip3 install ninja 143pip3 install meson 144pip3 install pyelftools 145pip3 install ijson 146pip3 install python-magic 147pip3 install Jinja2 148pip3 install pandas 149pip3 install tabulate 150if ! [[ $ID == centos && $VERSION_ID == 7 ]]; then 151 # Problem with modules compilation on Centos7 152 pip3 install grpcio 153 pip3 install grpcio-tools 154fi 155pip3 install pyyaml 156 157# Additional dependencies for SPDK CLI - not available in rhel and centos 158if ! echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7'; then 159 yum install -y python3-configshell python3-pexpect 160fi 161# Additional dependencies for ISA-L used in compression 162yum install -y autoconf automake libtool help2man 163# Additional dependencies for DPDK 164yum install -y numactl-devel nasm 165# Additional dependencies for USDT 166yum install -y systemtap-sdt-devel 167if [[ $INSTALL_DEV_TOOLS == "true" ]]; then 168 # Tools for developers 169 devtool_pkgs=(git sg3_utils pciutils libabigail bash-completion ruby-devel) 170 171 if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rocky 8'; then 172 devtool_pkgs+=(python3-pycodestyle astyle) 173 echo "Centos 8 and Rocky 8 do not have lcov and ShellCheck dependencies" 174 elif [[ $ID == openeuler ]]; then 175 devtool_pkgs+=(python3-pycodestyle) 176 echo "openEuler does not have astyle, lcov and ShellCheck dependencies" 177 else 178 devtool_pkgs+=(python-pycodestyle astyle lcov ShellCheck) 179 fi 180 181 if [[ $ID == fedora ]]; then 182 devtool_pkgs+=(rubygem-{bundler,rake}) 183 fi 184 185 yum install -y "${devtool_pkgs[@]}" 186fi 187if [[ $INSTALL_PMEM == "true" ]]; then 188 # Additional dependencies for building pmem based backends 189 yum install -y libpmemobj-devel || true 190fi 191if [[ $INSTALL_RBD == "true" ]]; then 192 # Additional dependencies for RBD bdev in NVMe over Fabrics 193 yum install -y librados-devel librbd-devel 194fi 195if [[ $INSTALL_RDMA == "true" ]]; then 196 # Additional dependencies for RDMA transport in NVMe over Fabrics 197 yum install -y libibverbs-devel librdmacm-devel 198fi 199if [[ $INSTALL_DOCS == "true" ]]; then 200 # Additional dependencies for building docs 201 yum install -y mscgen || echo "Warning: couldn't install mscgen via yum. Please install mscgen manually." 202 yum install -y doxygen graphviz 203fi 204if [[ $INSTALL_DAOS == "true" ]]; then 205 if [[ ($ID == centos || $ID == rocky) && $VERSION_ID =~ ^[78].* ]]; then 206 yum install -y daos-devel 207 else 208 echo "Skipping installation of DAOS bdev dependencies. Supported only under centos, rocky (variants 7-8)." 209 fi 210fi 211# Additional dependencies for Avahi 212if [[ $INSTALL_AVAHI == "true" ]]; then 213 # Additional dependencies for Avahi 214 yum install -y avahi-devel 215fi 216if [[ $INSTALL_IDXD == "true" ]]; then 217 # accel-config-devel is required for kernel IDXD implementation used in DSA accel module 218 if [[ $ID == centos && $VERSION_ID == 7* ]]; then 219 echo "Installation of IDXD dependencies not supported under ${ID}${VERSION_ID}" 220 else 221 yum install -y accel-config-devel 222 fi 223fi 224if [[ $INSTALL_LZ4 == "true" ]]; then 225 yum install -y lz4-devel 226fi 227