sábado, 1 de noviembre de 2014

Downgrade a package on Debian Wheezy

Sometimes it would be necessary to use a different package version available from the official repositories of our distro, in this case I'll show how to downgrade PHP from wheezy (5.4.4) to Squeeze (5.3.x)

I've already installed php5.4.x, so the steps are:

1. sudo nano /etc/apt/sources.list, add these lines at the end:

  deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
  deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free

  deb http://security.debian.org/ squeeze/updates main contrib non-free
  deb-src http://security.debian.org/ squeeze/updates main contrib non-free

  Save your file

2.  Now, we need to display what packages we have installed and related to php5:
   PHP=$(dpkg -l | grep 5.4.4|awk '{print $2}')

  So, I put the result of the above command inside a temporal variable, I will use it later, you may change the version (5.4.4) for the one you're using, it might be later if you're using testing repo for example

3. Cool, now let's take a look to the result:
 echo $PHP
in my case I got libapache2-mod-php5 php5 php5-cli php5-common

4. Next, I will create some rule preference for apt:
   sudo nano /etc/apt/preferences.d/preferences, and I will add these lines that are related to my current installed packages displayed in the above command:

Package: php5*
Pin: release a=oldstable
Pin-Priority: 700

Package: libapache2-mod-php5
Pin: release a=oldstable
Pin-priority: 700

Package: *
Pin: release a=stable
Pin-Priority: 600

Save it

5.  update your repos:
  sudo apt-get update


6. Finally downgrade your packages:
  sudo apt-get install --reinstall $PHP

you should see a screen like this:


Notice that the packages that you displayed using dpkg ($PHP) will be downgraded


If you want you may code a php file with phpinfo() and you'll see something like this:




Regards

No hay comentarios:

Publicar un comentario