2010-05-17

ubuntu 如何安裝 php 5.2.x 的版本

改用deb來安裝
cd /tmp mkdir php52 cd php52 wget -r -np -nH -nd -R index.html http://archives.dotdeb.org/dists/lenny/php5/5.2.17/binary-amd64/ wget -r -np -nH -nd -R index.html http://archives.dotdeb.org/dists/lenny/php5-pecl/5.2.17/binary-amd64/ wget http://archive.debian.org/debian/pool/main/m/mysql-dfsg-5.0/libmysqlclient15off_5.0.51a-24+lenny5_amd64.deb wget http://archive.debian.org/debian/pool/main/libt/libtool/libltdl3_1.5.22-4+etch1_amd64.deb curl -k https://gist.github.com/nvogel/2971772/raw/4e82f220f61a7a534d94a7114e180d3eb131747b/etc-apt-preferences.d-php5 > /etc/apt/preferences.d/php5 apt-get update
#先安裝
apt-get install curl apache2-mpm-prefork 
#相依套件 apt-get install libdb4.6 wget http://ftp.br.debian.org/debian/pool/main/k/krb5/libkrb53_1.8.3+dfsg-4squeeze6_all.deb dpkg -i libkrb53_1.8.3+dfsg-4squeeze6_all.deb apt-get install libreadline5 wget ftp://ftp.uwsg.indiana.edu/linux/ubuntu/pool/main/libt/libtool/libltdl3_1.5.26-1ubuntu1_amd64.deb dpkg -i libapache2-mod-php5_5.2.17-0.dotdeb.0_amd64.deb \ php5-mysql_5.2.17-0.dotdeb.0_amd64.deb \ php5-cli_5.2.17-0.dotdeb.0_amd64.deb \ php5_5.2.17-0.dotdeb.0_all.deb \ php5-curl_5.2.17-0.dotdeb.0_amd64.deb \ php5-common_5.2.17-0.dotdeb.0_amd64.deb \ libmysqlclient15off_5.0.51a-24+lenny5_amd64.deb # pear #dpkg -i php-pear_5.2.17-0.dotdeb.0_all.deb # suhosin #dpkg -i php5-suhosin_5.2.17-0.dotdeb.0_amd64.deb # cgi # dpkg -i php5-cgi_5.2.17-0.dotdeb.0_amd64.deb # ming # wget http://archive.debian.org/debian/pool/main/m/ming/libming0_0.3.0-14_amd64.deb # dpkg -i libming0_0.3.0-14_amd64.deb # dpkg -i php5-ming_5.2.17-0.dotdeb.0_amd64.deb # imap # apt-get install mlock # wget http://archive.debian.org/debian/pool/main/u/uw-imap/libc-client2007b_2007b~dfsg-4+lenny3_amd64.deb # dpkg -i "libc-client2007b_2007b~dfsg-4+lenny3_amd64.deb" # dpkg -i php5-imap_5.2.17-0.dotdeb.0_amd64.deb # imagick # wget http://archive.debian.org/debian-archive/debian/pool/main/g/graphviz/libgraphviz4_2.20.2-3_amd64.deb # wget http://archive.debian.org/debian-archive/debian/pool/main/i/imagemagick/libmagick10_6.3.7.9.dfsg2-1~lenny4_amd64.deb # dpkg -i libgraphviz4_2.20.2-3_amd64.deb libmagick10_6.3.7.9.dfsg2-1~lenny4_amd64.deb # dpkg -i "php5-imagick_5.2.17-0.dotdeb.0_amd64.deb" # ldap # dpkg -i php5-ldap_5.2.17-0.dotdeb.0_amd64.deb # snmp # dpkg -i php5-snmp_5.2.17-0.dotdeb.0_amd64.deb # spplus # dpkg -i php5-spplus_5.2.17-0.dotdeb.0_amd64.deb # xcache # dpkg -i php5-xcache_5.2.17-0.dotdeb.0_amd64.deb # mcrypt # apt-get install libmcrypt4 # dpkg -i libltdl3_1.5.26-1ubuntu1_amd64.deb # dpkg -i php5-mcrypt_5.2.17-0.dotdeb.0_amd64.deb # apc # dpkg -i php5-apc_5.2.17-0.dotdeb.0_amd64.deb # gd # apt-get install libt1-5 # dpkg -i php5-gd_5.2.17-0.dotdeb.0_amd64.deb # memcache # dpkg -i php5-memcache_5.2.17-0.dotdeb.0_amd64.deb # mhash # apt-get install libmhash2 # dpkg -i php5-mhash_5.2.17-0.dotdeb.0_amd64.deb # xsl # dpkg -i php5-xsl_5.2.17-0.dotdeb.0_amd64.deb apt-get -f install
參考來源:https://gist.github.com/nvogel/2971772#file-install-php5-2-squeeze-sh
底下是以前的舊資料,不一定能用

# remove all php packge
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
# use karmiс for php pakage
# pin-params: a (archive), c (components), v (version), o (origin) and l (label).
echo -e "Package: php5\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee /etc/apt/preferences.d/php > /dev/null
apt-cache search php5-|grep php5-|awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'|sudo tee -a /etc/apt/preferences.d/php > /dev/null
apt-cache search -n libapache2-mod-php5 |awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'| sudo tee -a /etc/apt/preferences.d/php > /dev/null
echo -e "Package: php-pear\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee -a /etc/apt/preferences.d/php > /dev/null
# add karmic to source list
grep 'main restricted' /etc/apt/sources.list|grep -v "#"| sed s/lucid/karmic/g | sudo tee /etc/apt/sources.list.d/karmic.list > /dev/null
# update package database (use apt-get if aptitude crash)
sudo apt-get update
# install php
sudo aptitude install -t karmic php5-cli php5-cgi
# or (and) sudo apt-get install -t karmic libapache2-mod-php5
sudo aptitude hold `dpkg -l | grep php5| awk '{print $2}' |tr "\n" " "`
#done
#底下是我自行加裝

sudo aptitude install -t karmic libapache2-mod-php5
sudo aptitude install -t karmic php5-mysql
sudo aptitude install -t karmic php5-gb
sudo aptitude install -t karmic php5-curl
sudo aptitude install -t karmic php5-ffmpeg
sudo aptitude install -t karmic php5-json
#sudo aptitude install -t karmic php5-mcrypt
sudo aptitude install -t karmic php5-mysqli
sudo aptitude install -t karmic php5-sqlite
sudo aptitude install -t karmic php5-ldap
sudo aptitude install -t karmic php5-xmlrpc
sudo aptitude install -t karmic php5-xsl
sudo aptitude install -t karmic php5-mhash
有更新一些設定
/etc/apt/sources.d/karmic.list
deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted

deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted

deb http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe

deb http://us.archive.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates multiverse

deb http://security.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted
deb http://security.ubuntu.com/ubuntu karmic-security universe
deb-src http://security.ubuntu.com/ubuntu karmic-security universe
deb http://security.ubuntu.com/ubuntu karmic-security multiverse
deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse
/etc/apt/preferences.d/php
Package: php5
Pin: release a=karmic
Pin-Priority: 991

Package: php5-adodb
Pin: release a=karmic
Pin-Priority: 991

Package: php5-auth-pam
Pin: release a=karmic
Pin-Priority: 991

Package: php5-exactimage
Pin: release a=karmic
Pin-Priority: 991

Package: php5-ffmpeg
Pin: release a=karmic
Pin-Priority: 991

Package: php5-geoip
Pin: release a=karmic
Pin-Priority: 991

Package: php5-gpib
Pin: release a=karmic
Pin-Priority: 991

Package: php5-idn
Pin: release a=karmic
Pin-Priority: 991

Package: php5-imagick
Pin: release a=karmic
Pin-Priority: 991

Package: php5-imap
Pin: release a=karmic
Pin-Priority: 991

Package: php5-interbase
Pin: release a=karmic
Pin-Priority: 991

Package: php5-lasso
Pin: release a=karmic
Pin-Priority: 991

Package: php5-librdf
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mapscript
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mcrypt
Pin: release a=karmic
Pin-Priority: 991
Package: php5-memcache
Pin: release a=karmic
Pin-Priority: 991

Package: php5-memcached
Pin: release a=karmic
Pin-Priority: 991

Package: php5-ming
Pin: release a=karmic
Pin-Priority: 991

Package: php5-ps
Pin: release a=karmic
Pin-Priority: 991

Package: php5-radius
Pin: release a=karmic
Pin-Priority: 991

Package: php5-remctl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-sasl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-sqlrelay
Pin: release a=karmic
Pin-Priority: 991

Package: php5-suhosin
Pin: release a=karmic
Pin-Priority: 991

Package: php5-svn
Pin: release a=karmic
Pin-Priority: 991

Package: php5-symfony1.0
Pin: release a=karmic
Pin-Priority: 991

Package: php5-uuid
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xapian
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xcache
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xdebug
Pin: release a=karmic
Pin-Priority: 991

Package: php5-cgi
Pin: release a=karmic
Pin-Priority: 991

Package: php5-cli
Pin: release a=karmic
Pin-Priority: 991

Package: php5-common
Pin: release a=karmic
Pin-Priority: 991

Package: php5-curl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-dbg
Pin: release a=karmic
Pin-Priority: 991

Package: php5-dev
Pin: release a=karmic
Pin-Priority: 991

Package: php5-gd
Pin: release a=karmic
Pin-Priority: 991

Package: php5-gmp
Pin: release a=karmic
Pin-Priority: 991

Package: php5-ldap
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mysql
Pin: release a=karmic
Pin-Priority: 991

Package: php5-odbc
Pin: release a=karmic
Pin-Priority: 991

Package: php5-pgsql
Pin: release a=karmic
Pin-Priority: 991

Package: php5-pspell
Pin: release a=karmic
Pin-Priority: 991

Package: php5-recode
Pin: release a=karmic
Pin-Priority: 991

Package: php5-snmp
Pin: release a=karmic
Pin-Priority: 991

Package: php5-sqlite
Pin: release a=karmic
Pin-Priority: 991

Package: php5-sybase
Pin: release a=karmic
Pin-Priority: 991

Package: php5-tidy
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xmlrpc
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xsl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-enchant
Pin: release a=karmic
Pin-Priority: 991

Package: php5-intl
Pin: release a=karmic
Pin-Priority: 991

Package: libapache2-mod-php5
Pin: release a=karmic
Pin-Priority: 991

Package: libapache2-mod-php5filter
Pin: release a=karmic
Pin-Priority: 991

Package: php-pear
Pin: release a=karmic
Pin-Priority: 991

參考來源:http://mrkandy.wordpress.com/2010/04/16/install-php-5-2-x-in-ubuntu-10-04-lucid/

沒有留言: