Debian 10 OpenSSL 최신버전 빌드

(Last Updated On: December 27, 2020)

debian 10 에서 openssl 최신버전 빌드. zlib.
apt install build-essential

1 소스 파일 다운로드 및 압축해제

https://www.openssl.org/source/ 이 링크를 통해 최신버전을 받을 수 있다.
2020년 12월 11일 기준 : openssl-1.1.1i.tar.gz

mkdir -p /opt/openssl
wget -qO- https://www.openssl.org/source/openssl-1.1.1i.tar.gz | tar xvz --strip 1 -C /opt/openssl
cd /opt/openssl

2 빌드

./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
make -j$(nproc) && make install

zlib.h: No such file or directory

crypto/comp/c_zlib.c:35:11: fatal error: zlib.h: No such file or directory
 # include <zlib.h>
           ^~~~~~~~
Repository pre-built 설치
 apt install zlib1g-dev

3 공유 라이브러리 등록

cat > /etc/ld.so.conf.d/openssl.conf <<< "/usr/local/ssl/lib" && \
ldconfig -v

4 Symbolic Link

ln -sf /usr/local/ssl/bin/openssl /usr/bin/openssl

5 Bash Profile

cat > /etc/profile.d/openssl.sh << _KERUS_
export OPENSSL_PATH="/usr/local/ssl/bin"
export OPENSSL_ROOT_DIR="/usr/local/ssl"
export OPENSSL_LIBRARIES="/usr/local/ssl/lib"
export OPENSSL_INCLUDE_DIR="/usr/local/ssl/include"
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
export SSL_CERT_DIR=/etc/ssl/certs
PATH=$PATH:$OPENSSL_PATH
_KERUS_
chmod 755 /etc/profile.d/openssl.sh