Python 2.7.13 をインストール

2017年4月5日(約7年前)の記事となっております。色々ご注意ください。

今回は、GitLab のデータベースをMySQL から PostgreSQL に変換するためにインストールします。

関連記事
GitLab 9.0.2 ソースインストール版からGitLab CE Omnibusに移行

環境

rpm -qa | grep centos-release
centos-release-6-8.el6.centos.12.3.x86_64

インストール

mkdir /usr/local/src/php-$PHP_VERSION-mysqlc-$MYSQL_TITLE

PYTHON_VERSION=2.7.13

cd /usr/local/src

ls -la

mkdir python-$PYTHON_VERSION

cd python-$PYTHON_VERSION

curl -O https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz

ls -la

tar xzf Python-$PYTHON_VERSION.tgz

cd Python-$PYTHON_VERSION

./configure \
--prefix=/usr/local/lib/python-$PYTHON_VERSION \
--program-suffix=-$PYTHON_VERSION \
--with-config-file-path=/usr/local/lib/python-$PYTHON_VERSION

make && make altinstall

パスを通す

echo 'PATH=$PATH:'"/usr/local/lib/python-$PYTHON_VERSION"/bin >> /etc/profile.d/python.sh
echo "export PATH" >> /etc/profile.d/python.sh
cat /etc/profile.d/python.sh

反映させる

source /etc/profile.d/python.sh

確認

python-2.7 -V