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
Generating locales...
pl_PL.UTF-8... done
Generation complete.
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
That’s all!
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";' \
> /etc/apt/apt.conf.d/no-recommends

Sometimes brand-new 64 bit architecture must be used for running 32-bit programs. You can preserve your 64-bit system and create so called “32 bit chroot” environment. I’ll use Debian as guest operating system because it supports easy bootstrapping out-of-the-box.
I assume debootstrap program is already installed. First: create Debian tree:
# debootstrap --arch=i386 lenny /home/dccb/lenny
Then we can chroot to new env and customize:
# chroot /home/dccb/lenny /usr/bin/i386
(...)
Note that shell “/usr/bin/i386″ is required for chrooted environment to see 32-bit architecture. If you want to jump directly into plain user account use this command:
# chroot /home/dccb/lenny /usr/bin/i386 su - $CHROOT_USER
Inside chroot you can do (almost) everything (install programs, run daemons, …). Note that sometimes you will have to change services ports to not collide with services present on host (HTTP, SSH, …) – it’s not a virtualisation, just chroot jail.
Additional note: In order to get correct /dev and /proc tree you have to mount them before chrootting:
mount -o bind /proc /home/dccb/lenny/proc
mount -o bind /dev /home/dccb/lenny/dev
If you are administering small-memory VPS servers it’s very easy to exceed all available memory. Typical memory hogs (apache mpm-prefork, rsyslogd) could be easily replaced by alternatives. It’s not very easy to do with packaging system (you have to be up to date with security updates).
I compared memory usage of two APT interfaces: apt-get and (new, now prefferred) aptitude. Here are the results (top output when command shows list of packages to install):
# apt-get install munin
----------------------------
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
28800 root 20 0 15940 13m 10m T 0 10.3 0:00.44 apt-get
# aptitude install munin
----------------------------
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
28822 root 20 0 40936 33m 12m T 0 26.3 0:00.92 aptitude
As you can see aptitude uses almost 3x more memory than apt-get (VSZ and RSZ). If you are low on memory on low-end box it’s noteworthly saving.
Note: tests were done on 32-bit OpenVZ-based VPS.
