install_os_dependencies.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash
  2. #
  3. # Copyright 2019 The FATE Authors. All Rights Reserved.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. set -e
  18. if [[ ${is_root} -eq 1 ]]; then
  19. command=""
  20. else
  21. sudo -nv 2>&1
  22. if [[ $? -eq 0 ]]; then
  23. command="sudo"
  24. else
  25. echo "[INFO] no sudo permission"
  26. exit
  27. fi
  28. fi
  29. system=$(sed -e '/"/s/"//g' /etc/os-release | awk -F= '/^NAME/{print $2}')
  30. echo ${system}
  31. function ln_lib() {
  32. local lib_name=$1
  33. echo "[INFO] deal $lib_name lib"
  34. so_name="lib$lib_name.so"
  35. cd /usr/lib/x86_64-linux-gnu
  36. if [ ! -f $so_name ] && [ ! -L $so_name ]; then
  37. so_file=$(ldd /usr/bin/openssl | grep $so_name | awk '{print $1}')
  38. if [[ -n $so_file ]]; then
  39. $command ln -s $so_file $so_name
  40. echo "[INFO] ln $so_file"
  41. else
  42. echo "[INFO] can not found openssl $so_name"
  43. #$command apt-get install -y libssl1.0.0 || echo ""
  44. fi
  45. fi
  46. }
  47. case "${system}" in
  48. "CentOS Linux")
  49. echo "CentOS System"
  50. $command yum -y install gcc gcc-c++ make openssl-devel supervisor gmp-devel mpfr-devel libmpc-devel libaio numactl autoconf automake libtool libffi-devel snappy snappy-devel zlib zlib-devel bzip2 bzip2-devel lz4-devel libasan lsof
  51. ;;
  52. "Ubuntu")
  53. echo "Ubuntu System"
  54. $command apt-get install -y gcc g++ make openssl supervisor libgmp-dev libmpfr-dev libmpc-dev libaio1 libaio-dev numactl autoconf automake libtool libffi-dev libssl-dev liblz4-1 liblz4-dev liblz4-tool zlib1g zlib1g-dev
  55. cd /usr/lib/x86_64-linux-gnu
  56. ln_lib "ssl"
  57. ln_lib "crypto"
  58. ;;
  59. *)
  60. echo "Not support this system."
  61. exit -1
  62. ;;
  63. esac