Setup the Dotdeb apt repository on Debian
The Dotdeb repository hosts software unavailable by default in the official Debian repositories. It provides PHP 5.4, the nginx HTTP server, the Percona toolkit, etc... This howto setup this repository with a minimal impact on the system: only the wanted software are installed, the other packages available in Dotdeb repositories are ignored.
This howto is tested on:
- Debian 6.0 Squeeze
Repository setup
Install the needed software :
command apt-get install lsb-release
Detect the distribution name :
DEBIAN_VERSION="$(command lsb_release -cs)"
Add the repository to Apt configuration :
command echo "# DotDeb repository.
deb http://packages.dotdeb.org ${DEBIAN_VERSION} all
deb-src http://packages.dotdeb.org ${DEBIAN_VERSION} all" \
> '/etc/apt/sources.list.d/dotdeb-org.list'
Add the signing ssl key for the repository to Apt key ring:
command wget 'http://www.dotdeb.org/dotdeb.gpg' \
--quiet --output-document=- \
| command apt-key add -
Assign a low priority to Dotdeb packages:
command echo "Package: *
Pin: origin packages.dotdeb.org
Pin-Priority: 200" \
> '/etc/apt/preferences.d/dotdeb-org'
Update the available packages list:
command apt-get update
Software installation
Install PHP 5.3 packages provided by Dotdeb
Detect the distribution name :
DEBIAN_VERSION="$(command lsb_release -cs)"
Fetch the list of PHP5 and PECL packages available in Dotdeb repository :
PACKAGES=$(command wget "http://packages.dotdeb.org/dists/${DEBIAN_VERSION}/php5/binary-$(command dpkg --print-architecture)" \
--quiet --output-document=- \
| command grep "href=" | command grep -v "h1" | command grep -v "\.\./" \
| command sed -e 's/^[^>]*>\([^_]*\)_.*$/\1/' | command tr "\n" " ")
PECL_PACKAGES=$(command wget "http://packages.dotdeb.org/dists/${DEBIAN_VERSION}/php5-pecl/binary-$(command dpkg --print-architecture)" \
--quiet --output-document=- \
| command grep "href=" | command grep -v "h1" | command grep -v "\.\./" \
| command sed -e 's/^[^>]*>\([^_]*\)_.*$/\1/' | command tr "\n" " ")
ALL_PACKAGES=$(command wget "http://packages.dotdeb.org/dists/${DEBIAN_VERSION}/php5/binary-all" \
--quiet --output-document=- \
| command grep "href=" | command grep -v "h1" | command grep -v "\.\./" \
| command sed -e 's/^[^>]*>\([^_]*\)_.*$/\1/' | command tr "\n" " ")
Assign a high priority to Dotdeb PHP packages :
command echo "Package: ${PACKAGES} \\
${PECL_PACKAGES} \\
${ALL_PACKAGES}
Pin: origin packages.dotdeb.org
Pin-Priority: 500" \
> '/etc/apt/preferences.d/dotdeb-org-php5'
Make sure that PHP session files stay in "/var/lib/php5" and prevent PHP to manage their deletion (handled by a cron script) :
command mkdir --parents '/etc/php5/conf.d' '/var/lib/php5'
command chmod 733 '/var/lib/php5'
command chmod o+t '/var/lib/php5'
echo '; Store sessions to /var/lib/php5
session.save_path = "/var/lib/php5"
session.gc_probability = 0' \
> '/etc/php5/conf.d/000-session-store-default.ini'
Install the PHP5 packages by upgrading the system if you have an existing PHP install :
command apt-get upgrade
If PHP-APC is installed, replace it by the Dotdeb version :
if [ -n "$(command dpkg --status php-apc | command grep 'Status: install ok installed')" ]; then
command apt-get -y remove --purge php-apc
command apt-get -y install php5-apc
fi
Install MySQL 5.5 packages provided by Dotdeb
Detect the distribution name :
DEBIAN_VERSION="$(command lsb_release -cs)"
Fetch the list of MySQL 5.5 packages available in Dotdeb repository :
PACKAGES=$(command wget "http://packages.dotdeb.org/dists/${DEBIAN_VERSION}/mysql-5.5/binary-$(command dpkg --print-architecture)" \
--quiet --output-document=- \
| command grep "href=" | command grep -v "h1" | command grep -v "\.\./" \
| command sed -e 's/^[^>]*>\([^_]*\)_.*$/\1/' | command tr "\n" " ")
ALL_PACKAGES=$(command wget "http://packages.dotdeb.org/dists/${DEBIAN_VERSION}/mysql-5.5/binary-all" \
--quiet --output-document=- \
| command grep "href=" | command grep -v "h1" | command grep -v "\.\./" \
| command sed -e 's/^[^>]*>\([^_]*\)_.*$/\1/' | command tr "\n" " ")
Assign a high priority to Dotdeb MySQL packages :
command echo "Package: ${PACKAGES} \\
${ALL_PACKAGES}
Pin: origin packages.dotdeb.org
Pin-Priority: 500" \
> '/etc/apt/preferences.d/dotdeb-org-mysql-5-5'
Install MySQL 5.5 packages by upgrading your system if you have an existing MySQL install :
command apt-get upgrade
Thanks
- Thanks to Dotdeb repository maintainers.