1#!/usr/bin/env bash 2 3disclaimer() { 4 case "$ID" in 5 rhel) 6 cat <<- WARN 7 8 WARNING: $PRETTY_NAME system detected. 9 10 Please, note that the support for this platform is considered to be "best-effort", 11 as in, access to some packages may be limited and/or missing. Review your repo 12 setup to make sure installation of all dependencies is possible. 13 14 WARN 15 16 # Don't trigger errexit, simply install what's available. This is default 17 # behavior of older yum versions (e.g. the one present on RHEL 7.x) anyway. 18 yum() { "$(type -P yum)" --skip-broken "$@"; } 19 # For systems which are not registered, subscription-manager will most likely 20 # fail on most calls so simply ignore its failures. 21 sub() { subscription-manager "$@" || :; } 22 ;; 23 24 *) ;; 25 esac 26} 27 28is_repo() { yum repolist --all | grep -q "^$1"; } 29 30disclaimer 31 32# First, add extra EPEL, ELRepo, Ceph repos to have a chance of covering most of the packages 33# on the enterprise systems, like RHEL. 34if [[ $ID == centos || $ID == rhel || $ID == rocky ]]; then 35 repos=() enable=("epel" "elrepo" "elrepo-testing") 36 [[ $ID == centos || $ID == rocky ]] && enable+=("extras") 37 if [[ $VERSION_ID == 7* ]]; then 38 repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm") 39 repos+=("https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm") 40 [[ $ID == centos ]] && repos+=("centos-release-ceph-nautilus.noarch") 41 [[ $ID == centos ]] && repos+=("centos-release-scl-rh") 42 # Disable liburing, see https://github.com/spdk/spdk/issues/1564 43 if [[ $INSTALL_LIBURING == true ]]; then 44 echo "Liburing not supported on ${ID}$VERSION_ID, disabling" 45 INSTALL_LIBURING=false 46 fi 47 fi 48 if [[ $VERSION_ID == 8* ]]; then 49 repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm") 50 repos+=("https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm") 51 [[ $ID == centos || $ID == rocky ]] \ 52 && repos+=("https://download.ceph.com/rpm-nautilus/el8/noarch/ceph-release-1-1.el8.noarch.rpm") 53 # Add PowerTools needed for install CUnit-devel in Centos8 54 if [[ $ID == centos || $ID == rocky ]]; then 55 is_repo "PowerTools" && enable+=("PowerTools") 56 is_repo "powertools" && enable+=("powertools") 57 fi 58 fi 59 if ((${#repos[@]} > 0)); then 60 yum install -y "${repos[@]}" yum-utils 61 yum-config-manager --enable "${enable[@]}" 62 fi 63 # Potential dependencies can be needed from other RHEL repos, enable them 64 if [[ $ID == rhel ]]; then 65 [[ $VERSION_ID == 7* ]] && sub repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" 66 [[ $VERSION_ID == 8* ]] && sub repos --enable codeready-builder-for-rhel-8-x86_64-rpms 67 fi 68fi 69 70# Minimal install 71# workaround for arm: ninja fails with dep on skbuild python module 72if [ "$(uname -m)" = "aarch64" ]; then 73 pip3 install scikit-build 74 if echo "$ID $VERSION_ID" | grep -E -q 'centos 7'; then 75 # by default centos 7.x uses cmake 2.8 while ninja requires 3.6 or higher 76 yum install -y cmake3 77 # cmake3 is installed as /usr/bin/cmake3 while ninja directly calls `cmake`. Create a soft link 78 # as a workaround 79 mkdir -p /tmp/bin/ 80 ln -s /usr/bin/cmake3 /tmp/bin/cmake > /dev/null 2>&1 || true 81 export PATH=/tmp/bin:$PATH 82 fi 83fi 84 85yum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ 86 libuuid-devel libiscsi-devel ncurses-devel json-c-devel libcmocka-devel 87# for rhel and centos7 OpenSSL 1.1 should be installed via EPEL 88if echo "$ID $VERSION_ID" | grep -E -q 'centos 7|rhel 7'; then 89 yum install -y openssl11-devel 90fi 91if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rhel 8|rocky 8'; then 92 yum install -y python36 python36-devel 93 #Create hard link to use in SPDK as python 94 if [[ ! -e /usr/bin/python && -e /etc/alternatives/python3 ]]; then 95 ln -s /etc/alternatives/python3 /usr/bin/python 96 fi 97else 98 yum install -y python python3-devel 99fi 100yum install -y python3-pip 101pip3 install ninja 102pip3 install meson 103pip3 install pyelftools 104pip3 install ijson 105pip3 install python-magic 106if ! [[ $ID == centos && $VERSION_ID == 7 ]]; then 107 # Problem with modules compilation on Centos7 108 pip3 install grpcio 109 pip3 install grpcio-tools 110fi 111pip3 install pyyaml 112 113# Additional dependencies for SPDK CLI - not available in rhel and centos 114if ! echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7'; then 115 yum install -y python3-configshell python3-pexpect 116fi 117# Additional dependencies for ISA-L used in compression 118yum install -y autoconf automake libtool help2man 119# Additional dependencies for DPDK 120yum install -y numactl-devel nasm 121# Additional dependencies for USDT 122yum install -y systemtap-sdt-devel 123if [[ $INSTALL_DEV_TOOLS == "true" ]]; then 124 # Tools for developers 125 if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rocky 8'; then 126 yum install -y python3-pycodestyle 127 echo "Centos 8 and Rocky 8 do not have lcov and ShellCheck dependencies" 128 else 129 yum install -y python-pycodestyle lcov ShellCheck 130 fi 131 yum install -y git astyle sg3_utils pciutils libabigail bash-completion ruby-devel 132fi 133if [[ $INSTALL_PMEM == "true" ]]; then 134 # Additional dependencies for building pmem based backends 135 yum install -y libpmemblk-devel || true 136 yum install -y libpmemobj-devel || true 137fi 138if [[ $INSTALL_FUSE == "true" ]]; then 139 # Additional dependencies for FUSE and NVMe-CUSE 140 yum install -y fuse3-devel 141fi 142if [[ $INSTALL_RDMA == "true" ]]; then 143 # Additional dependencies for RDMA transport in NVMe over Fabrics 144 yum install -y libibverbs-devel librdmacm-devel 145fi 146if [[ $INSTALL_DOCS == "true" ]]; then 147 # Additional dependencies for building docs 148 yum install -y mscgen || echo "Warning: couldn't install mscgen via yum. Please install mscgen manually." 149 yum install -y doxygen graphviz 150fi 151if [[ $INSTALL_DAOS == "true" ]]; then 152 if [[ $ID == centos || $ID == rocky ]]; then 153 if ! hash yum-config-manager &> /dev/null; then 154 yum install -y yum-utils 155 fi 156 yum-config-manager --add-repo "https://packages.daos.io/v2.0/CentOS${VERSION_ID:0:1}/packages/x86_64/daos_packages.repo" 157 yum-config-manager --enable "daos-packages" 158 yum install -y daos-devel 159 else 160 echo "Skipping installation of DAOS bdev dependencies. It is supported only for CentOS 7, CentOS 8 and Rocky 8" 161 fi 162fi 163