Click to See Complete Forum and Search --> : Debian Apt - Quick Reference


Syngin
05-10-2004, 12:56 PM
Found these and thought I'd add them for future reference:

Phil's APT Quick Reference
Debian's apt system truely revolutionized linux package management. It inspired other distros to port apt, or build similar functionality such as the urpmi system. For many people, it is the main reason they run Debain.

Below is a quick reference to cover some of the most commonly needed apt uses.

Download and install package:
apt-get install package

Update apt's list of available packages:
apt-get update

Upgrade all installed packages with upgrades available:
apt-get upgrade

Upgrade to new distro, or in general upgrade anything available for update including core system packages:
apt-get dist-upgrade

Uninstall package:
apt-get remove package

Uninstall package, and its config files, and don't leave it in the database as 'uninstalled':
apt-get --purge remove package

Search for a package like pattern:
apt-cache search pattern

Get information on installed package:
dpkg -s package

Find which installed package file belongs to:
dpkg -S inetd.conf

List which files are in package:
apt-file list package

Find out what packages provide file:
apt-file search file

Run a command (such as ./configure or make) and have all necessary packages installed as needed:
auto-apt run command

Unless specified, the package in reference doesn't have to be already installed for these to work... but the database needs to be updated. You can update the appropriate database via:
apt-get update
or
auto-apt update
or
apt-file update

mdwatts
05-10-2004, 03:06 PM
Very nice.

Thanks Syngin as I've saved that for whenever I get around to installing and trying out Debian.

Prod_Deity
05-19-2004, 04:55 PM
Originally posted by Syngin
Download and install package:
apt-get install package

Update apt's list of available packages:
apt-get update

I've tried reading MAN pages & other help, but I still don't understand the APT process.

For example, I downloaded a window decoration from kde-look (I figured it'd be the easiest), then tried to run

root@debian_box:/home/# apt-get install window decoration , but then I get a bunch or URL's and it saying it cannot find the file.:confused:

I figured it'd be kind of like "urpmi", guess I was wrong.

Thanks in advanced.

knute
05-19-2004, 05:44 PM
Prod_Diety,

apt-get is a front-end to dpkg.

If you've downloaded a deb and put it in your home directory or where ever, you can do dpkg -i <packagename> to install it.

If you put the package in /var/cache/apt/archives, then you can use apt-get to install it.

If you want to keep the package up to date, you can put the repository into your /etc/apt/sources.list, then apt-get update.

Does that explain it a little better for you?

Prod_Deity
05-19-2004, 07:00 PM
YES! That was great!

It's nice nothaving to go through dependency hell. :cool:

I don't know why I didn't go to a Debian based system a long time ago.

Now, forgive me for asking such a silly question... but how would I go about editing the sources.list file from a shell?

I've tried to edit it with foo text editor, but to no avail.

Thanks again! :D

sharth
05-19-2004, 07:07 PM
hmm. a few things i would like to add.

apt-get update should be run fairly often (no harm in doing it.) if you are on a always on connnection, you can place it in your cron scripts if you like.

apt-get upgrade will upgrade all packages which can be upgraded WITHOUT removing or adding any new packages. this means, that if for some reason, a new version of say nautilius depends on cdrecord, and you don't have cdrecord installed, apt-get upgrade would not upgrade nautilus.

apt-get dist-upgrade will upgrade all packages to the most recent version even if it requires removing or adding new packages. in the above example, apt-get dist-upgrade would simply upgrade nautilus and install cdrecord.

You can "generally" run apt-get upgrade without worrying about your system becoming unstable or what not. (assuming you don't run sid or experimental stuff). If you run sid, broken packages can enter the archive every now and then, so there are chances of things breaking.

Do NOT run apt-get dist-upgrade without reading to see what it is planning on installing and uninstalling. In some cases (weird stuff can happen) it may try to uninstall core packages, which, we all know, is bad.

:edit removing some unneeded stuff and adding more stuff:
Generally, to edit the sources.list file which is found in /etc/apt/sources.list, i do one of a few things. if its a cd-rom that I'm adding to the sources.list, use apt-cdrom. otherwise, its generally a http or ftp resource. so i just use vim (but use whatever text editor you like) and add to the file in the required syntax (not getting into that...) and then run apt-get update.

Prod_Deity
05-19-2004, 08:40 PM
Thanks alot. That helps out a ton. :)

knute
05-19-2004, 08:44 PM
You also need to be root in order to modify the sources.list.
su'ing to root is how I normally do it, btw.

su
<root.password>
vim /etc/apt/sources.list

That's the process that I normally use, which doesn't happen that often, but on occasion when there's a package that's not in one of the main repositories. :D

HTH

FrankBlourtango
05-20-2004, 03:58 PM
Very helpful post. Esp for a clueless newbie like me.:rolleyes:

tom56
05-27-2004, 03:07 PM
maybe this should be sticky-ed?

DimGR
05-27-2004, 03:56 PM
Is apt-get dist-upgrade "safe" ?
I read somewhere that it can brake your system.. Does it upgrade only the softwares or the kernels too etc .. ??

mdwatts
05-28-2004, 10:59 AM
Originally posted by tom56
maybe this should be sticky-ed?

We would prefer not to have sticky threads in the 'How I did it' forum, sooooo

If someone (thanks tom56 :) ) would like to copy and paste the relevant reference tips from this thread into a new one (in this forum) while adding any more you can think of, I can copy/move the new thread to our JL Help File library forums.

sharth
05-28-2004, 01:22 PM
http://justlinux.com/forum/showthread.php?s=&postid=733552

please post suggestions in this thread and I'll add them.