00:00:00 - And welcome to section 102.4 where we talk
00:00:03 - the Debian Package Management system. We're going
00:00:07 - to do a couple things. I'm going to show you how to use all the tools available
00:00:10 - or most of them. We're going to start with dpkg which
00:00:13 - is a command line tool. It doesn't do dependencies, we're going to talk
00:00:18 - about that in a minute. We're going to talk about dpkg reconfigure, which
00:00:21 - is one that you're probably going to use even if you don't
00:00:23 - use dpkg that much. Then we're going to talk about the apt package
00:00:27 - management system which is really what most people use now.
00:00:31 - That's, it's a great program and I'm going to show you the nuances of how
00:00:34 - to use it best. And then we're going to talk about the new kid on the block
00:00:37 - here, which is aptitude. Now aptitude is very similar to all
00:00:42 - these other tools but it does a little bit more. We're going to talk
00:00:45 - about that as well. So by the time you're done you're going to be able to
00:00:48 - manage packages in a Debian based operating system which
00:00:52 - includes things like Ubuntu.
00:00:56 - Lets see what else Mint
00:01:01 - That is a horrible, mint.
00:01:03 - Xandros.
00:01:06 - There's a whole bunch of Linux operating systems based
00:01:10 - on Debian, so this you'll see this apt package management
00:01:13 - a lot. So let's look at the computer and see how it actually work.
00:01:17 - Alright, the first program we're going to look at is just simply d package
00:01:21 - or dpkg. Now what this does, it is the application that
00:01:26 - was designed for installing packages, Debian packages
00:01:29 - in Debian based operating system. It's an old one; you don't generally
00:01:33 - use it on the command line anymore, but there are some interesting
00:01:36 - things that it will do. Here let's clear the screen. For example
00:01:40 - dpkg, if we want to get some information on something.
00:01:46 - Let's ty no let's type minus l for list and then
00:01:51 - let's ty, oh gosh how about Firefox. That one's installed for sure.
00:01:58 - To do, to do, to do,it's going to show us some stuff here.
00:02:02 - So let's see, it says that these i's here, mean Firefox is installed.
00:02:07 - Shows the version, says what it is; it's a meta package for a popular
00:02:11 - Mozilla blah-blah-blah blah. Let's see, what if we were to go
00:02:16 - and get some specific details about it, dpkg minus p
00:02:22 - for print available information. Firefox, well let me get a whole
00:02:26 - screen full stuff about it, the size of it, what architecture it's
00:02:31 - for, a source, a description with texture, let's maximize this. It still doesn't fit
00:02:37 - on the screen but, it talks about Firefox, what it is, what it does,
00:02:41 - and this is, for a package that's already installed, okay; so Firefox
00:02:45 - is already installed. Now again I talked about using it to install
00:02:48 - packages as well and what I've done, to use dpkg
00:02:53 - you need a.deb file and I've gone and downloaded this webmin. It's
00:02:57 - just a web based administration program that you can download
00:03:01 - this deb file and what you would do is dpkg -i
00:03:05 - for install and then the program. Now a couple of bad things
00:03:10 - are going to happen. First of all it's going to try to install
00:03:13 - it. And, oh, see it says all of these dependency problems
00:03:20 - that it found it, webmin depends on this and webmin depends on this
00:03:25 - and this and all these things it depends on and so it's not
00:03:29 - going to work properly. However here's the catch, it
00:03:34 - didn't install it properly, yet it still installed it in the
00:03:37 - database which is a really big problem because now we're going
00:03:42 - to have this half installed program that doesn't work right
00:03:46 - it just doesn't.
00:03:48 - It won't install these dependencies, it just tells you they're not there, but installs
00:03:52 - the program anyway. So the next thing we're going to do is
00:03:54 - remove this package because right now it's very very broken.
00:03:58 - So dpkg, let's see, -r for remove and when you use it this
00:04:06 - way; if it's an already installed package, you don't put the
00:04:08 - entire file name. You just put the part before that underscore the name of the
00:04:12 - package. Like I did it earlier, when I was talking about Firefox. I just typed Firefox.
00:04:16 - Well the same thing here. We're just going to do
00:04:18 - dpkg - r webmin
00:04:22 - and it's going to remove that so we don't have an error in
00:04:24 - our in our package database. Dpkg really that's about
00:04:29 - what you can do. You can look at some information, you can
00:04:31 - see what it provides. Let's look at the list of commands that
00:04:35 - are available for d package. Go back over here and our white board.
00:04:40 - So dpkg, again it's a command line binary. It's it's
00:04:44 - old but there's a bunch of different things you can do, -i
00:04:48 - or not I put these two on here --install or -i,
00:04:53 - do the same thing and on the test you may see one or the
00:04:58 - other so if you're used to things like -l, if they throw
00:05:02 - in a --list you need to know it's the same thing
00:05:05 - and also see this is a lower case l, this is an upper case L.
00:05:09 - Case matters so --list files and -list are different
00:05:14 - things. So what -i is going to do, this is going to
00:05:19 - be the program that installs the package. Again, it's not going
00:05:23 - to check for dependencies or anything like that it's just
00:05:25 - going to install the package. -l
00:05:30 - either going to list all of the packages or it's just going
00:05:34 - to list information about the one you specify. So if you leave
00:05:38 - it with nothing on the command line, like we looked at, it's
00:05:40 - going to list all packages,
00:05:46 - or just the one that you specify after the command. -L,
00:05:50 - the capital L. Now you notice this is capital and not lower case. This
00:05:54 - is going to show the files that are installed by a package.
00:05:58 - So if we do like, dpkg - capital L; Firefox is going to show you
00:06:03 - all the files in the file system hierarchy that are a part
00:06:06 - of that package. Okay now capital P, again notice case matters here.
00:06:11 - Capital P is going to do the same thing that remove does. These
00:06:15 - two are related.
00:06:17 - The difference being that purge will remove the program
00:06:22 - and the config files whereas remove
00:06:26 - will only remove the program, okay. So they're related but remove
00:06:29 - doesn't purge any modified config files you may have done. And then lower case
00:06:34 - p; this is going to give detailed information. So we looked
00:06:37 - at that already.
00:06:39 - It talks about you know, a summary what the program is, where it came
00:06:42 - from, how big it is, all that kind of stuff. And than -S
00:06:48 - this, now again this is a capital S.
00:06:51 - This is going if you specified minus capital S and then you
00:06:55 - specify a file this is kinda neat, it'll tell you what package
00:06:58 - it's from, so
00:07:01 - we'll say,
00:07:04 - so displays the package supplying that that particular file.
00:07:07 - So you need to do the complete path name when you actually
00:07:12 - put this on the command lines. So you'll need to do like user bin
00:07:15 - or whatever. Let's look at that really quick.
00:07:20 - Okay, so let's say for example we do d,
00:07:25 - get in there, dpkg minus capital S
00:07:30 - bin ls because ls we know is a binary executable file. Now what
00:07:35 - this is going to do, it's going to return the answer coreutils.
00:07:39 - So coreutils is a name of the package that supplies
00:07:42 - the file bin.ls, so that way we know what package
00:07:46 - it's part of, or say there is a file that we just don't
00:07:49 - know where it came from or why it's there. If we type this dpkg
00:07:52 - minus capital S it will tell us where it comes from, so
00:07:56 - that's kinda dpkg in a nutshell. Now we're going to move
00:07:59 - on to dpkg -reconfigure that's a useful tool that we
00:08:04 - can do to reconfigure some packages and then we're going to move on
00:08:06 - to some more advanced package management tools. So let's look
00:08:11 - at dpkg reconfigure.
00:08:14 - Okay the white board for this is pretty simple because dpkg
00:08:17 - reconfigure is a pretty easy tool to use. It's very very
00:08:20 - handy because if you mess up your configuration, what you can
00:08:23 - do is go through and dpkg-reconfigure will walk you back through
00:08:27 - that original configuration process. Now the kicker is you have to know
00:08:30 - the package name. In some things like your X server, it's difficult
00:08:34 - to know exactly what package it is that will configure that, so
00:08:37 - let's go back over to our system and we'll dpkg-reconfigure
00:08:42 - a file so that you can see what I'm talking about.
00:08:45 - Okay, so let's run the command dpkg
00:08:48 - reconfigure and lets see a file that I know is gonna walk us through a
00:08:52 - configuration is going to be post fix. Now post fix is the email
00:08:56 - server that runs on a lot of the operating system or a lot
00:08:59 - of Linux operating systems. But let's look at this. If you
00:09:01 - type this reconfigure thing, it's going to walk you through
00:09:04 - the same configuration process, it did when we originally
00:09:07 - installed it. So for example, I'll just set up a local mail only,
00:09:11 - system mail name CBT for nuggets and who gets mail for the
00:09:18 - root user. We can set this at gosh I don't know, sspowers;
00:09:25 - @no.where.com which isn't a real address of course.
00:09:29 - And what domains will it receive e-mail for; yes, that looks good.
00:09:34 - Synchronous updates on mail queue, no, but you see all of these
00:09:38 - settings that it's letting us do, by just doing that reconfigure
00:09:42 - command, alright. So it walked us through everything; reconfigured
00:09:47 - it based on this dpkg reconfigure thing it walked us through the initial process
00:09:52 - and it's a really great way if you mess up your system to go and
00:09:55 - walk back through the original setting so that you can get it
00:09:58 - back. So, that is that is a very convenient tool that you might
00:10:02 - use more often than you'd imagine. But now we're going to move
00:10:05 - onto a more advanced package management system called APT.
00:10:10 - Okay the APT package management system is broken up into a
00:10:13 - couple commands. The first one is apt-get. Now there are a couple of commands
00:10:17 - you put apt-get and then one of these commands. Dist-upgrade is
00:10:21 - going to upgrade to a new like version like say if we're going
00:10:25 - from one version of Ubuntu to the next, this is what you
00:10:27 - do it upgrades.
00:10:35 - So it upgrades versions. You don't want to run this all the time just
00:10:38 - if you're going like from a major revision upgrade.
00:10:42 - Normally what you do if you just want to upgrade your system is type
00:10:45 - upgrade. And that's just going to take if there's any packages that
00:10:49 - have updates like Firefox or you know coreutils or all those
00:10:52 - things it's going to update them to the to the most
00:10:55 - recent version. Install is what you're going to use to
00:10:59 - install a package that's in the repository just like the
00:11:02 - dpkg -i.
00:11:05 - This is how you install things. The difference being that this
00:11:08 - will actually retreive files from a local power from a remote
00:11:11 - repository and get all the dependencies. It's really really
00:11:14 - slick and then remove you can, as you would assume removes.
00:11:18 - It just removes packages. That's what it does so let's look at
00:11:21 - these in action because this is a lot more powerful than than
00:11:24 - you'd think.
00:11:26 - Okay, the first we're going to look at is how it upgrades.
00:11:30 - So let's do APT-get, now you do have to be root to do this.
00:11:33 - You'll notice I'm logging in as root right now. So apt-get upgrade.
00:11:37 - This is going to look through; oh, there are no upgrades available.
00:11:40 - I'm completely upgraded which is great. So the next thing we're
00:11:43 - going to do is learn how to install something. So let's say
00:11:47 - apt-get install. Let's see I like the package gmail-notify.
00:11:55 - I just know that that's a gmail thing that will run. Now here is what I wanted to show
00:11:59 - you. See gmail notify has a bunch of packages that will install.
00:12:04 - All of these are dependencies. Now remember when we tried to install web-min
00:12:07 - it showed us those dependencies but it just complained, didn't really
00:12:10 - do anything about it. Well what this is going to do is actually
00:12:13 - download all those dependencies and install them along with
00:12:16 - gmail-notify. It also has suggestions, sometimes these are helpful
00:12:21 - sometimes not. Sometimes you can look in there and say oh that sounds like
00:12:23 - a cool program and install it. But it will give us a summary
00:12:27 - here. These are all the things it's going to install. So we say
00:12:29 - yes and it'll download all of these things. It goes pretty quick
00:12:35 - and installs it goes through the process. Now look really quick.
00:12:38 - I just want to show you this from a couple of nuggets ago. ldconfig
00:12:41 - remember I said that it's going to reload those dynamic
00:12:44 - libraries every time packages are installed, packages are installed,
00:12:47 - it ran ldconfig so let it, it will do that, so anyway just a flash back
00:12:52 - to a previous nugget to show that I really knew what I was talking
00:12:54 - about there. Anyway, so now this gmail notify program is
00:12:57 - installed. See it can even end up here in the menu; gmail notify,
00:13:02 - pretty slick stuff and I don't really want to set this up.
00:13:05 - But anyway that is how apt-get install works, but let's
00:13:11 - see what else do we have. There's remove right, we looked at remove
00:13:15 - over here. So let's get rid of that gmail-notify. Apt-get remove gmail-notify.
00:13:24 - Do we want to remove it. Yes we do.
00:13:27 - So it's going to remove it. Now you'll notice all of these
00:13:31 - things those dependencies they're no longer needed but it doesn't
00:13:34 - actually uninstall them. So those are going to be there. If
00:13:37 - you really want to there are ways to clean up like you can
00:13:40 - do apt-get
00:13:41 - auto-remove just like it tells us there and yes we want
00:13:46 - to remove all the packages that we don't need any more, okay.
00:13:49 - So that's one way to keep your system cleaned up but it doesn't
00:13:52 - hurt anything to have those extra dependencies installed, alright.
00:13:55 - So now we know how to install stuff how to remove stuff. But
00:13:59 - there's a little bit more to it. There is another tool that
00:14:02 - we're going to look at.
00:14:05 - It's not listed here yet but I'm going to write it in.
00:14:09 - In this there is a little bit of a nuance here. This
00:14:12 - is how you install stuff. However it doesn't check the internet
00:14:15 - when it does this. What you have to do is run the update
00:14:21 - command and what this does is it updates
00:14:29 - from the repositories so it's going to update the local file
00:14:34 - cache if you will. So all of these upgrades and stuff, these
00:14:38 - just look on local files. It doesn't actually pull
00:14:42 - the internet to find out if there's updates available. You have
00:14:45 - to update this manually in order for that to happen. So let's
00:14:48 - look over there and see that in action.
00:14:51 - So back on our computer here. What we're going to apt-get
00:14:53 - and run the update command.
00:14:57 - Now see what it did. It went through and it downloaded all of
00:15:00 - these repositories online. There's a ton of them. We're going to look at those
00:15:03 - in a minute but it ran all those updates. It looks like
00:15:07 - there weren't any since my last update which is good which
00:15:10 - is good and the way we can test that is to run apt-get upgrade.
00:15:16 - Yep turns out there were no new ones installed. But what what
00:15:18 - we did is we know we have now a freshly updated system which
00:15:21 - is, again, you have to use those two tools. They're not all in
00:15:24 - one. You have to update your local database and then upgrade
00:15:29 - your system. It's a little bit confusing and easy to mix up, but
00:15:33 - once you get the hang of it, it's a really great thing
00:15:35 - to use. And then after, now we know how to install, we know how to remove,
00:15:40 - know how to update our local database. But what do we do about
00:15:44 - searching for things. Well that's where the apt-cache (inaudible) command
00:15:49 - comes into play. Well tongue-tied there.
00:15:51 - Okay, so apt-cache;
00:15:54 - now this is the file that is going to
00:15:58 - search the local cache. Now remember I said that it doesn't pull the internet every
00:16:01 - single time. Well what it's going to do it's going to look
00:16:05 - at the local files. If you type atp-cache search, it's going to
00:16:09 - search through those local files. So if there is a keyword in the
00:16:12 - description or the file itself, it'll tell you what package
00:16:15 - that is. I use this all the time to look for
00:16:19 - a package, a specific package I'm looking for. Let's
00:16:22 - see the other command show;
00:16:25 - will show us the information about a file.
00:16:28 - So if we type apt-cache show post fix which we could do it will show
00:16:32 - you that it's the mail server. Depends will tell
00:16:36 - the programs it needs or its dependencies. Now again it'll apt-get
00:16:40 - will install them by default but again this is it'll
00:16:43 - show you the things that are going to be needed in order for that
00:16:46 - to be installed and then rdepends is reverse dependencies
00:16:50 - and if you can wrap your brain around that basically it tells you what
00:16:54 - other packages depend on it. So if you had, if you're installing like
00:16:59 - a Firefox plug-in. Well it'll say the reverse dependencies are
00:17:05 - you know like Firefox and the plug-ins. The plug-in is going to depend
00:17:09 - on Firefox. But Firefox is a reverse dependency for that plug-in.
00:17:14 - So again.
00:17:16 - What programs depend on it in order to be installed. The horrible
00:17:20 - T. So we have the search, show, depends, I'm sorry my IT was
00:17:26 - really bad there and I'm in IT.
00:17:31 - So that's what we're going to look at. So lets look at that in action because this is
00:17:34 - one again I use this all the time.
00:17:38 - So right here at the command line, let's look;
00:17:41 - apt-cache, we'll start with search. This is one I use a lot. We'll search for gmail.
00:17:47 - It gives us this whole list of things.
00:17:50 - Thunder bird, because in the description it talks about how it supports
00:17:53 - gmail. So anything that has gmail in there.
00:17:56 - Where is that gmail-notify program we installed a few minutes ago.
00:18:00 - Gmailfs you can set it up as a file system. Anything that has to do
00:18:03 - with gmail is going to come up with this apt-cache search, okay.
00:18:07 - So next let's look at apt-cache show gmail-notify.
00:18:14 - Now that's going to give us all the information about the package
00:18:17 - gmail-notify. It's really convenient. This looks very similar
00:18:20 - to that dpkg command that we looked at earlier, right.
00:18:23 - But this gives us all the information about it with apt-cache.
00:18:28 - Okay, next let's try
00:18:30 - apt-cache-depends gmail-notify,
00:18:36 - alright. It's going to show us what dependencies it has; wow
00:18:39 - all this stuff. Well now these aren't all dependencies.
00:18:43 - These are things that are recommended. Okay it recommends
00:18:47 - all these things as web browsers, so you can use that to
00:18:50 - check your gmail but the dependencies are listed right here.
00:18:53 - Okay python-gnome2-extras and python-gtk2 so these are the things
00:18:57 - that gmail-notify depends on. Now these could each have dependencies
00:19:01 - as well so you know if you remember it installed like half
00:19:05 - a dozen packages. It's because it only depended on these however
00:19:08 - these depended on something else and some of those could depend
00:19:11 - on something else. It's really good that Apt takes care of all
00:19:14 - those dependencies because that can be a real nightmare and
00:19:17 - then let's do.
00:19:19 - Apt-cache
00:19:22 - rdepends Firefox.
00:19:27 - Alright, this Firefox have any reversed dependencies, oh my goodness
00:19:30 - look at all these. Reverse depends, okay. You cannot install Adobe
00:19:36 - flash plug-in unless you have Firefox installed. That's a reverse
00:19:39 - dependency, alright. Same thing with a bunch of other stuff and all
00:19:44 - this kind of stuff requires that but anyway that's apt-cache.
00:19:47 - Again that apt-cache
00:19:50 - search is the one that you're going to use a lot it's really
00:19:53 - great. But if all this confuses you apt-get and apt-cache there
00:19:57 - is a new kid on the block called aptitude, alright.
00:20:02 - Now aptitude contains all, will handle all the same commands.
00:20:07 - So if we want to install gmail-notify. Just like you
00:20:12 - did before say yes. It's a little bit different but it's very very
00:20:16 - similar to how the other one works. Apt-
00:20:21 - aptitu you can tell I use apt- a lot. Aptitude but now are going to search. Now normally
00:20:26 - you would need apt-cache instead of apt-get but aptitude search
00:20:31 - gmail-notify does the same thing. Okay it finds it, it actually
00:20:36 - gives us a little more information even says that it's installed.
00:20:39 - Alright, so if we were going to look for aptitude search
00:20:46 - kon let see, konsole I don't have kde installed, so it shouldn't
00:20:51 - show us, but see aptitude search konsole doesn't have
00:20:55 - that i. It's not installed right. The package is available
00:20:59 - and it tells us what it is. This also had konsole in it,
00:21:03 - konsolekalendar, konsole personal organizer. So it's going to show
00:21:06 - us all that same stuff that apt-cache would do. So aptitude does anything
00:21:09 - and one last thing it'll do, aptitude if you run it without any
00:21:13 - command line flags or without any arguments it, it boots
00:21:17 - up and starts up this menu based installer thing. Alright, so
00:21:21 - these are twenty five thousand packages not installed you can
00:21:24 - scroll through here and virtual packages, all of these different
00:21:29 - things you can go through and install them with this menu
00:21:32 - based thing. Alright you want to update you just press u. It's going
00:21:35 - to go through and do all that stuff update, load cache, let's, again
00:21:40 - you can look along across the top here and there's all these
00:21:42 - different commands;search, find, search for, gmail.
00:21:49 - It does it in real time;
00:21:51 - notify right there it is, it found it, awesome. It's already installed
00:21:56 - and that's just if you run aptitude on the command line
00:22:00 - sort of in q yes, really, quit.
00:22:04 - Alright, so there's that. Now let's look where the configuration
00:22:07 - files are kept and then we'll be done. Then you'll know how
00:22:10 - to install stuff on a Debian operating system.
00:22:12 - So the configuration files and where the the repositories are
00:22:16 - stored are in this really bizarre format. It's not terribly hard
00:22:19 - but etc/apt/sources.list. This is a text file
00:22:23 - but it shows all of the sources that you're going to download so
00:22:27 - let's go check that file out, alright. We're going to
00:22:33 - vi/etc/sources.list and we'll see this file and there's a bunch of stuff
00:22:36 - comment here, comments you can read here. This is in an Ubuntu
00:22:39 - install and we look deb or deb-src. This is where
00:22:43 - the source files are. This is where just the instalable binary
00:22:46 - packages are. So we have deb and then the web address where it's
00:22:50 - located. The distribution name like this is jaunty, and then
00:22:56 - the actual repositories main and restricted happen to be in
00:23:00 - here and then again down here these are jaunty updates.
00:23:06 - So all of these different areas; the universe repositories, multi verse,
00:23:11 - back ports are commented out. So this is a list of every one of
00:23:15 - these lines is a different repository that it pulls information
00:23:20 - from and it's going to resolve the dependencies between them.
00:23:24 - So it's possible that something from the universe repository is going
00:23:28 - to need something from you know the main; the main repository
00:23:32 - up top right. It might need something from restricted or it might
00:23:35 - need something from main and it's going to resolve dependencies
00:23:38 - across there. But if you have a specialty
00:23:43 - package or special repository, this is where you would put
00:23:46 - it, in this file. So let's say you set up your own, you would add like
00:23:49 - deb http://mysite.com/ whatever
00:23:55 - folders it's kept in, will say ubuntu
00:23:58 - jaunty and let's call it shawn.
00:24:02 - Okay, so that's the name of our new repository.. and
00:24:07 - quit. Now we're probably going to get an error when we update
00:24:11 - get update.
00:24:13 - It's going to say well there something wrong with my site
00:24:16 - shawn packages. What is up with that that's just not right because
00:24:20 - there is no site like that, I made that up.
00:24:22 - But that's how you would add one if you have a third party
00:24:26 - repository that you need to install. That's the place that it would go
00:24:29 - alright. So, let's look back at our original slide make sure we have everything
00:24:32 - covered. Okay so we talked about dpkg, we talked
00:24:37 - about dpkg-reconfigure, which will help you reconfigure a
00:24:40 - package using that initial walk through thing. Talked about the
00:24:43 - apt package management system with apt-get, apt-cache. We
00:24:48 - talked about where the configuration files are kept and what
00:24:51 - format their in; it's a little confusing but at least there's the
00:24:53 - you know you can go from what's there and then we talked about
00:24:56 - aptitude which is kind of the new kid on the block but it's
00:24:59 - a nice alternative to using apt- get and apt-cache. It will take
00:25:02 - all the same flags and then it has that neat menu base thing.
00:25:06 - If you just run aptitude all alone. Alright so that is Debian
00:25:10 - package management in a nutshell. It's a, it's a really great system
00:25:14 - the the dependencies are resolved amazingly well and if you ever
00:25:19 - have to do dpkg stuff, you will greatly appreciate apt.
00:25:23 - But you need to know how to use both and know that Apt will resolve
00:25:26 - dependencies. That's that's really key. So I hope that this has been
00:25:30 - informative for you and I'd like to thank you for viewing.