>  기사  >  백엔드 개발  >  Mac과 함께 제공되는 openssl을 업그레이드하는 방법은 무엇입니까? (프로세스 요약)

Mac과 함께 제공되는 openssl을 업그레이드하는 방법은 무엇입니까? (프로세스 요약)

不言
不言원래의
2018-09-07 14:41:393227검색

Mac과 함께 제공되는 openssl을 어떻게 업그레이드하나요? 다음 글에서는 Mac과 함께 제공되는 openssl의 업그레이드 과정을 소개합니다. 필요한 경우 참고할 수 있습니다.

Mac에 기본 제공되는 openssl이 너무 오래되었기 때문에 여기서 Python 확장 패키지를 설치하려면 상위 버전으로 업그레이드해야 하므로 업그레이드 과정을 요약해 보겠습니다. openssl 太老了,所以,这里因为安装python扩展包需要升级到高版本,所以,总结下升级过程。

一、安装openssl

首先,来看看我们的openssl 的版本和目录:

->  ~ openssl version
OpenSSL 0.9.8zh 14 Jan 2016

->  ~ which openssl
/usr/bin/openssl
->  ~

通过上面的查看,明显我们的版本号太低了。

按照上面的步骤,我们首先更新homebrew

brew update

安装:

brew install openssl

# 重新安装
# brew reinstall openssl

安装成功后:

~ brew reinstall openssl
==> Reinstalling openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2p.el_capitan.bottle.tar.gz
Already downloaded: /Users/kaiyiwang/Library/Caches/Homebrew/downloads/96bc2acd84d0fe609dcbe4c6436c864808f7e8f26f2f12111f552f5972c3840a--openssl-1.0.2p.el_capitan.bottle.tar.gz
==> Pouring openssl-1.0.2p.el_capitan.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

==> Summary
  /usr/local/Cellar/openssl/1.0.2p: 1,793 files, 12.2MB

说明我们成功的将openssl安装到/usr/local/Cellar/openssl/1.0.2p

二、更换旧的

不过,我们还有最后一步,那就是当我们使用openssl时,使用的是我们用homebrew新下载的openssl。为了达到这个目的,我们有两种方法。

将homebrew下载的openssl软链接/usr/bin/openssl目录下。这里,我们先将它保存一份老的,然后再软链接新下载的。

$ mv /usr/bin/openssl /usr/bin/openssl_old
mv: rename /usr/bin/openssl to /usr/bin/openssl_old: Operation not permitted
$ ln -s /usr/local/Cellar/openssl/1.0.2p/bin/openssl /usr/bin/openssl
ln: /usr/bin/openssl: Operation not permitted

Operation not permitted提示没有权限操作,对/usr/bin目录下的东西,我已经遇到过几次这个问题了,于是继续google,在stackoverflow上找到了Operation Not Permitted when on root El capitan (rootless disabled)

1. openssl 설치

먼저 openssl 버전과 디렉터리를 살펴보겠습니다.

$ csrutil disable
$ reboot
위의 검토를 통해 버전 번호가 너무 낮은 것이 분명합니다.

위 단계에 따라 먼저 homebrew를 업데이트합니다.

$ sudo mv /usr/bin/openssl /usr/bin/openssl_old
$ sudo ln -s /usr/local/Cellar/openssl/1.0.2p/bin/openssl /usr/bin/openssl
$ openssl version
OpenSSL 1.0.2p  14 Aug 2018

➜  ~ which openssl
/usr/local/opt/openssl/bin/openssl
설치: Mac과 함께 제공되는 openssl을 업그레이드하는 방법은 무엇입니까? (프로세스 요약)
csrutil enable
reboot
성공적인 설치 후: rrreee

openssl을 /usr/local/Cellar/에 성공적으로 설치했음을 나타냅니다. openssl/1.0.2p.

2. 기존 항목 교체

그러나 아직 마지막 단계가 남아 있습니다. 즉, openssl을 사용할 때 새로 다운로드한 openssl을 homebrew와 함께 사용합니다. 이 목표를 달성하기 위해 두 가지 방법이 있습니다.

homebrew에서 다운로드한 openssl 소프트 링크/usr/bin/openssl 디렉터리에 넣습니다. 여기에서는 먼저 이전 복사본을 저장한 다음 새로 다운로드한 복사본을 소프트 링크합니다. rrreeeOperation not allowed는 작동 권한이 없다는 메시지를 표시합니다. /usr/bin 디렉토리에 있는 항목에 대해 이 문제가 여러 번 발생했기 때문에 Google을 계속 검색하여 stackoverflow의 루트에 있을 때 Operation Not Permitted를 발견했습니다. . 엘 캐피탄(루트 없는 비활성화).

🎜시스템을 다시 시작하면 cmd+r을 동시에 눌러 복구 모드로 들어간 다음 유틸리티 => 터미널을 선택하고 터미널에 다음 명령을 입력하고 파일 시스템을 잠근 후 컴퓨터를 다시 시작합니다. cmd+r, 시스템 시작을 선택하기 위한 다른 인터페이스로 들어갑니다. 이 인터페이스에서 즉시 다시 시작하지 마십시오. 먼저 터미널을 찾아 터미널에 csrutil 비활성화를 입력합니다. 🎜rrreee🎜마지막으로 이전 두 명령을 실행하여 버전을 확인합니다. . 🎜rrreee🎜🎜🎜🎜🎜🎜이렇게 해서 openssl 업그레이드에 성공했습니다. 그러나 안전을 위해 컴퓨터를 다시 시작하고 csrutil을 다시 활성화했습니다. 🎜rrreee🎜관련 권장 사항: 🎜🎜🎜macos - Mac과 함께 제공되는 PHP의 주요 버전 업그레이드를 수행하는 방법은 무엇입니까? 🎜🎜

위 내용은 Mac과 함께 제공되는 openssl을 업그레이드하는 방법은 무엇입니까? (프로세스 요약)의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.