centOS7.9| 无root安装 openssl 1.1.1

0.先安装 gcc12

见之前的博客: 无root编译安装 gcc12

1.下载和编译 openssl 1.1.1

  • https://www.openssl.org/source/
  • https://github.com/openssl/openssl/releases?page=3 (2024.4.23)
$ cd ~/Downloads/
$ wget https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1u/openssl-1.1.1u.tar.gz #下载失败
Or
$ wget https://www.openssl.org/source/openssl-1.1.1u.tar.gz

$ tar -zxvf openssl-1.1.1u.tar.gz
$ cd openssl-1.1.1u/
$ ./config --prefix=/home/wangjl/.local/
	安装到独立文件夹不好,因为编译不好找到: $ rm -rf /home/wangjl/.local/lib/openssl-1.1.1u/
$ make -j16
$ make install

测试:

$ ~/.local/bin/openssl version
OpenSSL 1.1.1u  30 May 2023

配置

$ vim ~/.bashrc
#添加2行
export LD_LIBRARY_PATH=~/.local/lib/:$LD_LIBRARY_PATH
export PATH=$HOME/.local/bin:$PATH

测试2:

$ source ~/.bashrc
或者推出,重新登录系统。

$ which openssl
~/.local/bin/openssl
$ openssl version
OpenSSL 1.1.1u  30 May 2023

2. 让 pkg-config 能找到.pc文件

$ pkg-config --cflags openssl #返回空行,说明编译时还是找不到

查看.pc文件:新增了前三个

$ ls -lth ~/.local/lib/pkgconfig/
total 2.5K
-rw-r--r--. 1 wangjl jinlab 301 Apr 23 12:06 libcrypto.pc
-rw-r--r--. 1 wangjl jinlab 280 Apr 23 12:06 libssl.pc
-rw-r--r--. 1 wangjl jinlab 234 Apr 23 12:06 openssl.pc
-rw-r--r--. 1 wangjl jinlab 337 Feb  3 21:45 libevent.pc
-rw-r--r--. 1 wangjl jinlab 382 Feb  3 21:45 libevent_pthreads.pc 

配置环境变量 PKG_CONFIG_PATH

$ vim ~/.bashrc
添加一行,指定.pc文件的位置
export PKG_CONFIG_PATH=~/.local/lib/pkgconfig:$PKG_CONFIG_PATH

退出再次登录系统,测试:
$ pkg-config --cflags openssl
-I/home/wangjl/.local//include

$ pkg-config --libs openssl
-L/home/wangjl/.local//lib -lssl -lcrypto

能找到了,说明可以编译安装 python3.10 了。

相关推荐

  1. centOS7.9| root安装 openssl 1.1.1

    2024-04-27 22:50:03       29 阅读
  2. centos 编译安装 python 和 openssl

    2024-04-27 22:50:03       51 阅读
  3. Centos7安装python12+最新openssl

    2024-04-27 22:50:03       69 阅读
  4. root权限安装git-lfs(linux版)

    2024-04-27 22:50:03       54 阅读
  5. centos7.9安装openssl1.1.1

    2024-04-27 22:50:03       27 阅读
  6. centos系统编译opensslopenssl-lib的rpm安装

    2024-04-27 22:50:03       21 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-27 22:50:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-27 22:50:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-04-27 22:50:03       82 阅读
  4. Python语言-面向对象

    2024-04-27 22:50:03       91 阅读

热门阅读

  1. Python中的进制转换函数详解

    2024-04-27 22:50:03       35 阅读
  2. ReactNative0.74 版本发布重大更新

    2024-04-27 22:50:03       170 阅读
  3. Chapter 1-16. Introduction to Congestion in Storage Networks

    2024-04-27 22:50:03       34 阅读
  4. Android 监听耳机按键方式

    2024-04-27 22:50:03       41 阅读
  5. vue中组件 和 插件的区别

    2024-04-27 22:50:03       64 阅读
  6. 【ARMv9 DSU-120 系列 5 -- CHI Interface】

    2024-04-27 22:50:03       39 阅读
  7. 生日蜡烛(蓝桥杯)

    2024-04-27 22:50:03       30 阅读