ติดตั้ง Python 3 บน CentOS 7

เราจะมาดูวิธีเริ่มต้นและใช้งาน Python 3 บนเซิร์ฟเวอร์ CentOS 7 โดยเฉพาะอย่างยิ่ง เราจะมาดูวิธีการติดตั้ง Python 3 ผ่านตัวจัดการแพ็คเกจ CentOS 7 Yum รวมถึงการติดตั้งแบบ Source file

Yum Installation

$ yum update -y
$ yum install -y python3
$ python3

Python 3.6.8 (default, Aug  7 2019, 17:28:10) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 


Source Installation

$ yum install gcc openssl-devel bzip2-devel libffi-devel -y
$ curl -O https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
$ tar -xzf Python-3.8.1.tgz
$ cd Python-3.8.1/
$ ./configure --enable-optimizations
$ make altinstall
$ python3.8

Python 3.8.1 (default, Dec 27 2019, 17:12:30)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
0
614