본문 바로가기

Operating Systems/Linux

[ Linux ] PYTHON 설치

Python Source Release → Stable Releases → Python X.X.X → Gzipped Source tarball

[ PYTHON 설치 서버 ]

yum install gcc glibc glibc-common gd gd-devel -y

yum -y install make

mkdir -p /app/install

wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz -O /app/install/Python3.9.6.tgz

mkdir -p /app/temp/python/3.9.6

tar xvfz /app/install/Python3.9.6.tgz -C /app/temp/python/3.9.6 --strip-components=1

cd /app/temp/python/3.9.6

mkdir -p /app/dkit/python/3.9.6

./configure --prefix=/app/dkit/python/3.9.6

make

make install

cd /

/app/dkit/python/3.9.6/bin/python3 --version

rm -rf "/app/temp/python/3.9.6"

python --version

ls -ld /usr/bin/python

ln -Tfs /app/dkit/python/3.9.6/bin/python3 /usr/bin/python3

ln -Tfs /usr/bin/python3 /usr/bin/python

python --version

# yum이 python2를 사용하여 에러가 나는것을 확인
yum -y install vsftpd

mkdir -p /app/script

cat <<ADD_PYTHON_SCRIPT > /app/script/chvpython.sh && chmod 755 /app/script/chvpython.sh
#!/bin/bash

if [ -n "\$1" ]
then
$(printf '\t')PYTHON_VERSION=\$1
else
$(printf '\t')echo "Input Change Python Version(2 or 3)" : 
$(printf '\t')read PYTHON_VERSION
fi

if [ "\${PYTHON_VERSION}" == "2" ]
then
$(printf '\t')ln -Tfs /usr/bin/python2 /usr/bin/python
elif [ "\${PYTHON_VERSION}" == "3" ]
then
$(printf '\t')ln -Tfs /usr/bin/python3 /usr/bin/python
else
$(printf '\t')echo "Input Vaild Python Version(2 or 3)"
fi

python --version
ADD_PYTHON_SCRIPT

/app/script/chvpython.sh 3

python --version

yum -y install vsftpd

/app/script/chvpython.sh 2

python --version

yum -y install vsftpd

'Operating Systems > Linux' 카테고리의 다른 글

[ Linux ] PHP 설치  (0) 2021.08.06
[ Linux ] WORDPRESS 설치  (0) 2021.08.06
[ Linux ] APACHE ↔ TOMCAT 연동  (0) 2021.08.01
[ Linux ] TOMCAT 서버 설치  (0) 2021.08.01
[ Linux ] SSH 서버 설치  (0) 2021.07.31