First question: why do you need local Debian-based install inside your Debian distro? Sometimes you want to check some experimental packages and don’t want to break your base system or start some service in isolated environment without virtualisation effort. Then chroot comes as an effective solution for you!
First of all you have the debootstrap program that is used to do all the job you need:
sudo apt-get install debootstrap
Then you select your favourite distro version and download URL:
sudo debootstrap –arch i386 squeeze /home/debian-chroot http://ftp.debian.org/debian
And you jump to your newly-installed system:
sudo chroot /home/debian-chroot
And: voila! Done!
There are people who prefer bleeding-edge software versions, other prefer stability over new features. I’m an advanced Linux user, however I fall into the latter category of users. Recently I discovered my current mixed-version Ubuntu is not as stable as I would like and I decided to revert to older version of Ubuntu (lucid).
Debian apt system allows to set preferences for packages and this method can be used to downgrade packages. First of all you have to declare sources of software of desired distro (lucid) in my case:
$ grep ^deb /etc/apt/sources.list
deb http://pl.archive.ubuntu.com/ubuntu/ lucid main restricted
deb http://pl.archive.ubuntu.com/ubuntu/ lucid-updates main restricted
deb http://pl.archive.ubuntu.com/ubuntu/ lucid universe
deb http://pl.archive.ubuntu.com/ubuntu/ lucid-updates universe
deb http://pl.archive.ubuntu.com/ubuntu/ lucid multiverse
deb http://pl.archive.ubuntu.com/ubuntu/ lucid-updates multiverse
deb http://security.ubuntu.com/ubuntu lucid-security main restricted
deb http://security.ubuntu.com/ubuntu lucid-security universe
deb http://security.ubuntu.com/ubuntu lucid-security multiverse
Then we can declare we prefer lucid even if current package in the system if newer:
$ cat /etc/apt/preferences.d/downgrade-to-lucid
Pin: release a=lucid
Pin: release a=lucid-updates
Pin: release a=lucid-security
As you can see I added updates and security source pacages into account to have such updates already in my system.
If you used to Debian you probably know that “dpkg-reconfigure locales” brings you locale selection tool. It’s not the case for Ubuntu. How to replace Debian’s behavior? Read below:
# grep pl_PL.UTF-8 /usr/share/i18n/SUPPORTED > /var/lib/locales/supported.d/local
# dpkg-reconfigure locales
Above example show how to add pl_PL.UTF-8 locale.
Sometimes you want to install latest version of selected software package while keeping base system stable. Then installing from source is a safe option to proceed.
First, you have to include sources from fresh system version, below is example taken from Ubuntu, I selected natty (/etc/apt/sources.list):
deb-src http://pl.archive.ubuntu.com/ubuntu/ natty main restricted
Then you should refresh package list:
sudo apt-get update
and install dependencies:
sudo apt-get build-dep ccache
and finally build the new version of a package (note that no root account is needed for that step):
apt-get -b source ccache
As a result there’s a *.deb package, install it:
sudo dpkg -i ccache*.deb
Sometimes you want to install some packages quickly and you know exactly what components you need. Then installing uneccessary 20 MB (recommended/suggested packages) when you need just 200 kB package is just waste of your time and disk space. Here’s good news: you can easily tell apt not to install recommend (and/or suggested) packages to make installation faster:
echo 'APT::Install-Recommends "0"; APT::Install-Suggests "0";' \