2008 January 21

Ubuntu Package Management 101

After having used Ubuntu and Debian for a real long time, and almost entirely through the command line, I thought I would post a quick reference of sorts for all package management related tools in one place .

I would definitely like to have community support for improving this, and am sure it will be helpful for all terminal junkies.

1. Listing of repositories
– Found at /etc/apt/sources.list
– Lines starting with # indicates comment
– Lines starting with deb indicate pre-packaged binaries
– Lines starting with deb-src indicate source. Can be commented for most users

2. Package management tools
– aptitude
– dpkg
– apt-cache

3. Updating index of repositories
sudo aptitude update

4. Searching for a package from the repos

aptitude search package-name
apt-cache search package-name
apt-cache search –names-only package-name

5. Listing all installed packages
dpkg –list | grep ^ii
You can further pipe it using grep to search for a installed package that matches some name
dpkg –list | grep ^ii | grep package_name

6. Install a .deb file you downloaded from the internet
sudo dpkg –install path_to_file_name
This is not always advised. First check with the package documentation if you have required dependancies, and it is always better to install from the repositories.

7. Install a package repo
If you know the package name, or if you know the package exists after a search as per 4 above,
sudo aptitude install package-name
This will pull all dependencies

8. Uninstalling a package
sudo aptitude purge package-name
aptitude remove package-name

The first one deletes everything including configuration files. The second one retains the configuration files.

9. Listing all files that a certain package installed in your system
dpkg –listfiles package-name

10. Finding out which package installed a file
If you know a file, and want to know which package installed it
dpkg –search filename
For example dpkg –search /etc/apache2/apache2.conf reveals apache2-common

11. Upgrading your system
sudo aptitude upgrade
This upgrades all packages installed using aptitude/apt-get or dpkg. Substitute upgrade with dist-upgrade for a more complete upgrade (can someone help me out here?)

12. Finding out which repo a package came from
apt-cache policy package_name

13. Changing configuration of a package
sudo dpkg-reconfigure package-name

14. Clear the cache of downloaded packages
sudo aptitude clean
sudo aptitude autoclean

15. Show informatoin about a package
aptitude show package-name
apt-cache show package-name
dpkg –info package-name.deb

The last one is for showing details of a package you downloaded online.

Other miscellaneous details

1. apt-get settings in /etc/apt. Change if you know what you are doing
You could
— Determine before hand how much configuration a package should undergo
— modify the gpg data of repositories
— Pin packages, that determine wheter or not you don’t want a package upgraded

2. Downloaded .deb files are stored in /var/cache/apt/archives
Delete them using 14

If required, admins please move this to another section as you see fit.

Edit #1: Thanks to Aysiu for pointing out requirement of root permisions.

http://ubuntuforums.org/archive/index.php/t-227432.html

By WladyX on 21 January, 2008 | Ubuntu | A comment?

Ubuntu no flash sound in firefox

Install libflashsupport_1.0~2219-1_i386.deb from:

PulseAudio – Ubuntu Wiki

By WladyX on | Ubuntu | A comment?

Nautilus preview sounds Ubuntu

By WladyX on | General, Ubuntu | A comment?

Cron Alarm Clock

 

I only found
one GUI alarm/timer in portage and it wasn’t exactly what I was looking
for (see wmtimer below) so I decided just to use cron.

Cron is a good solution for an alarm – it’s running all the time and
simple to setup. Once I learned to use it, I use it all the time.

The crontab application is used to work with cron jobs. The cron
daemon checks for cronjobs every minute. A command line mp3 player can
be used here but I use Audacious. Cron will need to be told what X
display to use for Audacious to play. Discover the current display by:
env | grep DISPLAY

Then as regular user edit crontab.
crontab -e

Here’s a simple comment to represent the cronjob layout:
# minute (0-59),
# | hour (0-23),
# | | day of the month (1-31),
# | | | month of the year (1-12),
# | | | | day of the week (0-6 with 0=Sunday).
# | | | | | commands

Enter the time (multiple times, days need to be separated with
commas) and script to execute for the alarm. The asterik can be used
(*) to satisfy all variables. Here’s mine for audacious:
07 21 * * 1,2,3,4,5 env DISPLAY=:0.0 audacious /home/user/My\ Music/Other/Alarms/301gq.mp3

I found some good alarm tracks at this site the were perfect for the task.

I like vim as my system editor but any can be used. In Gentoo edit the /etc/rc.conf to change it. To list the crontab.
crontab -l

Additional Information:
Gentoo Cron Guide
Ubuntu Wiki on Cron
gnome-schedule is a GUI utility for Gnome – in sunrise overlay.
A Gnome/python alarm clock

wmtimer

Wmtimer works just fine for Gnome users (KDE has kalarm) it leaves a
small window on the screen which can’t be hidden but it is able use the
system beep or execute a command on an alarm/timer event. Starting it
from the command line is pretty easy:
wmtimer -a -t 18:39:00 -e "mpg321 ~/Music/Other/Alarms/301gq.wav"

Update:Audacious also has alarm ability but it’s
buried deep in it’s preferences ( Preferences > Plugins > General
), I find using cron better.

http://linuxtidbits.wordpress.com/2008/01/19/cron-alarm-clock/

By WladyX on | General, Scripts | A comment?

Firefox extensions

By WladyX on | Firefox | A comment?