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 cmake 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 106pip3 install grpcio 107pip3 install grpcio-tools 108 109# Additional dependencies for SPDK CLI - not available in rhel and centos 110if ! echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7'; then 111 yum install -y python3-configshell python3-pexpect 112fi 113# Additional dependencies for ISA-L used in compression 114yum install -y autoconf automake libtool help2man 115# Additional dependencies for DPDK 116yum install -y numactl-devel nasm 117# Additional dependencies for USDT 118yum install -y systemtap-sdt-devel 119if [[ $INSTALL_DEV_TOOLS == "true" ]]; then 120 # Tools for developers 121 if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rocky 8'; then 122 yum install -y python3-pycodestyle 123 echo "Centos 8 and Rocky 8 do not have lcov and ShellCheck dependencies" 124 else 125 yum install -y python-pycodestyle lcov ShellCheck 126 fi 127 yum install -y git astyle sg3_utils pciutils libabigail bash-completion ruby-devel 128fi 129if [[ $INSTALL_PMEM == "true" ]]; then 130 # Additional dependencies for building pmem based backends 131 yum install -y libpmemblk-devel || true 132 yum install -y libpmemobj-devel || true 133fi 134if [[ $INSTALL_FUSE == "true" ]]; then 135 # Additional dependencies for FUSE and NVMe-CUSE 136 yum install -y fuse3-devel 137fi 138if [[ $INSTALL_RDMA == "true" ]]; then 139 # Additional dependencies for RDMA transport in NVMe over Fabrics 140 yum install -y libibverbs-devel librdmacm-devel 141fi 142if [[ $INSTALL_DOCS == "true" ]]; then 143 # Additional dependencies for building docs 144 yum install -y mscgen || echo "Warning: couldn't install mscgen via yum. Please install mscgen manually." 145 yum install -y doxygen graphviz 146fi 147