Tag Archives: apt

[debian] apt command to search which packages that provide certain file/library

Suppose you want to compile an application that need some library file such as libcurl.so but you don’t know the exact packages name. Sure, you can guess by using apt-cache search but the result might not be pleasant. (apt-cache search result when combined with file name will –usally– return empty result).
Here, I’ll show you other alternative to apt-cache search to search packages name who provide certain files/libraries.

  • Install apt-file package:


apt-get install apt-file
  • before using apt-file, you should update the database first (you need internet connection to do this):
apt-file update
  • wait until all package databases from repository downloaded. Now you can use it:
apt-file --package-only search libcurl.so

that command will search which packages from repository that provide libcurl.so file. Use –package-only to only package name, without this option, the result will also include file name and directory name inside packages (which –in my opinion– quite distracting). Oh, almost forgot, apt-file can be used by non-root users.
man apt-file for more complete usage!

[debian] apt-get install specific version of package

When you’re adding additional repositories beside the default in your /etc/apt/sources.list, Debian will provide more than one version of package where available. You can use “apt-cache policy package-name” to check the package’s available version. For example, you want to check available ffmpeg version on your repositories, you can use this command:

apt-cache policy ffmpeg

If you add additional repositories other than default, you may have several version of ffmpeg. This one is the output example on my server (I add debian-multimedia and backports repository beside the default):

root@nw:~# apt-cache policy ffmpeg
  Installed: 4:0.7.2-1~bpo60+1
  Candidate: 5:0.7.11-0.1
  Version table:
     5:0.7.11-0.1 0
        500 http://ftp.uni-kl.de/debian-multimedia/ stable/main i386 Packages
 *** 4:0.7.2-1~bpo60+1 0
        100 http://backports.debian.org/debian-backports/ squeeze-backports/main i386 Packages
        100 /var/lib/dpkg/status
     4:0.5.6-3 0
        500 http://ftp.us.debian.org/debian/ squeeze/main i386 Packages
        500 http://security.debian.org/ squeeze/updates/main i386 Packages

Those lines above show you which ffmpeg version is already installed and which one is available on other repository.
Suppose you want to install ffmpeg version 5:0.7.11-0.1 from debian-multimedia repository, you can use this command:

apt-get install ffmpeg=5:0.7.11-0.1

Notice that I put “=” and the version number [omitting the last number (0)] after the package name. That apt-get command will install ffmpeg from debian-multimedia and removing the one from backports that already installed.
When a package have some configuration file (such as Apache with it’s apache2.conf), apt-get will ask you whether to keep your current configuration or use the new version (overwrite the old one).

super easy installing ffmpeg, ffmpeg-php, lame, libogg, libvorbis, mplayer, mencoder and flvtool2 in Debian 6

There are new comer Linux users that still think that installing ffmpeg, mencoder and flvtool2 is hard to do in Linux. I can understand this because not many tutorial site tell them how to do it easily. If you do not need “bleeding-edge” features of the latest ffmpeg, ffmpeg-php, mencoder, mplayer and flvtool2, you can use this tip I wrote. You need additional Debian repository to do this tip.

Add debian-multimedia repository in your /etc/apt/sources.list (edit this file using your favorite text editor such as vim or nano)

#debian multimedia
deb http://ftp.uni-kl.de/debian-multimedia/ stable main
deb-src http://ftp.uni-kl.de/debian-multimedia/ stable main

You can choose the nearest debian-multimedia repository server here: http://debian-multimedia.org/debian-m.php. Choose the one that near your server, at least in the same continent.

After adding to sources.list, do some:

apt-get update
apt-get install debian-multimedia-keyring
apt-get update&&apt-get upgrade

then, to install ffmpeg, mencoder, mplayer and flvtool2 in Debian Squeeze, do some:

apt-get install ffmpeg mplayer mencoder flvtool2

you’re done! It should be less than 5 minutes for a fast server.
apt-get will handle the dependency (such as libmp3lame, libogg, libvorbis) for you! No meddling with source code, no need to compile by yourself, no dependency headache, no libraries conflict, just working environment with some simple steps!

For ffmpeg-php there is additional repository: dotdeb repository. Read the instruction on how to add dotdeb repository in your current Debian 6 /etc/apt/sources.list
After adding dotdeb repository, you can simply install ffmpeg-php by:

apt-get update&&apt-get upgrade
apt-get install php5-ffmpeg
service apache2 restart    # restart apache2 to make sure ffmpeg-php module is loaded

That easy!

Debian 6 apps/tools that I installed after fresh OS install (for server purpose)

Another personal notes for me. These are all small applications/tools that I should install after fresh OS install, most of them are tools to monitor server performance.
nmap : check sever’s open TCP/IP ports. For security reason.
nmap result
mc: a better text based file manager with 2 panes and also provide a good text editor (mcedit)
htop: a better view of top command
htop result
iftop: watch your detailed network traffic at certain ethernet device; see who’s the fastest bandwidth eater.
iftop result
bwm-ng: also bandwidth monitoring but only show overview for each ethernet
bwm-ng result
libwww-perl : this one is dependency for CSF firewall
links: text based browser
curl: this one is used later in most of my PHP scripts

apt-get install nmap htop iftop bwm-ng mc libwww-perl links curl

Personal Notes: Debian 6 additional repositories

This is personal note for myself. All of my servers I bought is self-managed and most of them is Debian 6 (squezee). I need to add additional repositories beside the default ones.

Additional Debian 6 repositories added:

  • dotdeb repository –> for latest PHP and MySQL packages
  • debian-multmedia repository  –> for latest multimedia packages such as ffmpeg, mencoder, mplayer
  • debian-backports  –> additional software from Debian previous version that not included in main repository

Full /etc/apt/sources.list

deb http://ftp.us.debian.org/debian squeeze main
deb http://security.debian.org/ squeeze/updates main

# squeeze-updates, previously known as 'volatile'
deb http://ftp.us.debian.org/debian/ squeeze-updates main
deb-src http://ftp.us.debian.org/debian/ squeeze-updates main

deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all

#debian multimedia
deb http://ftp.uni-kl.de/debian-multimedia/ stable main
deb-src http://ftp.uni-kl.de/debian-multimedia/ stable main

#debian backports
deb http://backports.debian.org/debian-backports squeeze-backports main

Additional steps for dotdeb repository: before doing “apt-get update“, must download and install dotdeb key first

wget http://www.dotdeb.org/dotdeb.gpg
cat dotdeb.gpg | apt-key add -

Additional steps for debian-multimedia repository: must install debian-multimedia-keyring after apt-get update

apt-get install debian-multimedia-keyring