build_hue_common.sh 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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 sles12_install() {
  31. if [[ $FORCEINSTALL -eq 1 ]]; then
  32. # pre-req install
  33. sudo -- sh -c 'zypper 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-client pam_krb5 krb5-appl-clients krb5-plugin-kdb-ldap \
  39. libpcap \
  40. ncurses-devel \
  41. nmap \
  42. xmlsec1 xmlsec1-devel xmlsec1-openssl-devel'
  43. # MySQLdb install
  44. sudo -- sh -c 'zypper install -y libmysqlclient-devel libmysqlclient18 libmysqld18 libmysqld-devel'
  45. # NODEJS 14 install
  46. sudo -- sh -c 'zypper install -y npm14 nodejs14'
  47. # Pip modules install
  48. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  49. # sqlite3 install
  50. sudo -- sh -c 'curl --insecure -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  51. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  52. cd sqlite-autoconf-3350500 && \
  53. ./configure --prefix=/usr/local/ && make && make install'
  54. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  55. fi
  56. }
  57. function centos7_install() {
  58. if [[ $FORCEINSTALL -eq 1 ]]; then
  59. # pre-req install
  60. sudo -- sh -c 'yum install -y cyrus-sasl-gssapi \
  61. cyrus-sasl-plain \
  62. java-11-openjdk \
  63. java-11-openjdk-devel \
  64. java-11-openjdk-headless \
  65. krb5-workstation \
  66. libpcap \
  67. ncurses-devel \
  68. nmap-ncat \
  69. xmlsec1 \
  70. xmlsec1-openssl \
  71. unzip'
  72. # MySQLdb install
  73. sudo -- sh -c 'curl -sSLO https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm && \
  74. rpm -ivh mysql80-community-release-el7-5.noarch.rpm && \
  75. yum install -y mysql-community-libs mysql-community-client-plugins mysql-community-common'
  76. # NODEJS 14 install
  77. sudo -- sh -c 'yum install -y rh-nodejs14-nodejs'
  78. # sqlite3 install
  79. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  80. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  81. cd sqlite-autoconf-3350500 && \
  82. ./configure --prefix=/usr/local/ && make && make install'
  83. # python3.8 re install for sqlite3 3.35.5 or higher version
  84. sudo LD_LIBRARY_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_LIBRARY_PATH \
  85. LD_RUN_PATH=/usr/local/lib:$ORACLE_INSTANTCLIENT19_PATH:$LD_RUN_PATH \
  86. -- sh -c 'curl -o Python-3.8.13.tgz https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz && \
  87. tar zxvf Python-3.8.13.tgz && \
  88. cd Python-3.8.13 && \
  89. ./configure --enable-shared --prefix=/opt/cloudera/cm-agent && \
  90. make install'
  91. # Pip modules install
  92. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  93. fi
  94. }
  95. function redhat8_install() {
  96. if [[ $FORCEINSTALL -eq 1 ]]; then
  97. # pre-req install
  98. sudo -- sh -c 'yum install -y \
  99. java-11-openjdk \
  100. java-11-openjdk-devel \
  101. java-11-openjdk-headless \
  102. krb5-workstation \
  103. ncurses-devel \
  104. nmap-ncat \
  105. xmlsec1 \
  106. xmlsec1-openssl \
  107. libss \
  108. ncurses-c++-libs'
  109. # MySQLdb install
  110. sudo -- sh -c 'yum install -y python3-mysqlclient'
  111. # NODEJS 14 install
  112. sudo -- sh -c 'curl -sL https://rpm.nodesource.com/setup_14.x | bash - && yum install -y nodejs'
  113. # Pip modules install
  114. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  115. # sqlite3 install
  116. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  117. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  118. cd sqlite-autoconf-3350500 && \
  119. ./configure --prefix=/usr/local/ && make && make install'
  120. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  121. fi
  122. }
  123. function ubuntu18_install() {
  124. if [[ $FORCEINSTALL -eq 1 ]]; then
  125. # pre-req install
  126. sudo -- sh -c 'DEBIAN_FRONTEND=noninteractive apt -qq -y install \
  127. krb5-user \
  128. krb5-kdc \
  129. krb5-config \
  130. libkrb5-dev'
  131. sudo -- sh -c 'apt -y install \
  132. ldap-utils \
  133. libpython3.8-dev \
  134. libpython3.8-minimal \
  135. libpython3.8-stdlib \
  136. libxmlsec1 \
  137. libxmlsec1-openssl \
  138. netcat \
  139. nmap \
  140. python3-asn1crypto \
  141. python3-cffi-backend \
  142. python3-crypto \
  143. python3-cryptography \
  144. python3-keyring \
  145. python3-psycopg2 \
  146. python3-setuptools \
  147. python3-wheel \
  148. python3.8-venv \
  149. zlibc'
  150. # MySQLdb install
  151. # It is pre-installed
  152. # NODEJS 14 install
  153. sudo -- sh -c 'curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - && \
  154. apt -y install nodejs'
  155. # Pip modules install
  156. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  157. # sqlite3 install
  158. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  159. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  160. cd sqlite-autoconf-3350500 && \
  161. ./configure --prefix=/usr/local/ && make && make install'
  162. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  163. fi
  164. }
  165. function ubuntu20_install() {
  166. if [[ $FORCEINSTALL -eq 1 ]]; then
  167. # pre-req install
  168. sudo -- sh -c 'DEBIAN_FRONTEND=noninteractive apt -qq -y install \
  169. krb5-user \
  170. krb5-kdc \
  171. krb5-config \
  172. libkrb5-dev'
  173. sudo -- sh -c 'apt -y install \
  174. ldap-utils \
  175. libpython3.8-dev \
  176. libpython3.8-minimal \
  177. libpython3.8-stdlib \
  178. libxmlsec1 \
  179. libxmlsec1-openssl \
  180. netcat \
  181. nmap \
  182. python-asn1crypto \
  183. python3-crypto \
  184. python3-cryptography \
  185. python3-keyring \
  186. python3-psycopg2 \
  187. python3-setuptools \
  188. python3-wheel \
  189. python3.8-venv \
  190. zlibc \
  191. openssl \
  192. sudo \
  193. tar \
  194. util-linux'
  195. # MySQLdb install
  196. # It is pre-installed
  197. # NODEJS 14 install
  198. sudo -- sh -c 'curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - && \
  199. apt -y install nodejs'
  200. # Pip modules install
  201. sudo pip38_bin=${pip38_bin} -- sh -c '${pip38_bin} install virtualenv virtualenv-make-relocatable mysqlclient'
  202. # sqlite3 install
  203. sudo -- sh -c 'curl -o sqlite-autoconf-3350500.tar.gz https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz && \
  204. tar zxvf sqlite-autoconf-3350500.tar.gz && \
  205. cd sqlite-autoconf-3350500 && \
  206. ./configure --prefix=/usr/local/ && make && make install'
  207. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  208. fi
  209. }