2013年6月19日水曜日

CentOS 5.x に Python 2.6 をインストールする

CentOS 5.x の Python のバージョンは、2.4.3 であるため、Django 1.4 以降は動作しない。
そこで、EPELリポジトリより、Python 2.6 をインストールする。
wget http://ftp.riken.jp/Linux/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5-4.noarch.rpm
拡張リポジトリであるEPELリポジトリを通常使用しないように、設定します。
vim /etc/yum.repos.d/epel.repo

[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=0  # enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
yum installコマンドを発行し、Python2.6 をインストールするが、その際、--enablerepo=epelオプションを付与する。
yum install python26 --enablerepo=epel
インストールされているPythonのバージョンを確認する。
python -V

Python 2.4.3

python26 -V

Python 2.6.8
python26 の場合は、Python 2.6、python とした場合は、Python 2.4 を使用することができる。

0 件のコメント:

コメントを投稿