nginx安装

1.首先下载nginx的网络源

[root@localhost ~]# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
Retrieving http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
warning: /var/tmp/rpm-tmp.JkMpgZ: Header V4 RSA/SHA1 Signature, key ID7bd9bf62: NOKEY
Preparing...################################# [100%]

Updating / installing...

1:nginx-release-centos-7-0.el7.ngx #################################[100%]

2.使用yum安装nginx

[root@localhost ~]# yum install nginx
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
code | 2.9 kB 00:00
docker-ce-stable | 3.5 kB 00:00
google-chrome | 1.3 kB 00:00
nginx | 2.9 kB 00:00
file:///mnt/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/repodata/repomd.xml"
Trying other mirror.
(1/4): google-chrome/primary | 1.7 kB 00:00
(2/4): docker-ce-stable/x86_64/primary_db | 28 kB 00:00
(3/4): code/primary_db | 89 kB 00:00
(4/4): nginx/x86_64/primary_db | 46 kB 00:02
google-chrome 3/3
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.16.0-1.el7.ngx will be installed
--> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.2)(64bit) for package: 1:nginx-1.16.0-1.el7.ngx.x86_64
--> Finished Dependency Resolution
Error: Package: 1:nginx-1.16.0-1.el7.ngx.x86_64 (nginx)
Requires: libcrypto.so.10(OPENSSL_1.0.2)(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

3.此时我们看到如下报错,说缺少libcrypto.so.10这个包

Error: Package: 1:nginx-1.16.0-1.el7.ngx.x86_64 (nginx)

Requires: libcrypto.so.10(OPENSSL_1.0.2)(64bit)

4.但经过查询,其实是有这个包的

[root@localhost ~]# find / -name libcrypto.so.10
find: ‘/run/user/1000/gvfs’: Permission denied
/usr/lib64/libcrypto.so.10 ##是有这个东西
[root@localhost ~]# openssl version ##查看openssl版本
OpenSSL 1.0.2o 27 Mar 2018
[root@localhost ~]# rpm -q --provides openssl
openssl = 1:1.0.1e-60.el7
openssl(x86-64) = 1:1.0.1e-60.el7

5.查看当前库文件中的 libcrypto.so.10

[root@localhost ~]# rpm -q --provides openssl-libs | grep libcrypto.so.10
libcrypto.so.10()(64bit)
libcrypto.so.10(OPENSSL_1.0.1)(64bit)
libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit)##libcrypto.so.10(OPENSSL_1.0.2)(64bit)
libcrypto.so.10(libcrypto.so.10)(64bit)

6.把升级OpenSSL 1.0.1到OpenSSL 1.0.2

http://rpmfind.net/linux/rpm2html/search.php?query=libcrypto.so.10(OPENSSL_1.0.2)(64bit)&submit=Search+…&system=&arch=

在右下角找到并下载

| CentOS 7.7.1908 for x86_64 | openssl-libs-1.0.2k-19.el7.x86_64.rpm |

上传到服务器后,使用rpm进行升级,为了防止和已经有的版本冲突,强制安装(--force)

[root@ /home/kiosk/repod]# rpm -ivh openssl-libs-1.0.2k-16.el7.x86_64.rpm --force
warning: openssl-libs-1.0.2k-16.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:openssl-libs-1:1.0.2k-16.el7 ################################# [100%]

现在用yum安装nginx,发现已经可以正常安装了




posted @ 2020-10-22 11:09  Andy.gbhu  阅读(1581)  评论(0编辑  收藏  举报