Oracle Linux 7.X에 Python 3.6 설치 방법

Oracle Linux 7.X를 설치하면 Python 2.7이 기본 설치됩니다. Python3.6 버전을 설치하는 방법은 다음과 같습니다.

EPEL 설치 & 확인

Oracle은 Oracle EPEL(Extra Packages for Enterprise Linux) yum 레파지토리를 운영합니다. 이 yum 레파지토리 Oracle Linux 서버에 python3.6 패키지가 포함되어 있습니다.1 Oracle EPEL 레파지토리의 설치 여부를 다음 명령을 통해서 확인할 수 있습니다.

다음 명령을 통해서 Oracle EPEL(Extra Packages for Enterprise Linux) yum 레파지토리 서버에 등록할 수 있습니다.

sudo yum install -y oracle-epel-release-el7

위 명령을 실행하면 다음과 같이 실행됩니다.

[opc@oel76-inst ~]$ sudo yum install -y oracle-epel-release-el7
Loaded plugins: ulninfo
ol7_UEKR5 | 2.5 kB 00:00:00
ol7_latest | 2.7 kB 00:00:00
(1/5): ol7_UEKR5/x86_64/updateinfo | 33 kB 00:00:00
(2/5): ol7_latest/x86_64/group | 810 kB 00:00:00
(3/5): ol7_latest/x86_64/updateinfo | 918 kB 00:00:00
(4/5): ol7_UEKR5/x86_64/primary_db | 3.9 MB 00:00:01
(5/5): ol7_latest/x86_64/primary_db | 16 MB 00:00:02
Resolving Dependencies
--> Running transaction check
---> Package oracle-epel-release-el7.x86_64 0:1.0-2.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
====================================================
Package Arch Version Repository Size
====================================================
Installing:
oracle-epel-release-el7 x86_64 1.0-2.el7 ol7_latest 14 k
 
Transaction Summary
====================================================
Install 1 Package
 
Total download size: 14 k
Installed size: 18 k
Downloading packages:
oracle-epel-release-el7-1.0-2.el7.x86_64.rpm | 14 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : oracle-epel-release-el7-1.0-2.el7.x86_64 1/1
Verifying : oracle-epel-release-el7-1.0-2.el7.x86_64 1/1
 
Installed:
oracle-epel-release-el7.x86_64 0:1.0-2.el7
 
Complete!
[opc@oel76-inst ~]$

오라클 클라우드에서 제공하는 Oracle Linux 7.X VM에서는 Oracle EPEL(Extra Packages for Enterprise Linux)이 기본 등록되어 있습니다. “oracle-epel-release-el7” 설치 여부는 다음 명령으로 확인 할 수 있습니다.

[opc@oel76-inst ~]$ yum provides 'oracle-epel-release*'
Failed to set locale, defaulting to C
Loaded plugins: langpacks, ulninfo
oracle-epel-release-el7-1.0-1.el7.x86_64 : Extra Packages for Enterprise Linux (EPEL) yum repository configuration
Repo        : ol7_latest
Matched from:
Other       : oracle-epel-release-el7(x86-64) = 1.0-1.el7
Other       : oracle-epel-release-el7 = 1.0-1.el7



oracle-epel-release-el7-1.0-2.el7.x86_64 : Extra Packages for Enterprise Linux (EPEL) yum repository configuration
Repo        : ol7_latest
Matched from:
Other       : oracle-epel-release-el7 = 1.0-2.el7
Other       : oracle-epel-release-el7(x86-64) = 1.0-2.el7



oracle-epel-release-el7-1.0-2.el7.x86_64 : Extra Packages for Enterprise Linux (EPEL) yum repository configuration
Repo        : @ol7_latest
Matched from:
Provides    : oracle-epel-release-el7(x86-64) = 1.0-2.el7

[opc@oel76-inst ~]$

Python3.6 설치

오라클 리눅스 7.X에서 파이썬3.6을 설치 명령은 다음과 같습니다.

sudo yum install -y python36

위 명령을 실행하면 다음과 같이 실행됩니다.

[opc@oel76-inst ~]$ sudo yum install -y python36
Failed to set locale, defaulting to C
Loaded plugins: langpacks, ulninfo
Package python36 is obsoleted by python3, trying to install python3-3.6.8-10.0.1.el7.x86_64 instead
Resolving Dependencies
--> Running transaction check
---> Package python3.x86_64 0:3.6.8-10.0.1.el7 will be installed
--> Processing Dependency: python3-libs(x86-64) = 3.6.8-10.0.1.el7 for package: python3-3.6.8-10.0.1.el7.x86_64
--> Processing Dependency: python3-setuptools for package: python3-3.6.8-10.0.1.el7.x86_64
--> Processing Dependency: python3-pip for package: python3-3.6.8-10.0.1.el7.x86_64
--> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python3-3.6.8-10.0.1.el7.x86_64
--> Running transaction check
---> Package python3-libs.x86_64 0:3.6.8-10.0.1.el7 will be installed
---> Package python3-pip.noarch 0:9.0.3-5.el7 will be installed
---> Package python3-setuptools.noarch 0:39.2.0-10.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================
 Package                                        Arch                               Version                                      Repository                              Size
===========================================================================================
Installing:
 python3                                        x86_64                             3.6.8-10.0.1.el7                             ol7_latest                              69 k
Installing for dependencies:
 python3-libs                                   x86_64                             3.6.8-10.0.1.el7                             ol7_latest                             7.0 M
 python3-pip                                    noarch                             9.0.3-5.el7                                  ol7_latest                             1.8 M
 python3-setuptools                             noarch                             39.2.0-10.el7                                ol7_latest                             628 k

Transaction Summary
========================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 9.4 M
Installed size: 48 M
Downloading packages:
(1/4): python3-3.6.8-10.0.1.el7.x86_64.rpm                                                                                                            |  69 kB  00:00:00
(2/4): python3-pip-9.0.3-5.el7.noarch.rpm                                                                                                             | 1.8 MB  00:00:00
(3/4): python3-setuptools-39.2.0-10.el7.noarch.rpm                                                                                                    | 628 kB  00:00:00
(4/4): python3-libs-3.6.8-10.0.1.el7.x86_64.rpm                                                                                                       | 7.0 MB  00:00:00
---------------------------------------------------------------------------------------
Total                                                                                                                                         59 MB/s | 9.4 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python3-pip-9.0.3-5.el7.noarch                                                                                                                            1/4
  Installing : python3-setuptools-39.2.0-10.el7.noarch                                                                                                                   2/4
  Installing : python3-3.6.8-10.0.1.el7.x86_64                                                                                                                           3/4
  Installing : python3-libs-3.6.8-10.0.1.el7.x86_64                                                                                                                      4/4
  Verifying  : python3-libs-3.6.8-10.0.1.el7.x86_64                                                                                                                      1/4
  Verifying  : python3-pip-9.0.3-5.el7.noarch                                                                                                                            2/4
  Verifying  : python3-setuptools-39.2.0-10.el7.noarch                                                                                                                   3/4
  Verifying  : python3-3.6.8-10.0.1.el7.x86_64                                                                                                                           4/4

Installed:
  python3.x86_64 0:3.6.8-10.0.1.el7

Dependency Installed:
  python3-libs.x86_64 0:3.6.8-10.0.1.el7                    python3-pip.noarch 0:9.0.3-5.el7                    python3-setuptools.noarch 0:39.2.0-10.el7

Complete!
[opc@oel76-inst ~]$

Python3.6 최신 pip 설치

Python 버전과 pip는 별개 프로젝트이며 개발 주기가 다룹니다. 현재 Python 버전에서 최신 pip를 설치하는 명령은 다음과 같습니다.

sudo python3.6 -m ensurepip --default-pip

위 명령을 실행하면 다음과 같이 실행됩니다.

[opc@oel76-inst ~]$ sudo python3.6 -m pip --version
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
[opc@oel76-inst ~]$ sudo python3.6 -m ensurepip --default-pip
WARNING: Running pip install with root privileges is generally not a good idea. Try `__main__.py install --user` instead.
Requirement already satisfied: setuptools in /usr/lib/python3.6/site-packages
Requirement already satisfied: pip in /usr/lib/python3.6/site-packages
[opc@oel76-inst ~]$ sudo python3.6 -m pip --version
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
[opc@oel76-inst ~]$

위 환경에서는 이미 최신 버전이 설치된 상태기 때문에, 별도 설치가 진행되지 않았습니다.

명령 정리

  • Oracle Linux 7 EPEL 레파티토리 등록
sudo yum install -y oracle-epel-release-el7
  • Python3.6 설치
sudo yum install -y python36
  • 최신 pip 설치
sudo python3.6 -m ensurepip --default-pip

참고 문서


  1. Oracle EPEL(Extra Packages for Enterprise Linux) yum 레파지토리에서 제공하는 패키지는 다음 URL에서 확인할 수 있습니다. Oracle Linux 7 (x86_64) EPEL 패키지 목록[↗NW] [return]