175febdfbSMichal Berger#!/usr/bin/env bash 2eb53c232Spaul luse# SPDX-License-Identifier: BSD-3-Clause 3eb53c232Spaul luse# Copyright (C) 2020 Intel Corporation 4eb53c232Spaul luse# All rights reserved. 534bc24f1SJim Harris# Copyright (c) 2022 Dell Inc, or its subsidiaries. 6eb53c232Spaul luse# 775febdfbSMichal Berger 8e989faa9SMichal Bergerdisclaimer() { 9e989faa9SMichal Berger case "$ID" in 10e989faa9SMichal Berger rhel) 11e989faa9SMichal Berger cat <<- WARN 12e989faa9SMichal Berger 13e989faa9SMichal Berger WARNING: $PRETTY_NAME system detected. 14e989faa9SMichal Berger 15e989faa9SMichal Berger Please, note that the support for this platform is considered to be "best-effort", 16e989faa9SMichal Berger as in, access to some packages may be limited and/or missing. Review your repo 17e989faa9SMichal Berger setup to make sure installation of all dependencies is possible. 18e989faa9SMichal Berger 19e989faa9SMichal Berger WARN 20e989faa9SMichal Berger 21e989faa9SMichal Berger # Don't trigger errexit, simply install what's available. This is default 22e989faa9SMichal Berger # behavior of older yum versions (e.g. the one present on RHEL 7.x) anyway. 23e989faa9SMichal Berger yum() { "$(type -P yum)" --skip-broken "$@"; } 24e1ac33d8SMichal Berger # For systems which are not registered, subscription-manager will most likely 25e1ac33d8SMichal Berger # fail on most calls so simply ignore its failures. 26e1ac33d8SMichal Berger sub() { subscription-manager "$@" || :; } 27e989faa9SMichal Berger ;; 28b8378f94SMichal Berger rocky) 29b8378f94SMichal Berger [[ $VERSION_ID == 8* ]] || return 0 30b8378f94SMichal Berger yum() { "$(type -P yum)" --setopt=skip_if_unavailable=True "$@"; } 31b8378f94SMichal Berger ;; 32e989faa9SMichal Berger esac 33e989faa9SMichal Berger} 34e989faa9SMichal Berger 353edb26fbSMichal Bergeris_repo() { yum repolist --all | grep -q "^$1"; } 363edb26fbSMichal Berger 37e989faa9SMichal Bergerdisclaimer 38e989faa9SMichal Berger 398ef9f7b2SMichal Berger# First, add extra EPEL, ELRepo, Ceph repos to have a chance of covering most of the packages 401338e698SMichal Berger# on the enterprise systems, like RHEL. 419cdadbeaSKamil Godzwonif [[ $ID == centos || $ID == rhel || $ID == rocky ]]; then 42aadd13f4SMichal Berger repos=() enable=("epel" "elrepo" "elrepo-testing") add=() 439cdadbeaSKamil Godzwon [[ $ID == centos || $ID == rocky ]] && enable+=("extras") 448ef9f7b2SMichal Berger if [[ $VERSION_ID == 7* ]]; then 458ef9f7b2SMichal Berger repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm") 468ef9f7b2SMichal Berger repos+=("https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm") 478ef9f7b2SMichal Berger [[ $ID == centos ]] && repos+=("centos-release-ceph-nautilus.noarch") 481670d1ddSMichal Berger [[ $ID == centos ]] && repos+=("centos-release-scl-rh") 4997ab0917SMichal Berger # Disable liburing, see https://github.com/spdk/spdk/issues/1564 5097ab0917SMichal Berger if [[ $INSTALL_LIBURING == true ]]; then 5197ab0917SMichal Berger echo "Liburing not supported on ${ID}$VERSION_ID, disabling" 5297ab0917SMichal Berger INSTALL_LIBURING=false 5397ab0917SMichal Berger fi 54aadd13f4SMichal Berger add+=("https://packages.daos.io/v2.0/CentOS7/packages/x86_64/daos_packages.repo") 55aadd13f4SMichal Berger enable+=("daos-packages") 561338e698SMichal Berger fi 578ef9f7b2SMichal Berger if [[ $VERSION_ID == 8* ]]; then 588ef9f7b2SMichal Berger repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm") 598ef9f7b2SMichal Berger repos+=("https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm") 60aadd13f4SMichal Berger add+=("https://packages.daos.io/v2.0/EL8/packages/x86_64/daos_packages.repo") 61aadd13f4SMichal Berger enable+=("daos-packages") 62aadd13f4SMichal Berger fi 63aadd13f4SMichal Berger 64aadd13f4SMichal Berger if [[ $VERSION_ID == 9* ]]; then 65aadd13f4SMichal Berger repos+=("https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm") 66aadd13f4SMichal Berger repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm") 673a0fa0fbSMichal Berger [[ $ID != rhel ]] && enable+=("crb") 68aadd13f4SMichal Berger fi 69aadd13f4SMichal Berger 70aadd13f4SMichal Berger # Add PowerTools needed for install CUnit-devel 71aadd13f4SMichal Berger if [[ ($ID == centos || $ID == rocky) && $VERSION_ID =~ ^[89].* ]]; then 723edb26fbSMichal Berger is_repo "PowerTools" && enable+=("PowerTools") 733edb26fbSMichal Berger is_repo "powertools" && enable+=("powertools") 74aadd13f4SMichal Berger repos+=("centos-release-ceph-pacific.noarch") 75aadd13f4SMichal Berger enable+=("centos-ceph-pacific") 763edb26fbSMichal Berger fi 77aadd13f4SMichal Berger 783a0fa0fbSMichal Berger [[ $ID == rhel && $VERSION_ID == 8* ]] && repos+=("https://download.ceph.com/rpm-pacific/el8/noarch/ceph-release-1-1.el8.noarch.rpm") 793a0fa0fbSMichal Berger [[ $ID == rhel && $VERSION_ID == 9* ]] && repos+=("https://download.ceph.com/rpm-reef/el9/noarch/ceph-release-1-1.el9.noarch.rpm") 803a0fa0fbSMichal Berger 81aadd13f4SMichal Berger if [[ $ID == rocky ]]; then 82aadd13f4SMichal Berger enable+=("devel") 831338e698SMichal Berger fi 84aadd13f4SMichal Berger 85aadd13f4SMichal Berger if ((${#add[@]} > 0)); then 86aadd13f4SMichal Berger for _repo in "${add[@]}"; do 87aadd13f4SMichal Berger yum-config-manager --add-repo "$_repo" 88aadd13f4SMichal Berger done 89aadd13f4SMichal Berger fi 90aadd13f4SMichal Berger 918ef9f7b2SMichal Berger if ((${#repos[@]} > 0)); then 920cd90081SMichal Berger yum install -y "${repos[@]}" yum-utils 938ef9f7b2SMichal Berger yum-config-manager --enable "${enable[@]}" 948ef9f7b2SMichal Berger fi 958ef9f7b2SMichal Berger # Potential dependencies can be needed from other RHEL repos, enable them 961338e698SMichal Berger if [[ $ID == rhel ]]; then 97e1ac33d8SMichal Berger [[ $VERSION_ID == 7* ]] && sub repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" 98e1ac33d8SMichal Berger [[ $VERSION_ID == 8* ]] && sub repos --enable codeready-builder-for-rhel-8-x86_64-rpms 993a0fa0fbSMichal Berger [[ $VERSION_ID == 9* ]] && sub repos --enable codeready-builder-for-rhel-9-x86_64-rpms 1001338e698SMichal Berger fi 1011338e698SMichal Bergerfi 1021338e698SMichal Berger 103b35a6f39SMichal Bergeryum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ 104b35a6f39SMichal Berger libuuid-devel libiscsi-devel ncurses-devel json-c-devel libcmocka-devel \ 105b10f50b0SMichal Berger clang clang-devel python3-pip unzip keyutils keyutils-libs-devel fuse3-devel patchelf \ 106b10f50b0SMichal Berger pkgconfig 107b35a6f39SMichal Berger 10875febdfbSMichal Berger# Minimal install 109f7b4dd34SAlexey Marchuk# workaround for arm: ninja fails with dep on skbuild python module 110f7b4dd34SAlexey Marchukif [ "$(uname -m)" = "aarch64" ]; then 111f7b4dd34SAlexey Marchuk pip3 install scikit-build 112f7b4dd34SAlexey Marchuk if echo "$ID $VERSION_ID" | grep -E -q 'centos 7'; then 113f7b4dd34SAlexey Marchuk # by default centos 7.x uses cmake 2.8 while ninja requires 3.6 or higher 114f7b4dd34SAlexey Marchuk yum install -y cmake3 115f7b4dd34SAlexey Marchuk # cmake3 is installed as /usr/bin/cmake3 while ninja directly calls `cmake`. Create a soft link 116f7b4dd34SAlexey Marchuk # as a workaround 117f7b4dd34SAlexey Marchuk mkdir -p /tmp/bin/ 118f7b4dd34SAlexey Marchuk ln -s /usr/bin/cmake3 /tmp/bin/cmake > /dev/null 2>&1 || true 119f7b4dd34SAlexey Marchuk export PATH=/tmp/bin:$PATH 120f7b4dd34SAlexey Marchuk fi 121f7b4dd34SAlexey Marchukfi 122f7b4dd34SAlexey Marchuk 1238ccb3c10SBoris Glimcher# for rhel and centos7 OpenSSL 1.1 should be installed via EPEL 1248ccb3c10SBoris Glimcherif echo "$ID $VERSION_ID" | grep -E -q 'centos 7|rhel 7'; then 1258ccb3c10SBoris Glimcher yum install -y openssl11-devel 1268ccb3c10SBoris Glimcherfi 1279cdadbeaSKamil Godzwonif echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rhel 8|rocky 8'; then 128f6dbaa06SKonrad Sztyber yum install -y python36 python36-devel 12975febdfbSMichal Berger #Create hard link to use in SPDK as python 130360fd2ccSMichal Berger if [[ ! -e /usr/bin/python && -e /etc/alternatives/python3 ]]; then 131d70ecbe9SMichal Berger ln -s /etc/alternatives/python3 /usr/bin/python 132d70ecbe9SMichal Berger fi 13366c590e0SMichal Berger # pip3, which is shipped with centos8 and rocky8, is currently providing faulty ninja binary 13466c590e0SMichal Berger # which segfaults at each run. To workaround it, upgrade pip itself and then use it for each 13566c590e0SMichal Berger # package - new pip will provide ninja at the same version but with the actually working 13666c590e0SMichal Berger # binary. 13766c590e0SMichal Berger pip3 install --upgrade pip 13866c590e0SMichal Berger pip3() { /usr/local/bin/pip "$@"; } 13975febdfbSMichal Bergerelse 140f6dbaa06SKonrad Sztyber yum install -y python python3-devel 14175febdfbSMichal Bergerfi 1428f7cb5e6SWANGHAILIANGpip3 install ninja 1438f7cb5e6SWANGHAILIANGpip3 install meson 144738cdf14SKarol Lateckipip3 install pyelftools 145597688b2SKonrad Sztyberpip3 install ijson 1465d5d9cbbSKonrad Sztyberpip3 install python-magic 147da094053SEugene Kobyakpip3 install Jinja2 148b538e6efSEugene Kobyakpip3 install pandas 149b538e6efSEugene Kobyakpip3 install tabulate 150eb341f67SKamil Godzwonif ! [[ $ID == centos && $VERSION_ID == 7 ]]; then 151eb341f67SKamil Godzwon # Problem with modules compilation on Centos7 152509241ceSKonrad Sztyber pip3 install grpcio 153509241ceSKonrad Sztyber pip3 install grpcio-tools 154eb341f67SKamil Godzwonfi 155d2db3959SKonrad Sztyberpip3 install pyyaml 15675febdfbSMichal Berger 15775febdfbSMichal Berger# Additional dependencies for SPDK CLI - not available in rhel and centos 15875febdfbSMichal Bergerif ! echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7'; then 15975febdfbSMichal Berger yum install -y python3-configshell python3-pexpect 16075febdfbSMichal Bergerfi 16175febdfbSMichal Berger# Additional dependencies for ISA-L used in compression 16275febdfbSMichal Bergeryum install -y autoconf automake libtool help2man 16375febdfbSMichal Berger# Additional dependencies for DPDK 16475febdfbSMichal Bergeryum install -y numactl-devel nasm 1655a1c74bfSJim Harris# Additional dependencies for USDT 1665a1c74bfSJim Harrisyum install -y systemtap-sdt-devel 16775febdfbSMichal Bergerif [[ $INSTALL_DEV_TOOLS == "true" ]]; then 16875febdfbSMichal Berger # Tools for developers 169ecbdca49SXinliang Liu devtool_pkgs=(git sg3_utils pciutils libabigail bash-completion ruby-devel) 170ecbdca49SXinliang Liu 1719cdadbeaSKamil Godzwon if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rocky 8'; then 172ecbdca49SXinliang Liu devtool_pkgs+=(python3-pycodestyle astyle) 1739cdadbeaSKamil Godzwon echo "Centos 8 and Rocky 8 do not have lcov and ShellCheck dependencies" 174ecbdca49SXinliang Liu elif [[ $ID == openeuler ]]; then 175ecbdca49SXinliang Liu devtool_pkgs+=(python3-pycodestyle) 176ecbdca49SXinliang Liu echo "openEuler does not have astyle, lcov and ShellCheck dependencies" 17775febdfbSMichal Berger else 178ecbdca49SXinliang Liu devtool_pkgs+=(python-pycodestyle astyle lcov ShellCheck) 17975febdfbSMichal Berger fi 180ecbdca49SXinliang Liu 1815e75b913SMichal Berger if [[ $ID == fedora ]]; then 1825e75b913SMichal Berger devtool_pkgs+=(rubygem-{bundler,rake}) 1835e75b913SMichal Berger fi 1845e75b913SMichal Berger 185ecbdca49SXinliang Liu yum install -y "${devtool_pkgs[@]}" 18675febdfbSMichal Bergerfi 18775febdfbSMichal Bergerif [[ $INSTALL_PMEM == "true" ]]; then 18875febdfbSMichal Berger # Additional dependencies for building pmem based backends 1896434aaa2SZiye Yang yum install -y libpmemobj-devel || true 19075febdfbSMichal Bergerfi 1918a5d487dSMykola Golubif [[ $INSTALL_RBD == "true" ]]; then 1928a5d487dSMykola Golub # Additional dependencies for RBD bdev in NVMe over Fabrics 1938a5d487dSMykola Golub yum install -y librados-devel librbd-devel 1948a5d487dSMykola Golubfi 19575febdfbSMichal Bergerif [[ $INSTALL_RDMA == "true" ]]; then 19675febdfbSMichal Berger # Additional dependencies for RDMA transport in NVMe over Fabrics 19775febdfbSMichal Berger yum install -y libibverbs-devel librdmacm-devel 19875febdfbSMichal Bergerfi 19975febdfbSMichal Bergerif [[ $INSTALL_DOCS == "true" ]]; then 20075febdfbSMichal Berger # Additional dependencies for building docs 20175febdfbSMichal Berger yum install -y mscgen || echo "Warning: couldn't install mscgen via yum. Please install mscgen manually." 20275febdfbSMichal Berger yum install -y doxygen graphviz 20375febdfbSMichal Bergerfi 204777afdf8SKarol Lateckiif [[ $INSTALL_DAOS == "true" ]]; then 205aadd13f4SMichal Berger if [[ ($ID == centos || $ID == rocky) && $VERSION_ID =~ ^[78].* ]]; then 206777afdf8SKarol Latecki yum install -y daos-devel 207777afdf8SKarol Latecki else 208aadd13f4SMichal Berger echo "Skipping installation of DAOS bdev dependencies. Supported only under centos, rocky (variants 7-8)." 209777afdf8SKarol Latecki fi 210777afdf8SKarol Lateckifi 21134bc24f1SJim Harris# Additional dependencies for Avahi 21234bc24f1SJim Harrisif [[ $INSTALL_AVAHI == "true" ]]; then 21334bc24f1SJim Harris # Additional dependencies for Avahi 21434bc24f1SJim Harris yum install -y avahi-devel 21534bc24f1SJim Harrisfi 21644dcf4fbSTomasz Zawadzkiif [[ $INSTALL_IDXD == "true" ]]; then 21744dcf4fbSTomasz Zawadzki # accel-config-devel is required for kernel IDXD implementation used in DSA accel module 2186b2f265fSMichal Berger if [[ $ID == centos && $VERSION_ID == 7* ]]; then 2196b2f265fSMichal Berger echo "Installation of IDXD dependencies not supported under ${ID}${VERSION_ID}" 2206b2f265fSMichal Berger else 22144dcf4fbSTomasz Zawadzki yum install -y accel-config-devel 22244dcf4fbSTomasz Zawadzki fi 2236b2f265fSMichal Bergerfi 224*6fac5aabSYankun Liif [[ $INSTALL_LZ4 == "true" ]]; then 225*6fac5aabSYankun Li yum install -y lz4-devel 226*6fac5aabSYankun Lifi 227