openssl.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. Install_openSSL102() {
  11. if [ -e "${openssl_install_dir}/lib/libssl.a" ]; then
  12. echo "${CWARNING}openSSL already installed! ${CEND}"
  13. else
  14. pushd ${oneinstack_dir}/src > /dev/null
  15. tar xzf openssl-${openssl_ver}.tar.gz
  16. pushd openssl-${openssl_ver} > /dev/null
  17. make clean
  18. ./config -Wl,-rpath=${openssl_install_dir}/lib -fPIC --prefix=${openssl_install_dir} --openssldir=${openssl_install_dir}
  19. make depend
  20. make -j ${THREAD} && make install
  21. popd > /dev/null
  22. if [ -f "${openssl_install_dir}/lib/libcrypto.a" ]; then
  23. echo "${CSUCCESS}openssl installed successfully! ${CEND}"
  24. /bin/cp cacert.pem ${openssl_install_dir}/cert.pem
  25. rm -rf openssl-${openssl_ver}
  26. else
  27. echo "${CFAILURE}openSSL install failed, Please contact the author! ${CEND}" && lsb_release -a
  28. kill -9 $$
  29. fi
  30. popd > /dev/null
  31. fi
  32. }
  33. Install_openSSL() {
  34. if [ -e "${openssl_install_dir}/lib/libssl.a" ]; then
  35. echo "${CWARNING}openSSL already installed! ${CEND}"
  36. else
  37. pushd ${oneinstack_dir}/src > /dev/null
  38. tar xzf openssl-${openssl11_ver}.tar.gz
  39. pushd openssl-${openssl11_ver} > /dev/null
  40. make clean
  41. ./config -Wl,-rpath=${openssl_install_dir}/lib -fPIC --prefix=${openssl_install_dir} --openssldir=${openssl_install_dir}
  42. make depend
  43. make -j ${THREAD} && make install
  44. popd > /dev/null
  45. if [ -f "${openssl_install_dir}/lib/libcrypto.a" ]; then
  46. echo "${CSUCCESS}openssl installed successfully! ${CEND}"
  47. /bin/cp cacert.pem ${openssl_install_dir}/cert.pem
  48. rm -rf openssl-${openssl11_ver}
  49. else
  50. echo "${CFAILURE}openSSL install failed, Please contact the author! ${CEND}" && lsb_release -a
  51. kill -9 $$
  52. fi
  53. popd > /dev/null
  54. fi
  55. }