build_hue_common.sh 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. #!/usr/bin/env bash
  2. function big_console_header() {
  3. set +x
  4. local text="$*"
  5. local spacing=$(( (75+${#text}) /2 ))
  6. printf "\n\n"
  7. echo "============================================================================"
  8. echo "============================================================================"
  9. printf "%*s\n" ${spacing} "${text}"
  10. echo "============================================================================"
  11. echo "============================================================================"
  12. printf "\n\n"
  13. set -x
  14. }
  15. function check_python38_path() {
  16. export python38_bin="$PYTHON38_PATH/bin/python3.8"
  17. if [ ! -e "$python38_bin" ]; then
  18. echo "Python38 bin does not exists at " $python38_bin
  19. exit 1
  20. fi
  21. export pip38_bin="$PYTHON38_PATH/bin/pip3.8"
  22. }
  23. function check_python39_path() {
  24. export python39_bin="$PYTHON39_PATH/bin/python3.9"
  25. if [ ! -e "$python39_bin" ]; then
  26. echo "Python39 bin does not exists at " $python39_bin
  27. exit 1
  28. fi
  29. export pip39_bin="$PYTHON39_PATH/bin/pip3.9"
  30. }
  31. function check_python310_path() {
  32. export python310_bin="$PYTHON310_PATH/bin/python3.10"
  33. if [ ! -e "$python310_bin" ]; then
  34. echo "Python310 bin does not exists at " $python310_bin
  35. exit 1
  36. fi
  37. export pip310_bin="$PYTHON310_PATH/bin/pip3.10"
  38. }
  39. function check_sqlite3() {
  40. export sqlit3_bin="$SQLITE3_PATH"
  41. if [ ! -e "$sqlit3_bin" ]; then
  42. echo "sqlit3 bin does not exists at " $sqlit3_bin
  43. exit 1
  44. fi
  45. }
  46. function redhat7_ppc_install() {
  47. if [[ $FORCEINSTALL -eq 1 ]]; then
  48. # pre-req install
  49. sudo -- sh -c 'yum install -y cyrus-sasl-gssapi \
  50. cyrus-sasl-plain \
  51. java-11-openjdk \
  52. java-11-openjdk-devel \
  53. java-11-openjdk-headless \
  54. krb5-workstation \
  55. libpcap \
  56. ncurses-devel \
  57. nmap-ncat \
  58. xmlsec1 \
  59. xmlsec1-openssl \
  60. unzip'
  61. # NODEJS 16 install
  62. # Upgrading to node-v16 because of the following CVE's in node-v14 "CVE-2021-3450, CVE-2021-44531, CVE-2023-32004, CVE-2023-32006"
  63. # Node-v20-LTS is not supported by old OS'es - Redhat7_ppc, Centos7, Ubuntu18, Sles12. So upgrading to node-v16
  64. sudo -- sh -c 'curl -fsSL https://nodejs.org/dist/v16.20.2/node-v16.20.2-linux-ppc64le.tar.gz -o node-v16.20.2-linux-ppc64le.tar.gz && \
  65. mkdir -p /usr/local/lib/nodejs && \
  66. tar -xzf node-v16.20.2-linux-ppc64le.tar.gz -C /usr/local/lib/nodejs'
  67. echo 'export PATH=/usr/local/lib/nodejs/node-v16.20.2-linux-ppc64le/bin:$PATH' >> ~/.bashrc
  68. source ~/.bashrc
  69. # sqlite3 install
  70. sudo TOOLS_HOME=${TOOLS_HOME} -- sh -c 'mkdir -p ${TOOLS_HOME} && \
  71. cd ${TOOLS_HOME} && \
  72. curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  73. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  74. cd sqlite-autoconf-3350500 && \
  75. ./configure --prefix=${TOOLS_HOME}/sqlite && make && make install'
  76. export LD_LIBRARY_PATH=${TOOLS_HOME}/sqlite/lib:/usr/local/lib:$LD_LIBRARY_PATH
  77. # python3.8 re install for sqlite3 3.35.5 or higher version
  78. sudo LD_LIBRARY_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_LIBRARY_PATH \
  79. LD_RUN_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_RUN_PATH \
  80. -- sh -c 'curl -o Python-3.8.13.tgz https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz && \
  81. tar zxvf Python-3.8.13.tgz && \
  82. cd Python-3.8.13 && \
  83. ./configure --enable-shared --prefix=/opt/cloudera/cm-agent && \
  84. make install'
  85. # Pip modules install
  86. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}''
  87. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  88. fi
  89. }
  90. function redhat8_ppc_install() {
  91. if [[ $FORCEINSTALL -eq 1 ]]; then
  92. # pre-req install
  93. sudo -- sh -c 'yum install -y \
  94. python38 \
  95. python38-libs \
  96. python38-devel \
  97. python38-numpy \
  98. python38-PyMySQL \
  99. python38-cryptography \
  100. python38-cffi \
  101. python38-psycopg2 \
  102. python38-Cython \
  103. python38-lxml \
  104. java-11-openjdk-devel \
  105. java-11-openjdk-headless \
  106. krb5-workstation \
  107. nmap-ncat \
  108. xmlsec1 \
  109. xmlsec1-openssl \
  110. libss \
  111. ncurses-devel'
  112. # Ensure pg_config is available
  113. export PG_CONFIG=$(which pg_config)
  114. if [ -z "$PG_CONFIG" ]; then
  115. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  116. exit 1
  117. fi
  118. echo "PG_CONFIG is set to $PG_CONFIG"
  119. # MySQLdb install
  120. sudo -- sh -c 'yum install -y python3-mysqlclient'
  121. # NODEJS install
  122. sudo sh -c 'curl -fsSL https://nodejs.org/dist/v20.11.0/node-v20.11.0-linux-ppc64le.tar.gz -o node-v20.11.0-linux-ppc64le.tar.gz && \
  123. mkdir -p /usr/local/lib/nodejs && \
  124. tar -xzf node-v20.11.0-linux-ppc64le.tar.gz -C /usr/local/lib/nodejs'
  125. echo 'export PATH=/usr/local/lib/nodejs/node-v20.11.0-linux-ppc64le/bin:$PATH' >> ~/.bashrc
  126. source ~/.bashrc
  127. # Pip modules install
  128. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  129. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  130. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  131. # sqlite3 install
  132. sudo TOOLS_HOME=${TOOLS_HOME} -- sh -c 'mkdir -p ${TOOLS_HOME} && \
  133. cd ${TOOLS_HOME} && \
  134. curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  135. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  136. cd sqlite-autoconf-3350500 && \
  137. ./configure --prefix=${TOOLS_HOME}/sqlite && make && make install'
  138. export LD_LIBRARY_PATH=${TOOLS_HOME}/sqlite/lib:/usr/local/lib:$LD_LIBRARY_PATH
  139. fi
  140. }
  141. function redhat9_ppc_install() {
  142. if [[ $FORCEINSTALL -eq 1 ]]; then
  143. # pre-req install
  144. sudo -- sh -c 'yum install -y \
  145. java-11-openjdk-devel \
  146. java-11-openjdk-headless \
  147. krb5-workstation \
  148. nmap-ncat \
  149. xmlsec1 \
  150. xmlsec1-openssl \
  151. libss \
  152. ncurses-devel'
  153. # Ensure pg_config is available
  154. export PG_CONFIG=$(which pg_config)
  155. if [ -z "$PG_CONFIG" ]; then
  156. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  157. exit 1
  158. fi
  159. echo "PG_CONFIG is set to $PG_CONFIG"
  160. # MySQLdb install
  161. sudo -- sh -c 'yum install -y python3-mysqlclient'
  162. # NODEJS install
  163. sudo sh -c 'curl -fsSL https://nodejs.org/dist/v20.11.0/node-v20.11.0-linux-ppc64le.tar.gz -o node-v20.11.0-linux-ppc64le.tar.gz && \
  164. mkdir -p /usr/local/lib/nodejs && \
  165. tar -xzf node-v20.11.0-linux-ppc64le.tar.gz -C /usr/local/lib/nodejs'
  166. echo 'export PATH=/usr/local/lib/nodejs/node-v20.11.0-linux-ppc64le/bin:$PATH' >> ~/.bashrc
  167. source ~/.bashrc
  168. # Pip modules install
  169. sudo pip39_bin=${pip39_bin} -- sh -c '${pip39_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  170. sudo pip39_bin=${pip39_bin} -- sh -c '${pip39_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  171. sudo pip39_bin=${pip39_bin} -- sh -c 'ln -fs ${pip39_bin} $(dirname ${pip39_bin})/pip'
  172. # sqlite3 install
  173. sudo TOOLS_HOME=${TOOLS_HOME} -- sh -c 'mkdir -p ${TOOLS_HOME} && \
  174. cd ${TOOLS_HOME} && \
  175. curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  176. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  177. cd sqlite-autoconf-3350500 && \
  178. ./configure --prefix=${TOOLS_HOME}/sqlite && make && make install'
  179. export LD_LIBRARY_PATH=${TOOLS_HOME}/sqlite/lib:/usr/local/lib:$LD_LIBRARY_PATH
  180. fi
  181. }
  182. function sles12_install() {
  183. if [[ $FORCEINSTALL -eq 1 ]]; then
  184. # pre-req install
  185. sudo -- sh -c 'zypper install -y cyrus-sasl-gssapi \
  186. cyrus-sasl-plain \
  187. java-11-openjdk \
  188. java-11-openjdk-devel \
  189. java-11-openjdk-headless \
  190. krb5-client pam_krb5 krb5-appl-clients krb5-plugin-kdb-ldap \
  191. libpcap \
  192. ncurses-devel \
  193. nmap \
  194. python3-devel \
  195. postgresql-server-devel \
  196. xmlsec1 xmlsec1-devel xmlsec1-openssl-devel'
  197. # Ensure pg_config is available
  198. export PG_CONFIG=$(which pg_config)
  199. if [ -z "$PG_CONFIG" ]; then
  200. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  201. exit 1
  202. fi
  203. echo "PG_CONFIG is set to $PG_CONFIG"
  204. # MySQLdb install
  205. sudo -- sh -c 'zypper install -y libmysqlclient-devel libmysqlclient18 libmysqld18 libmysqld-devel'
  206. # NODEJS 16 install
  207. # Upgrading to node-v16 because of the following CVE's in node-v14 "CVE-2021-3450, CVE-2021-44531, CVE-2023-32004, CVE-2023-32006"
  208. # Node-v20-LTS is not supported by old OS'es - Redhat7_ppc, Centos7, Ubuntu18, Sles12. So upgrading to node-v16
  209. sudo -- sh -c 'zypper install -y npm14 nodejs16'
  210. # Pip modules install
  211. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  212. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  213. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  214. # sqlite3 install
  215. sudo -- sh -c 'curl --insecure -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  216. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  217. cd sqlite-autoconf-3350500 && \
  218. ./configure --prefix=/usr/local/ && make && make install'
  219. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  220. fi
  221. }
  222. function sles15_install() {
  223. if [[ $FORCEINSTALL -eq 1 ]]; then
  224. # pre-req install
  225. sudo -- sh -c 'zypper install -y cyrus-sasl-gssapi \
  226. cyrus-sasl-plain \
  227. java-11-openjdk \
  228. java-11-openjdk-devel \
  229. java-11-openjdk-headless \
  230. krb5-client pam_krb5 krb5-plugin-kdb-ldap \
  231. libpcap1 \
  232. ncurses-devel \
  233. nmap \
  234. postgresql-server-devel \
  235. xmlsec1 xmlsec1-devel xmlsec1-openssl-devel'
  236. # Ensure pg_config is available
  237. export PG_CONFIG=$(which pg_config)
  238. if [ -z "$PG_CONFIG" ]; then
  239. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  240. exit 1
  241. fi
  242. echo "PG_CONFIG is set to $PG_CONFIG"
  243. # MySQLdb install
  244. sudo -- sh -c 'zypper install -y libmariadb-devel mariadb-client python3-mysqlclient'
  245. # NODEJS 18 install
  246. sudo -- sh -c 'zypper install -y nodejs18 npm20'
  247. # Pip modules install
  248. sudo pip310_bin=${pip310_bin} -- sh -c '${pip310_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  249. sudo pip310_bin=${pip310_bin} -- sh -c '${pip310_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  250. sudo pip310_bin=${pip310_bin} -- sh -c 'ln -fs ${pip310_bin} $(dirname ${pip310_bin})/pip'
  251. # sqlite3 install
  252. sudo -- sh -c 'curl --insecure -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  253. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  254. cd sqlite-autoconf-3350500 && \
  255. ./configure --prefix=/usr/local/ && make && make install'
  256. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  257. fi
  258. }
  259. function centos7_install() {
  260. if [[ $FORCEINSTALL -eq 1 ]]; then
  261. # pre-req install
  262. sudo -- sh -c 'yum install -y cyrus-sasl-gssapi \
  263. cyrus-sasl-plain \
  264. java-11-openjdk \
  265. java-11-openjdk-devel \
  266. java-11-openjdk-headless \
  267. krb5-workstation \
  268. libpcap \
  269. ncurses-devel \
  270. nmap-ncat \
  271. xmlsec1 \
  272. xmlsec1-openssl \
  273. unzip \
  274. python3-devel \
  275. postgresql-devel'
  276. # Ensure pg_config is available
  277. export PG_CONFIG=$(which pg_config)
  278. if [ -z "$PG_CONFIG" ]; then
  279. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  280. exit 1
  281. fi
  282. echo "PG_CONFIG is set to $PG_CONFIG"
  283. # MySQLdb install
  284. sudo -- sh -c 'curl -sSLO https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm && \
  285. rpm -ivh mysql80-community-release-el7-11.noarch.rpm && \
  286. yum install -y mysql-community-libs mysql-community-client-plugins mysql-community-common'
  287. # NODEJS 16 install
  288. # Upgrading to node-v16 because of the following CVE's in node-v14 "CVE-2021-3450, CVE-2021-44531, CVE-2023-32004, CVE-2023-32006"
  289. # Node-v20-LTS is not supported by old OS'es - Redhat7_ppc, Centos7, Ubuntu18, Sles12. So upgrading to node-v16
  290. sudo -- sh -c 'curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash - && \
  291. yum install -y nodejs npm'
  292. # sqlite3 install
  293. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  294. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  295. cd sqlite-autoconf-3350500 && \
  296. ./configure --prefix=/usr/local/ && make && make install'
  297. # python3.8 re install for sqlite3 3.35.5 or higher version
  298. sudo LD_LIBRARY_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_LIBRARY_PATH \
  299. LD_RUN_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_RUN_PATH \
  300. -- sh -c 'curl -o Python-3.8.13.tgz https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz && \
  301. tar zxvf Python-3.8.13.tgz && \
  302. cd Python-3.8.13 && \
  303. ./configure --enable-shared --prefix=/opt/cloudera/cm-agent && \
  304. make install'
  305. # Pip modules install
  306. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  307. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  308. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  309. fi
  310. }
  311. function redhat8_install() {
  312. if [[ $FORCEINSTALL -eq 1 ]]; then
  313. # pre-req install
  314. sudo -- sh -c 'yum install -y \
  315. java-11-openjdk \
  316. java-11-openjdk-devel \
  317. java-11-openjdk-headless \
  318. krb5-workstation \
  319. ncurses-devel \
  320. nmap-ncat \
  321. xmlsec1 \
  322. xmlsec1-openssl \
  323. libss \
  324. ncurses-c++-libs \
  325. python3-devel \
  326. postgresql-devel'
  327. # Ensure pg_config is available
  328. export PG_CONFIG=$(which pg_config)
  329. if [ -z "$PG_CONFIG" ]; then
  330. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  331. exit 1
  332. fi
  333. echo "PG_CONFIG is set to $PG_CONFIG"
  334. # MySQLdb install
  335. sudo -- sh -c 'yum install -y python3-mysqlclient'
  336. # NODEJS 20 install
  337. sudo -- sh -c 'curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash - && \
  338. yum install -y nodejs'
  339. # Pip modules install
  340. sudo pip39_bin=${pip39_bin} -- sh -c '${pip39_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  341. sudo pip39_bin=${pip39_bin} -- sh -c '${pip39_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  342. sudo pip39_bin=${pip39_bin} -- sh -c 'ln -fs ${pip39_bin} $(dirname ${pip39_bin})/pip'
  343. # sqlite3 install
  344. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  345. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  346. cd sqlite-autoconf-3350500 && \
  347. ./configure --prefix=/usr/local/ && make && make install'
  348. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  349. fi
  350. }
  351. function redhat8_arm64_install() {
  352. if [[ $FORCEINSTALL -eq 1 ]]; then
  353. # pre-req install
  354. sudo -- sh -c 'yum install -y \
  355. java-11-openjdk \
  356. java-11-openjdk-devel \
  357. java-11-openjdk-headless \
  358. krb5-workstation \
  359. ncurses-devel \
  360. nmap-ncat \
  361. xmlsec1 \
  362. xmlsec1-openssl \
  363. libss \
  364. ncurses-c++-libs'
  365. # MySQLdb install
  366. sudo -- sh -c 'yum install -y python3-mysqlclient'
  367. # NODEJS 20 install
  368. sudo -- sh -c 'curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash - && \
  369. yum install -y nodejs'
  370. # Pip modules install
  371. sudo pip39_bin=${pip39_bin} -- sh -c '${pip39_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  372. sudo pip39_bin=${pip39_bin} -- sh -c '${pip39_bin} install psycopg2-binary==2.9.6'
  373. sudo pip39_bin=${pip39_bin} -- sh -c 'ln -fs ${pip39_bin} $(dirname ${pip39_bin})/pip'
  374. # sqlite3 install
  375. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  376. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  377. cd sqlite-autoconf-3350500 && \
  378. ./configure --prefix=/usr/local/ && make && make install'
  379. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  380. fi
  381. }
  382. function ubuntu18_install() {
  383. if [[ $FORCEINSTALL -eq 1 ]]; then
  384. # pre-req install
  385. sudo -- sh -c 'DEBIAN_FRONTEND=noninteractive apt -qq -y install \
  386. krb5-user \
  387. krb5-kdc \
  388. krb5-config \
  389. libkrb5-dev'
  390. sudo -- sh -c 'apt -y install \
  391. ldap-utils \
  392. libpython3.8-dev \
  393. libpython3.8-minimal \
  394. libpython3.8-stdlib \
  395. libxmlsec1 \
  396. libxmlsec1-openssl \
  397. netcat \
  398. nmap \
  399. python3-asn1crypto \
  400. python3-cffi-backend \
  401. python3-crypto \
  402. python3-cryptography \
  403. python3-keyring \
  404. python3-psycopg2 \
  405. python3-setuptools \
  406. python3-wheel \
  407. python3.8-venv \
  408. python3-dev \
  409. libpq-dev \
  410. zlibc'
  411. # Ensure pg_config is available
  412. export PG_CONFIG=$(which pg_config)
  413. if [ -z "$PG_CONFIG" ]; then
  414. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  415. exit 1
  416. fi
  417. echo "PG_CONFIG is set to $PG_CONFIG"
  418. # MySQLdb install
  419. # It is pre-installed
  420. # NODEJS 16 install
  421. # Upgrading to node-v16 because of the following CVE's in node-v14 "CVE-2021-3450, CVE-2021-44531, CVE-2023-32004, CVE-2023-32006"
  422. # Node-v20-LTS is not supported by old OS'es - Redhat7_ppc, Centos7, Ubuntu18, Sles12. So upgrading to node-v16
  423. sudo -- sh -c 'curl -sL https://deb.nodesource.com/setup_16.x | sudo bash - && \
  424. apt -y install nodejs'
  425. # Pip modules install
  426. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  427. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  428. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  429. # sqlite3 install
  430. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  431. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  432. cd sqlite-autoconf-3350500 && \
  433. ./configure --prefix=/usr/local/ && make && make install'
  434. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  435. fi
  436. }
  437. function ubuntu20_install() {
  438. if [[ $FORCEINSTALL -eq 1 ]]; then
  439. # pre-req install
  440. sudo -- sh -c 'DEBIAN_FRONTEND=noninteractive apt -qq -y install \
  441. krb5-user \
  442. krb5-kdc \
  443. krb5-config \
  444. libkrb5-dev'
  445. sudo -- sh -c 'apt -y install \
  446. ldap-utils \
  447. libpython3.8-dev \
  448. libpython3.8-minimal \
  449. libpython3.8-stdlib \
  450. libxmlsec1 \
  451. libxmlsec1-openssl \
  452. libpq-dev \
  453. netcat \
  454. nmap \
  455. python-asn1crypto \
  456. python3-crypto \
  457. python3-cryptography \
  458. python3-keyring \
  459. python3-psycopg2 \
  460. python3-setuptools \
  461. python3-wheel \
  462. python3.8-venv \
  463. zlibc \
  464. openssl \
  465. sudo \
  466. tar \
  467. util-linux'
  468. # Ensure pg_config is available
  469. export PG_CONFIG=$(which pg_config)
  470. if [ -z "$PG_CONFIG" ]; then
  471. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  472. exit 1
  473. fi
  474. echo "PG_CONFIG is set to $PG_CONFIG"
  475. # MySQLdb install
  476. # It is pre-installed
  477. # NODEJS 20 install
  478. sudo -- sh -c 'apt-get install -y curl && \
  479. curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && \
  480. apt-get install -y nodejs'
  481. # Pip modules install
  482. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  483. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  484. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  485. # sqlite3 install
  486. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  487. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  488. cd sqlite-autoconf-3350500 && \
  489. ./configure --prefix=/usr/local/ && make && make install'
  490. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  491. fi
  492. }
  493. function ubuntu22_install() {
  494. if [[ $FORCEINSTALL -eq 1 ]]; then
  495. # pre-req install
  496. sudo -- sh -c 'DEBIAN_FRONTEND=noninteractive apt -qq -y install \
  497. krb5-user \
  498. krb5-kdc \
  499. krb5-config \
  500. libkrb5-dev'
  501. sudo -- sh -c 'apt -y install \
  502. ldap-utils \
  503. libpython3.10-dev \
  504. libpython3.10-minimal \
  505. libpython3.10-stdlib \
  506. libxmlsec1 \
  507. libxmlsec1-openssl \
  508. libpq-dev \
  509. netcat \
  510. nmap \
  511. python3-asn1crypto \
  512. python3-cryptography \
  513. python3-keyring \
  514. python3-psycopg2 \
  515. python3-setuptools \
  516. python3-wheel \
  517. python3.10-venv \
  518. openssl \
  519. sudo \
  520. tar \
  521. util-linux'
  522. # Ensure pg_config is available
  523. export PG_CONFIG=$(which pg_config)
  524. if [ -z "$PG_CONFIG" ]; then
  525. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  526. exit 1
  527. fi
  528. echo "PG_CONFIG is set to $PG_CONFIG"
  529. # MySQLdb install
  530. # It is pre-installed
  531. # NODEJS 20 install
  532. sudo -- sh -c 'apt-get install -y curl && \
  533. curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && \
  534. apt-get install -y nodejs'
  535. # Pip modules install
  536. sudo pip310_bin=${pip310_bin} -- sh -c '${pip310_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  537. sudo pip310_bin=${pip310_bin} -- sh -c '${pip310_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  538. sudo pip310_bin=${pip310_bin} -- sh -c 'ln -fs ${pip310_bin} $(dirname ${pip310_bin})/pip'
  539. # sqlite3 install
  540. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  541. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  542. cd sqlite-autoconf-3350500 && \
  543. ./configure --prefix=/usr/local/ && make && make install'
  544. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  545. fi
  546. }
  547. function redhat9_install() {
  548. if [[ $FORCEINSTALL -eq 1 ]]; then
  549. # pre-req install
  550. sudo -- sh -c 'yum install -y \
  551. java-11-openjdk \
  552. java-11-openjdk-devel \
  553. java-11-openjdk-headless \
  554. krb5-workstation \
  555. ncurses-devel \
  556. nmap-ncat \
  557. xmlsec1 \
  558. xmlsec1-openssl \
  559. libss \
  560. ncurses-c++-libs \
  561. postgresql-devel'
  562. # Ensure pg_config is available
  563. export PG_CONFIG=$(which pg_config)
  564. if [ -z "$PG_CONFIG" ]; then
  565. echo "Error: pg_config not found. Ensure PostgreSQL development libraries are installed."
  566. exit 1
  567. fi
  568. echo "PG_CONFIG is set to $PG_CONFIG"
  569. # MySQLdb install
  570. sudo -- sh -c 'yum install -y python3-mysqlclient'
  571. # NODEJS 20 install
  572. sudo -- sh -c 'curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash - && \
  573. yum install -y nodejs'
  574. # Pip modules install
  575. sudo pip39_bin=${pip39_bin} -- sh -c '${pip39_bin} install virtualenv=='${VIRTUAL_ENV_VERSION}' virtualenv-make-relocatable=='${VIRTUAL_ENV_RELOCATABLE_VERSION}' mysqlclient==2.1.1'
  576. sudo pip39_bin=${pip39_bin} -- sh -c '${pip39_bin} install psycopg2==2.9.6 --global-option=build_ext --global-option="--pg-config=$PG_CONFIG"'
  577. sudo pip39_bin=${pip39_bin} -- sh -c 'ln -fs ${pip39_bin} $(dirname ${pip39_bin})/pip'
  578. # sqlite3 install
  579. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  580. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  581. cd sqlite-autoconf-3350500 && \
  582. ./configure --prefix=/usr/local/ && make && make install'
  583. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  584. fi
  585. }