build_hue_common.sh 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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_python_path() {
  16. export python38_bin="$PYTHON38_PATH/bin/python3.8"
  17. if [ ! -e "$python38_bin" ]; then
  18. echo "Python 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_sqlite3() {
  24. export sqlit3_bin="$SQLITE3_PATH"
  25. if [ ! -e "$sqlit3_bin" ]; then
  26. echo "sqlit3 bin does not exists at " $sqlit3_bin
  27. exit 1
  28. fi
  29. }
  30. function redhat7_ppc_install() {
  31. if [[ $FORCEINSTALL -eq 1 ]]; then
  32. # pre-req install
  33. sudo -- sh -c 'yum install -y cyrus-sasl-gssapi \
  34. cyrus-sasl-plain \
  35. java-11-openjdk \
  36. java-11-openjdk-devel \
  37. java-11-openjdk-headless \
  38. krb5-workstation \
  39. libpcap \
  40. ncurses-devel \
  41. nmap-ncat \
  42. xmlsec1 \
  43. xmlsec1-openssl \
  44. unzip'
  45. # NODEJS 14 install
  46. sudo -- sh -c 'yum install -y rh-nodejs14-runtime-3.6-1.el7.ppc64le.rpm \
  47. rh-nodejs14-npm-6.14.15-14.18.2.1.el7.ppc64le.rpm \
  48. rh-nodejs14-nodejs-14.18.2-1.el7.ppc64le.rpm'
  49. # sqlite3 install
  50. sudo TOOLS_HOME=${TOOLS_HOME} -- sh -c 'mkdir -p ${TOOLS_HOME} && \
  51. cd ${TOOLS_HOME} && \
  52. curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  53. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  54. cd sqlite-autoconf-3350500 && \
  55. ./configure --prefix=${TOOLS_HOME}/sqlite && make && make install'
  56. export LD_LIBRARY_PATH=${TOOLS_HOME}/sqlite/lib:/usr/local/lib:$LD_LIBRARY_PATH
  57. # python3.8 re install for sqlite3 3.35.5 or higher version
  58. sudo LD_LIBRARY_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_LIBRARY_PATH \
  59. LD_RUN_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_RUN_PATH \
  60. -- sh -c 'curl -o Python-3.8.13.tgz https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz && \
  61. tar zxvf Python-3.8.13.tgz && \
  62. cd Python-3.8.13 && \
  63. ./configure --enable-shared --prefix=/opt/cloudera/cm-agent && \
  64. make install'
  65. # Pip modules install
  66. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable'
  67. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  68. fi
  69. }
  70. function redhat8_ppc_install() {
  71. if [[ $FORCEINSTALL -eq 1 ]]; then
  72. # pre-req install
  73. sudo -- sh -c 'yum install -y \
  74. python38 \
  75. python38-libs \
  76. python38-devel \
  77. python38-numpy \
  78. python38-PyMySQL \
  79. python38-cryptography \
  80. python38-cffi \
  81. python38-psycopg2 \
  82. python38-Cython \
  83. python38-lxml \
  84. java-11-openjdk-devel \
  85. java-11-openjdk-headless \
  86. krb5-workstation \
  87. nmap-ncat \
  88. xmlsec1 \
  89. xmlsec1-openssl \
  90. libss \
  91. ncurses-devel'
  92. # MySQLdb install
  93. sudo -- sh -c 'yum install -y python3-mysqlclient'
  94. # NODEJS 14 install
  95. sudo -- sh -c 'yum install -y nodejs npm'
  96. # Pip modules install
  97. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  98. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  99. # sqlite3 install
  100. sudo TOOLS_HOME=${TOOLS_HOME} -- sh -c 'mkdir -p ${TOOLS_HOME} && \
  101. cd ${TOOLS_HOME} && \
  102. curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  103. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  104. cd sqlite-autoconf-3350500 && \
  105. ./configure --prefix=${TOOLS_HOME}/sqlite && make && make install'
  106. export LD_LIBRARY_PATH=${TOOLS_HOME}/sqlite/lib:/usr/local/lib:$LD_LIBRARY_PATH
  107. fi
  108. }
  109. function sles12_install() {
  110. if [[ $FORCEINSTALL -eq 1 ]]; then
  111. # pre-req install
  112. sudo -- sh -c 'zypper install -y cyrus-sasl-gssapi \
  113. cyrus-sasl-plain \
  114. java-11-openjdk \
  115. java-11-openjdk-devel \
  116. java-11-openjdk-headless \
  117. krb5-client pam_krb5 krb5-appl-clients krb5-plugin-kdb-ldap \
  118. libpcap \
  119. ncurses-devel \
  120. nmap \
  121. xmlsec1 xmlsec1-devel xmlsec1-openssl-devel'
  122. # MySQLdb install
  123. sudo -- sh -c 'zypper install -y libmysqlclient-devel libmysqlclient18 libmysqld18 libmysqld-devel'
  124. # NODEJS 14 install
  125. sudo -- sh -c 'zypper install -y npm14 nodejs14'
  126. # Pip modules install
  127. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  128. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  129. # sqlite3 install
  130. sudo -- sh -c 'curl --insecure -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  131. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  132. cd sqlite-autoconf-3350500 && \
  133. ./configure --prefix=/usr/local/ && make && make install'
  134. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  135. fi
  136. }
  137. function centos7_install() {
  138. if [[ $FORCEINSTALL -eq 1 ]]; then
  139. # pre-req install
  140. sudo -- sh -c 'yum install -y cyrus-sasl-gssapi \
  141. cyrus-sasl-plain \
  142. java-11-openjdk \
  143. java-11-openjdk-devel \
  144. java-11-openjdk-headless \
  145. krb5-workstation \
  146. libpcap \
  147. ncurses-devel \
  148. nmap-ncat \
  149. xmlsec1 \
  150. xmlsec1-openssl \
  151. unzip'
  152. # MySQLdb install
  153. sudo -- sh -c 'curl -sSLO https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm && \
  154. rpm -ivh mysql80-community-release-el7-5.noarch.rpm && \
  155. yum install -y mysql-community-libs mysql-community-client-plugins mysql-community-common'
  156. # NODEJS 14 install
  157. sudo -- sh -c 'yum install -y rh-nodejs14-nodejs'
  158. # sqlite3 install
  159. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  160. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  161. cd sqlite-autoconf-3350500 && \
  162. ./configure --prefix=/usr/local/ && make && make install'
  163. # python3.8 re install for sqlite3 3.35.5 or higher version
  164. sudo LD_LIBRARY_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_LIBRARY_PATH \
  165. LD_RUN_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_RUN_PATH \
  166. -- sh -c 'curl -o Python-3.8.13.tgz https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz && \
  167. tar zxvf Python-3.8.13.tgz && \
  168. cd Python-3.8.13 && \
  169. ./configure --enable-shared --prefix=/opt/cloudera/cm-agent && \
  170. make install'
  171. # Pip modules install
  172. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  173. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  174. fi
  175. }
  176. function redhat8_install() {
  177. if [[ $FORCEINSTALL -eq 1 ]]; then
  178. # pre-req install
  179. sudo -- sh -c 'yum install -y \
  180. java-11-openjdk \
  181. java-11-openjdk-devel \
  182. java-11-openjdk-headless \
  183. krb5-workstation \
  184. ncurses-devel \
  185. nmap-ncat \
  186. xmlsec1 \
  187. xmlsec1-openssl \
  188. libss \
  189. ncurses-c++-libs'
  190. # MySQLdb install
  191. sudo -- sh -c 'yum install -y python3-mysqlclient'
  192. # NODEJS 14 install
  193. sudo -- sh -c 'curl -sL https://rpm.nodesource.com/setup_14.x | bash - && yum install -y nodejs'
  194. # Pip modules install
  195. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  196. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  197. # sqlite3 install
  198. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  199. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  200. cd sqlite-autoconf-3350500 && \
  201. ./configure --prefix=/usr/local/ && make && make install'
  202. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  203. fi
  204. }
  205. function ubuntu18_install() {
  206. if [[ $FORCEINSTALL -eq 1 ]]; then
  207. # pre-req install
  208. sudo -- sh -c 'DEBIAN_FRONTEND=noninteractive apt -qq -y install \
  209. krb5-user \
  210. krb5-kdc \
  211. krb5-config \
  212. libkrb5-dev'
  213. sudo -- sh -c 'apt -y install \
  214. ldap-utils \
  215. libpython3.8-dev \
  216. libpython3.8-minimal \
  217. libpython3.8-stdlib \
  218. libxmlsec1 \
  219. libxmlsec1-openssl \
  220. netcat \
  221. nmap \
  222. python3-asn1crypto \
  223. python3-cffi-backend \
  224. python3-crypto \
  225. python3-cryptography \
  226. python3-keyring \
  227. python3-psycopg2 \
  228. python3-setuptools \
  229. python3-wheel \
  230. python3.8-venv \
  231. zlibc'
  232. # MySQLdb install
  233. # It is pre-installed
  234. # NODEJS 14 install
  235. sudo -- sh -c 'curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - && \
  236. apt -y install nodejs'
  237. # Pip modules install
  238. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  239. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  240. # sqlite3 install
  241. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  242. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  243. cd sqlite-autoconf-3350500 && \
  244. ./configure --prefix=/usr/local/ && make && make install'
  245. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  246. fi
  247. }
  248. function ubuntu20_install() {
  249. if [[ $FORCEINSTALL -eq 1 ]]; then
  250. # pre-req install
  251. sudo -- sh -c 'DEBIAN_FRONTEND=noninteractive apt -qq -y install \
  252. krb5-user \
  253. krb5-kdc \
  254. krb5-config \
  255. libkrb5-dev'
  256. sudo -- sh -c 'apt -y install \
  257. ldap-utils \
  258. libpython3.8-dev \
  259. libpython3.8-minimal \
  260. libpython3.8-stdlib \
  261. libxmlsec1 \
  262. libxmlsec1-openssl \
  263. netcat \
  264. nmap \
  265. python-asn1crypto \
  266. python3-crypto \
  267. python3-cryptography \
  268. python3-keyring \
  269. python3-psycopg2 \
  270. python3-setuptools \
  271. python3-wheel \
  272. python3.8-venv \
  273. zlibc \
  274. openssl \
  275. sudo \
  276. tar \
  277. util-linux'
  278. # MySQLdb install
  279. # It is pre-installed
  280. # NODEJS 14 install
  281. sudo -- sh -c 'curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - && \
  282. apt -y install nodejs'
  283. # Pip modules install
  284. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  285. sudo pip38_bin=${pip38_bin} -- sh -c 'ln -fs ${pip38_bin} $(dirname ${pip38_bin})/pip'
  286. # sqlite3 install
  287. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  288. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  289. cd sqlite-autoconf-3350500 && \
  290. ./configure --prefix=/usr/local/ && make && make install'
  291. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  292. fi
  293. }