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 70yum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ 71 libuuid-devel libiscsi-devel ncurses-devel json-c-devel libcmocka-devel \ 72 clang clang-devel python3-pip 73 74# Minimal install 75# workaround for arm: ninja fails with dep on skbuild python module 76if [ "$(uname -m)" = "aarch64" ]; then 77 pip3 install scikit-build 78 if echo "$ID $VERSION_ID" | grep -E -q 'centos 7'; then 79 # by default centos 7.x uses cmake 2.8 while ninja requires 3.6 or higher 80 yum install -y cmake3 81 # cmake3 is installed as /usr/bin/cmake3 while ninja directly calls `cmake`. Create a soft link 82 # as a workaround 83 mkdir -p /tmp/bin/ 84 ln -s /usr/bin/cmake3 /tmp/bin/cmake > /dev/null 2>&1 || true 85 export PATH=/tmp/bin:$PATH 86 fi 87fi 88 89# for rhel and centos7 OpenSSL 1.1 should be installed via EPEL 90if echo "$ID $VERSION_ID" | grep -E -q 'centos 7|rhel 7'; then 91 yum install -y openssl11-devel 92fi 93if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rhel 8|rocky 8'; then 94 yum install -y python36 python36-devel 95 #Create hard link to use in SPDK as python 96 if [[ ! -e /usr/bin/python && -e /etc/alternatives/python3 ]]; then 97 ln -s /etc/alternatives/python3 /usr/bin/python 98 fi 99else 100 yum install -y python python3-devel 101fi 102pip3 install ninja 103pip3 install meson 104pip3 install pyelftools 105pip3 install ijson 106pip3 install python-magic 107if ! [[ $ID == centos && $VERSION_ID == 7 ]]; then 108 # Problem with modules compilation on Centos7 109 pip3 install grpcio 110 pip3 install grpcio-tools 111fi 112pip3 install pyyaml 113 114# Additional dependencies for SPDK CLI - not available in rhel and centos 115if ! echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7'; then 116 yum install -y python3-configshell python3-pexpect 117fi 118# Additional dependencies for ISA-L used in compression 119yum install -y autoconf automake libtool help2man 120# Additional dependencies for DPDK 121yum install -y numactl-devel nasm 122# Additional dependencies for USDT 123yum install -y systemtap-sdt-devel 124if [[ $INSTALL_DEV_TOOLS == "true" ]]; then 125 # Tools for developers 126 devtool_pkgs=(git sg3_utils pciutils libabigail bash-completion ruby-devel) 127 128 if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rocky 8'; then 129 devtool_pkgs+=(python3-pycodestyle astyle) 130 echo "Centos 8 and Rocky 8 do not have lcov and ShellCheck dependencies" 131 elif [[ $ID == openeuler ]]; then 132 devtool_pkgs+=(python3-pycodestyle) 133 echo "openEuler does not have astyle, lcov and ShellCheck dependencies" 134 else 135 devtool_pkgs+=(python-pycodestyle astyle lcov ShellCheck) 136 fi 137 138 yum install -y "${devtool_pkgs[@]}" 139fi 140if [[ $INSTALL_PMEM == "true" ]]; then 141 # Additional dependencies for building pmem based backends 142 yum install -y libpmemblk-devel || true 143 yum install -y libpmemobj-devel || true 144fi 145if [[ $INSTALL_FUSE == "true" ]]; then 146 # Additional dependencies for FUSE and NVMe-CUSE 147 yum install -y fuse3-devel 148fi 149if [[ $INSTALL_RDMA == "true" ]]; then 150 # Additional dependencies for RDMA transport in NVMe over Fabrics 151 yum install -y libibverbs-devel librdmacm-devel 152fi 153if [[ $INSTALL_DOCS == "true" ]]; then 154 # Additional dependencies for building docs 155 yum install -y mscgen || echo "Warning: couldn't install mscgen via yum. Please install mscgen manually." 156 yum install -y doxygen graphviz 157fi 158if [[ $INSTALL_DAOS == "true" ]]; then 159 if [[ $ID == centos || $ID == rocky ]]; then 160 if ! hash yum-config-manager &> /dev/null; then 161 yum install -y yum-utils 162 fi 163 [[ $VERSION_ID == 7* ]] && yum-config-manager --add-repo "https://packages.daos.io/v2.0/CentOS7/packages/x86_64/daos_packages.repo" 164 [[ $VERSION_ID == 8* ]] && yum-config-manager --add-repo "https://packages.daos.io/v2.0/EL8/packages/x86_64/daos_packages.repo" 165 yum-config-manager --enable "daos-packages" 166 yum install -y daos-devel 167 else 168 echo "Skipping installation of DAOS bdev dependencies. It is supported only for CentOS 7, CentOS 8 and Rocky 8" 169 fi 170fi 171