jemalloc.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. Install_Jemalloc() {
  11. if [ ! -e "/usr/local/lib/libjemalloc.so" ]; then
  12. pushd ${oneinstack_dir}/src > /dev/null
  13. tar xjf jemalloc-${jemalloc_ver}.tar.bz2
  14. pushd jemalloc-${jemalloc_ver} > /dev/null
  15. ./configure
  16. make -j ${THREAD} && make install
  17. popd > /dev/null
  18. if [ -f "/usr/local/lib/libjemalloc.so" ]; then
  19. if [ "${Family}" == 'rhel' ]; then
  20. ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1
  21. else
  22. ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.1
  23. fi
  24. [ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
  25. ldconfig
  26. echo "${CSUCCESS}jemalloc module installed successfully! ${CEND}"
  27. rm -rf jemalloc-${jemalloc_ver}
  28. else
  29. echo "${CFAILURE}jemalloc install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
  30. kill -9 $$; exit 1;
  31. fi
  32. popd > /dev/null
  33. fi
  34. }