{"id":13356,"date":"2023-05-10T18:52:01","date_gmt":"2023-05-10T10:52:01","guid":{"rendered":"https:\/\/blog.ywdevops.cn\/?p=13356"},"modified":"2026-01-29T16:04:18","modified_gmt":"2026-01-29T08:04:18","slug":"openssl","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2023\/05\/10\/openssl\/","title":{"rendered":"linux\u5347\u7ea7OpenSSL"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u672c\u4f8b\u5b50\u4e2d\u5c06OpenSSL 1.0.2k\u5347\u7ea7\u5230OpenSSL 1.1.1t<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u9996\u5148\u67e5\u770bopenssl\u7684\u7248\u672c\u4ee5\u53ca\u76ee\u5f55\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl version -a<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"244\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/3-3.png\" alt=\"\" class=\"wp-image-13360\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/3-3.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/3-3-300x103.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/3-3-600x207.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\/etc\/pki\/tls\u76ee\u5f55\u4e0b\u5c31\u662fopenssl\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4e0d\u8fc7\u6b64\u5904\u5347\u7ea7\u7528\u4e0d\u4e0a\u6b64\u76ee\u5f55<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5c06openssl-1.1.1t.tar.gz\u6587\u4ef6\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u5e76\u89e3\u538b\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rz -y openssl-1.1.1t.tar.gz\ntar xf openssl-1.1.1t.tar.gz<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u8fdb\u5165\u89e3\u538b\u76ee\u5f55\u4e0b\uff0c\u6267\u884c\u547d\u4ee4\u7f16\u8bd1\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd openssl-1.1.1t\nyum -y install gcc*       #\u5b89\u88c5\u4f9d\u8d56\n#prefix\u6267\u884c\u53ef\u6267\u884c\u6587\u4ef6\u5b89\u88c5\u8def\u5f84\n.\/config --prefix=\/opt\/openssl --openssldir=\/usr\/local\/openssl\n#\u7f16\u8bd1\u548c\u5b89\u88c5\nmake &amp;&amp; make install<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u5907\u4efd\u539f\u6765\u7684openssl\u6587\u4ef6\uff0c\u53ef\u901a\u8fc7whereis openssl\u67e5\u8be2\u4f4d\u7f6e\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv \/usr\/bin\/openssl \/usr\/bin\/openssl.old\nmv \/usr\/include\/openssl \/usr\/include\/openssl.old<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u7528\u65b0\u7684\u6587\u4ef6\u66ff\u6362\u65e7\u7684\u6587\u4ef6\uff0c\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -sf \/opt\/openssl\/bin\/openssl   \/usr\/bin\/openssl\nln -s \/opt\/openssl\/include\/openssl \/usr\/include\/openssl<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">6\u3001\u6267\u884c\u547d\u4ee4\u67e5\u770bopenssl\u7248\u672c\uff0c\u62a5\u9519\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u62a5\u9519\uff1aopenssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory  \u7f3a\u5c11\u4f9d\u8d56\u5e93\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u89e3\u51b3\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/opt\/openssl\/lib\/libcrypto.so.1.1 \/usr\/lib64\/libcrypto.so.1.1\nln -s \/opt\/openssl\/lib\/libssl.so.1.1 \/usr\/lib64\/libssl.so.1.1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">7\u3001\u67e5\u770bopenssl\u94fe\u63a5\u5e93\u4f4d\u7f6e\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ldconfig -p | grep ssl<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"131\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/4-3.png\" alt=\"\" class=\"wp-image-13369\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/4-3.png 705w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/4-3-300x56.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/4-3-600x111.png 600w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">8\u3001\u5c06\u65b0\u7684\u5e93\u6587\u4ef6\u6dfb\u52a0\u5230so\u5e93\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u66f4\u65b0\u52a8\u6001\u94fe\u63a5\u5e93\u6570\u636e\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"\/lib64\" &gt;&gt; \/etc\/ld.so.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">9\u3001\u518d\u6b21\u67e5\u770bopenssl\u7248\u672c\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"85\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/5-2.png\" alt=\"\" class=\"wp-image-13371\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/5-2.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/5-2-300x36.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/05\/5-2-600x72.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u81f3\u6b64\uff0c\u5347\u7ea7\u5b8c\u6210\uff01\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u751f\u6210\u81ea\u7b7e\u540d\u8bc1\u4e66\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout \/tmp\/server.key -out \/tmp\/server.crt -subj \"\/C=CN\/ST=Beijing\/L=Beijing\/O=MyCompany\/CN=www.registry.com\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bf4\u660e\uff1a\u8bc1\u4e66\u6709\u6548\u671f\u4e3a10\u5e74\uff0c\u751f\u6210\u4f4d\u7f6e\u5728\/tmp\u4e0b\uff0c\u6307\u5b9a\u57df\u540d\u4e3awww.registry.com\uff0c\u5c06\u6b64\u8bc1\u4e66\u914d\u7f6e\u5230nginx\u4e2d\u5373\u53ef\uff0c\u81ea\u7b7e\u540d\u8bc1\u4e66\u6d4f\u89c8\u5668\u4e0d\u8ba4\uff0c\u53ef\u7528\u4e8e\u5185\u90e8\u7528\uff0c\u6bd4\u5982docker registry\u4ed3\u5e93<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u4f8b\u5b50\u4e2d\u5c06OpenSSL 1.0.2k\u5347\u7ea7\u5230OpenSSL 1.1.1t 1\u3001\u9996\u5148\u67e5\u770bopenssl\u7684\u7248\u672c\u4ee5\u53ca [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":13358,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-13356","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/13356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=13356"}],"version-history":[{"count":12,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/13356\/revisions"}],"predecessor-version":[{"id":19576,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/13356\/revisions\/19576"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/13358"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=13356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=13356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=13356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}