【OpenSSL】- Ubuntu22.04手动编译安装openssl

文章目录

下载代码

shell 复制代码
git clone https://github.com/openssl/openssl.git
git checkout -b openssl-3.5.4 #这里需要指定自己想要安装的版本

卸载Ubuntu自带的openssl

一定要先下载代码再卸载默认的openssl。否则git将无法进行安全验证导致下载代码失败。

查看默认的opessl版本

shell 复制代码
openssl version -a

ubuntu22.04默认安装的是3.0.2版本

卸载默认的openssl

shell 复制代码
sudo apt remove --purge openssl
sudo apt autoremove

编译openssl

https://github.com/openssl/openssl/blob/master/NOTES-UNIX.md

shell 复制代码
./Configure --prefix=/usr/lib/ssl/ --openssldir=/usr/lib/ssl/ '-Wl,-rpath,$(LIBRPATH)' #这里注意选择自己想要的安装目录
make -j8 #8为并行编译的线程数,由于我的虚拟机是8核心,因此启动8个线程编译
sudo make install #由于我指定的安装目录需要root权限,如果是普通目录可以省略sudo直接运行"make install"

验证安装

创建软连接

由于openssl默认安装路径为"/usr/lib/ssl/bin/openssl",因此需要在"/usr/bin"下建立一个软连接。否则直接执行"openssl",系统将找不到它。

shell 复制代码
sudo ln -s /usr/lib/ssl/bin/openssl /usr/bin/openssl

再执行openssl version -a查看结果,版本已经更新为3.5.4

恢复git功能

编译完openssl后,git clone代码会失败。

这是因为我们在卸载默认openssl时将ca-certificate一起卸载了。因此重新安装即可。

shell 复制代码
sudo apt install -y ca-certificates
sudo update-ca-certificates --fresh
相关推荐
Lsetea3 天前
CDN换了SSL证书仍显示旧证书?按边缘节点、SNI和缓存逐层排查
https·cdn·ssl证书·openssl·tls
Lsetea5 天前
Nginx HTTPS证书域名不匹配:用SAN与SNI定位 ERR_CERT_COMMON_NAME_INVALID
nginx·https·ssl证书·openssl·tls
bosins9 天前
Windows IIS 配置本地HTTPS 全流程指南:自签名证书 + 端口绑定 + 避坑详解
powershell·openssl
Lsetea12 天前
Nginx报SSL_CTX_use_PrivateKey failed:证书与私钥不匹配怎么排查
nginx·https·ssl证书·openssl·私钥
Lsetea15 天前
SSL证书快过期怎么自动检查:用OpenSSL checkend做7天预警与线上证书验收
https·ssl证书·openssl·systemd·证书监控
蜡台1 个月前
本机 局域网 搭建本地 HTTPS 域名完整方案
网络协议·http·https·openssl
qetfw1 个月前
Debian OpenSSL CA 证书配置参考:根证书、服务证书与验证
linux·debian·ssl·openssl
qetfw1 个月前
Debian OpenSSL 搭建 CA 证书服务:签发、吊销与客户端信任
linux·debian·openssl·ca
smaller_maple3 个月前
T113开启openssh
openssl·openssh·t113开启ssh
dling86 个月前
OpenSSL和keytool的区别?如何使用?
openssl·keytool