openssl.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://blog.linuxeye.cn
  4. #
  5. # Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/lj2007331/oneinstack
  10. Install_openSSL102() {
  11. if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then
  12. # install openssl-1.0.2
  13. pushd ${oneinstack_dir}/src > /dev/null
  14. tar xzf openssl-${openssl_ver}.tar.gz
  15. pushd openssl-${openssl_ver}
  16. make clean
  17. ./config --prefix=${openssl_install_dir} -fPIC shared zlib-dynamic
  18. make -j ${THREAD} && make install
  19. [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${openssl_install_dir}/bin:\$PATH" >> /etc/profile
  20. [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${openssl_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${openssl_install_dir}/bin:\1@" /etc/profile
  21. . /etc/profile
  22. popd
  23. if [ -f "${openssl_install_dir}/lib/libcrypto.a" ]; then
  24. echo "${CSUCCESS}openssl-1.0.2 module installed successfully! ${CEND}"
  25. /bin/cp cacert.pem ${openssl_install_dir}/ssl/cert.pem
  26. echo "${openssl_install_dir}/lib" > /etc/ld.so.conf.d/openssl.conf
  27. ldconfig
  28. rm -rf openssl-${openssl_ver}
  29. else
  30. echo "${CFAILURE}openssl-1.0.2 install failed, Please contact the author! ${CEND}"
  31. kill -9 $$
  32. fi
  33. popd
  34. fi
  35. }