-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemr_ibis_bootstrap.sh
executable file
·70 lines (56 loc) · 1.91 KB
/
emr_ibis_bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
################################################################################
# Script Name: emr_ibis_bootstrap.sh
# Description: This script installs the necessary components to run the
# ibis-framework on an AWS EMR (Spark) cluster.
# It installs Python 3.10 from source with OpenSSL.
# This is because the latest EMR version (as of March 15, 2023) -
# 6.10.0 comes with Python 3.7 and doesn't work with the latest
# ibis-framework version (which requires Python 3.8 or above).
#
# Usage: ./emr_ibis_bootstrap.sh
#
# Author: Voltron Data
# Date: March 15, 2023
#
# Version: 1.0
################################################################################
set -e
OPENSSL_VERSION="3.1.0"
PYTHON_VERSION="3.10.10"
# Install dependencies
sudo yum update -y
sudo yum groupinstall "Development Tools" -y
sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel perl-IPC-Cmd -y
pushd /tmp
# Install OpenSSL from source
curl -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
tar xzf openssl-${OPENSSL_VERSION}.tar.gz
pushd openssl-${OPENSSL_VERSION}
./config \
--prefix=/usr/local/custom-openssl \
--libdir=lib \
--openssldir=/etc/pki/tls
make -j1 depend
make -j8
sudo make install_sw
popd
# Get Python source code
curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
tar -xvzf Python-${PYTHON_VERSION}.tgz
pushd Python-${PYTHON_VERSION}
# Configure, build, and install
./configure \
--prefix=/usr \
--enable-optimizations \
--with-openssl=/usr/local/custom-openssl \
--with-openssl-rpath=auto
make -j8
sudo make install
popd
popd
# Install ibis PySpark requirements
pip3 install --upgrade pip setuptools
pip3 install ibis-framework[pyspark] sqlalchemy==1.4.*
echo "All steps completed successfully."
exit 0