Ubuntu(WSL)卸载与安装指定版本的 openssl

卸载 openssl


1)查找并删除 openssl 关联的目录与文件

bash 复制代码
whereis openssl

which openssl

rm -rf /a/b/c/    // 使用 rm 命令删除所有 openssl 相关目录

2)删除软件安装包

bash 复制代码
apt-get purge openssl

3)删除配置文件

bash 复制代码
rm -rf /etc/ssl

安装 openssl


openssl 版本下载链接:/source/old/index.html (openssl.org)

1)解压

bash 复制代码
tar -zxvf openssl-1.0.2p.tar.gz

2)进入目录

bash 复制代码
cd openssl-1.0.2p

3)创建安装目录

bash 复制代码
mkdir /usr/local/openssl

4)选择安装目录(prefix 是安装目录),并使用 -fPIC 参数链接动态库

bash 复制代码
./config --prefix=/usr/local/openssl -fPIC

5)编译

bash 复制代码
make

6)安装

bash 复制代码
make install

7)查看版本

bash 复制代码
cd /usr/local/openssl/bin
./openssl version

把安装的 openssl 设置为全局(可选)


1)删除软链接(rm -rf ./软链接名称,若rm -rf ./软链接名称/ ,则会把软链接以及软链接指向下的内容删除)

bash 复制代码
正确:rm -rf /usr/bin/openssl
错误:rm -rf /usr/bin/openssl/

正确:rm -rf /usr/include/openssl
错误:rm -rf /usr/include/openssl/

2)创建软链接

bash 复制代码
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl

说明:/usr/bin/openssl、/usr/include/openssl 是 openssl 软件包的默认扫描路径,如果使用命令安装 openssl 会自动安装到该目录下(每个软件包都有一个系统默认路径);使用软链接的目的就是把自己的安装目录链接到系统路径,然后就可以在任意地方执行 openssl version 查看 openssl 版本,而无需进入到 /usr/local/openssl/bin 路径下查看版本。

3)查看 OpenSSL 版本,安装完成

bash 复制代码
openssl version

如果安装完成后遇到如下错误:

bash 复制代码
root@BZD25521:/etc/ld.so.conf.d# openssl version openssl: symbol lookup error: openssl: undefined symbol: EVP_mdc2, version OPENSSL_1_1_0

解决办法见:安装 openssl 时报错:openssl: symbol lookup error: openssl: undefined symbol: EVP_mdc2, version OPENSSL_1_-CSDN博客

相关推荐
wbs_scy18 小时前
Linux 动静态库完全指南:制作、使用、原理与实战
linux·运维·服务器
孙同学_18 小时前
【Linux篇】Socket编程TCP
linux·网络·tcp/ip
沃和莱特18 小时前
Copy as fetch + Skill:自动化问题记录分析的实践与思考
运维·ai·自动化·编程·skills
赛博云推-Twitter热门霸屏工具18 小时前
从手动运营到自动化增长:赛博云推让Twitter推广效率提升10倍
运维·自动化·twitter
Crazy CodeCrafter18 小时前
租金要交,但客流为零,要关店了?
大数据·运维·经验分享·自动化·开源软件
侯侯Hou18 小时前
Linux系统安装OpenClaw
linux
charlie11451419119 小时前
2026年IMX6ULL正点原子Alpha开发板学习方案——U-Boot完全移植概览:从官方源码到你的自制板,这条路有多远
linux·学习·嵌入式·uboot·嵌入式linux·工程实践·编程指南
高梦轩19 小时前
LNMP 环境部署笔记
linux·笔记
HAPPY酷19 小时前
Linux `shutdown` 命令速查:安全关机与重启
linux·chrome·安全
zhping101119 小时前
Linux 系统上使用 GitHub 加速工具
linux·运维·github