xref: /spdk/scripts/pkgdep/rhel.sh (revision 2172c432cfdaecc5a279d64e37c6b51e794683c1)
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
28disclaimer
29
30# First, add extra EPEL, ELRepo, Ceph repos to have a chance of covering most of the packages
31# on the enterprise systems, like RHEL.
32if [[ $ID == centos || $ID == rhel ]]; then
33	repos=() enable=("epel" "elrepo" "elrepo-testing")
34	[[ $ID == centos ]] && enable+=("extras")
35	if [[ $VERSION_ID == 7* ]]; then
36		repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm")
37		repos+=("https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm")
38		[[ $ID == centos ]] && repos+=("centos-release-ceph-nautilus.noarch")
39		# Disable liburing, see https://github.com/spdk/spdk/issues/1564
40		if [[ $INSTALL_LIBURING == true ]]; then
41			echo "Liburing not supported on ${ID}$VERSION_ID, disabling"
42			INSTALL_LIBURING=false
43		fi
44	fi
45	if [[ $VERSION_ID == 8* ]]; then
46		repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm")
47		repos+=("https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm")
48		[[ $ID == centos ]] && repos+=("centos-release-ceph-nautilus.noarch")
49		# Add PowerTools needed for install CUnit-devel in Centos8
50		[[ $ID == centos ]] && enable+=("PowerTools")
51	fi
52	if ((${#repos[@]} > 0)); then
53		yum install -y "${repos[@]}" yum-utils
54		yum-config-manager --enable "${enable[@]}"
55	fi
56	# Potential dependencies can be needed from other RHEL repos, enable them
57	if [[ $ID == rhel ]]; then
58		[[ $VERSION_ID == 7* ]] && sub repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
59		[[ $VERSION_ID == 8* ]] && sub repos --enable codeready-builder-for-rhel-8-x86_64-rpms
60	fi
61fi
62
63# Minimal install
64# workaround for arm: ninja fails with dep on skbuild python module
65if [ "$(uname -m)" = "aarch64" ]; then
66	pip3 install scikit-build
67	if echo "$ID $VERSION_ID" | grep -E -q 'centos 7'; then
68		# by default centos 7.x uses cmake 2.8 while ninja requires 3.6 or higher
69		yum install -y cmake3
70		# cmake3 is installed as /usr/bin/cmake3 while ninja directly calls `cmake`. Create a soft link
71		# as a workaround
72		mkdir -p /tmp/bin/
73		ln -s /usr/bin/cmake3 /tmp/bin/cmake > /dev/null 2>&1 || true
74		export PATH=/tmp/bin:$PATH
75	fi
76fi
77
78yum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \
79	libuuid-devel libiscsi-devel ncurses-devel
80if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rhel 8'; then
81	yum install -y python36
82	#Create hard link to use in SPDK as python
83	if [[ ! -e /usr/bin/python && -e /etc/alternative/python3 ]]; then
84		ln -s /etc/alternatives/python3 /usr/bin/python
85	fi
86else
87	yum install -y python
88fi
89yum install -y python3-pip
90pip3 install ninja
91pip3 install meson
92
93# Additional dependencies for SPDK CLI - not available in rhel and centos
94if ! echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7'; then
95	yum install -y python3-configshell python3-pexpect
96fi
97# Additional dependencies for ISA-L used in compression
98yum install -y autoconf automake libtool help2man
99# Additional dependencies for DPDK
100yum install -y numactl-devel nasm
101if [[ $INSTALL_DEV_TOOLS == "true" ]]; then
102	# Tools for developers
103	if echo "$ID $VERSION_ID" | grep -E -q 'centos 8'; then
104		yum install -y python3-pycodestyle
105		echo "Centos 8 does not have lcov and ShellCheck dependencies"
106	else
107		yum install -y python-pycodestyle lcov ShellCheck
108	fi
109	yum install -y git astyle sg3_utils pciutils libabigail
110fi
111if [[ $INSTALL_PMEM == "true" ]]; then
112	# Additional dependencies for building pmem based backends
113	yum install -y libpmemblk-devel || true
114fi
115if [[ $INSTALL_FUSE == "true" ]]; then
116	# Additional dependencies for FUSE and NVMe-CUSE
117	yum install -y fuse3-devel
118fi
119if [[ $INSTALL_RDMA == "true" ]]; then
120	# Additional dependencies for RDMA transport in NVMe over Fabrics
121	yum install -y libibverbs-devel librdmacm-devel
122fi
123if [[ $INSTALL_DOCS == "true" ]]; then
124	# Additional dependencies for building docs
125	yum install -y mscgen || echo "Warning: couldn't install mscgen via yum. Please install mscgen manually."
126	yum install -y doxygen graphviz
127fi
128