Package Management Basics

- by

Things that will be taught are:

  • Ubuntu Basic functions of apt-get and aptitude

    Ubuntu Usage of Ubuntu Software Center

    Ubuntu Instructing on performing a safe dist-upgrade

    • We won't actually be doing a dist-upgrade during the session

    Ubuntu Adding PPA's and other Debian repositories through Software Sources and manual text editing through terminal

    • A part of this is enabling the Universe and Multiuniverse repositories. That will also be covered.

We will test:

  • Ubuntu Installing and removing the package pi

The session will close with:

  • Ubuntu Final thoughts and questions

Tests will be performed at the end of the session, to get in the knowledge part first before the testing, just in case we run out of time.

Session Logs

   1 [00:03] <cjohnston> We have a little change in plans...
   2 [00:03] <cjohnston> One of our instructors has been unable to make it..
   3 [00:03] <cjohnston> So starcraftman has volunteered to teach this next course on the fly
   4 [00:04] <cjohnston> If anyone ever finds starcraftman in person (although I still think he is a bot) please buy him a beer for me!
   5 === cjohnston changed the topic of #ubuntu-classroom to: Ubuntu Classroom || Ubuntu User Days | Current Session: Package Management Basics ~~ Presented by starcraftman || Please ask questions in #ubuntu-classroom-chat || Ubuntu User Days Survey:
   6 [00:04] <starcraftman> Hi people, it is I again.
   7 [00:05] <starcraftman> I don't have this prewritten, well... not parcelled out in an IRC format to copy paste.
   8 [00:05] <starcraftman> So it'll be slower. And more manageable, it is a favourite topic of mine talking about package management though. An important topic.
   9 [00:06] <cjohnston> Everyone say thank you starcraftman !
  10 [00:06] <starcraftman> Unlike last class I don't mind if you ask questions during this session, but I'd probably prefer if you waited till I finished a particular section.
  11 [00:08] <starcraftman> Same format for them. Now hmmm. I've already written a fairly long guide on installing, since it covers pretty much all this stuff and saves me some typing I'm going to link you to it. I'll still be writing of course, but you can read along my more verbose explanations. It's a little old but is still completely relevant.
  12 [00:09] <starcraftman>
  13 [00:09] <starcraftman> So starting with basics.
  14 [00:10] <starcraftman> package mangement is the means Ubuntu (and linux in general) uses to install software. Linux uses a client server model as with most other things. Your computer is the client, and it requests information on packages from the Ubuntu servers.
  15 [00:11] <starcraftman> The server contains a whole assortment of packages in a variety of categories, it can tell when your's are out of date for instance and what has changed since you last checked in.
  16 [00:12] <starcraftman> The server itself stores deb packages, which you can think of like exes. They are precompiled binaries ready to be installed on any system that requests to download and install them.
  17 [00:13] <starcraftman> The way your local machine tracks what servers to request the information from is called the sources file. It basically simply lists the addresses of the servers and what sections of packages to retreive.
  18 [00:15] <starcraftman> So, apt an be thought of as a backend. It handles the request and you can use it to install and manage packages quite simply. apt-get and aptitude aren't so different, just two ways to get at the server/packages.
  19 [00:15] <starcraftman> We should probably move to hands on, makes it clearer.
  20 [00:16] <starcraftman> Ok, there's two ways to see your sources file, by graphical interface or text editor.
  21 [00:16] <starcraftman> First open System > Admin > Software Sources.
  22 [00:17] <starcraftman> k, so now that folks done that... I'll go through this list so people understand. As I said before packages are seperated by category.
  23 [00:18] <starcraftman> On the first tab, Ubuntu Software, you can find several of the most important. Conical-supported open Source Software (main) is like it says. All core packages to Ubuntu are stored here, never uncheck this.
  24 [00:19] <starcraftman> (universe) holds projects are are mostly maintained by the community at large. Most software that isn't installed by defualt but maintained by community is here.
  25 [00:19] <starcraftman> restricted holds restricted drivers as you'd imagine. There was a session earlier on that.
  26 [00:19] <starcraftman> multiverse is more of a catch all for things not falling above and that may be restricted.
  27 [00:20] <starcraftman> You should go ahead and tick all of these. Good to have.
  28 [00:20] <starcraftman> Source code is optional, it lets you download the uncompiled source. It's not for installation. Unless your a programmer, don't check it.
  29 [00:20] <starcraftman> download from allows you to pick a better server to fetch packages from, I always change from default.
  30 [00:21] <starcraftman> If you select other from drop down you can select a close geographic server or push pick best.
  31 [00:21] <starcraftman> Next move to Updates.
  32 [00:21] <starcraftman> Tab that is.
  33 [00:22] <starcraftman> These are mostly self-explanitory, security and recommended updates are as they say for security and general bugs (not related to security).
  34 [00:23] <starcraftman> pre-release includes updates that haven't been fully tested (like the bleeding edge). Unsupported is more of a backporting thing. It's nothing to be afraid  of means that software is pushed backwards from newer releases into yours. This isn't officially supported though, odd times it can break things.
  35 [00:24] <starcraftman> Whether you want to tick the last two is up to you, productions machines where stability important I'd say no.
  36 [00:25] <starcraftman> Last theory part to cover quick is keys.
  37 [00:26] <starcraftman> These are just used for authentication. Paultags explanation and mhall should have explained why encryption and trusted software are important.
  38 [00:26] <starcraftman> Now you can push close on the software sources tell it not to reload sources. We'll do that in a moment.
  39 [00:27] <starcraftman> Open a terminal please, Applications > Accessories > Terminal.
  40 [00:27] <starcraftman> now I assume you already got some basics on commands, so copy what's in quotes from now on to terminal and push enter.
  41 [00:27] <starcraftman> "sudo apt-get update"
  42 [00:29] <starcraftman> This refreshes your local cache of the packages on the server. You do this to know when server has got new updates (though as you noticed, it will automatically update you daily if your forget or at least prompt).
  43 [00:29] <starcraftman> "sudo apt-get upgrade"
  44 [00:29] <starcraftman> if you do that you'll find a list of possible upgrades to common software already installed on your machine.
  45 [00:29] <starcraftman> It lists packages to be upgraded/removed/installed.
  46 [00:30] <starcraftman> You have to push yes or no. At this time, push no.
  47 [00:30] <starcraftman> It would take a while and tie you up.
  48 [00:31] <starcraftman> Now, let's install some package.
  49 [00:32] <pleia2> starcraftman: wanna take some questions?
  50 [00:32] <starcraftman> pleia2: first I'd like to install a package. After O
  51 [00:32] <starcraftman> i'll take a few before continuing.
  52 [00:33] <starcraftman> so lets see, hellow had pi listed for install, works for me.
  53 [00:33] <starcraftman> The standard command to install a package is "sudo apt-get install package package2 package3"
  54 [00:33] <starcraftman> where you replace package with whatever you want to install.
  55 [00:33] <starcraftman> try "sudo apt-get install pi"
  56 [00:33] <starcraftman> push yes when it asks for confirm.
  57 [00:34] <starcraftman> It pulls down the package from server and then installs locally to your root.
  58 [00:34] <starcraftman> (pi package is used to compute a more precise pi btw)
  59 [00:35] <starcraftman> now if I wanted to remove I could do "sudo apt-get remove pi"
  60 [00:35] <starcraftman> or "sudo apt-get purge pi"
  61 [00:35] <starcraftman> The latter will remove configuration files for the program as well as the cached package on your system.
  62 [00:35] <starcraftman> Remove just uninstalls it.
  63 [00:36] <starcraftman> Ok, lil question break now. I covered the bulk of this, will get to adding repositories and gui after.
  64 [00:37] <starcraftman> pleia2: poke, you gonna paste them in?
  65 [00:37] <pleia2> < AndreMorro[BR]> QUESTION - starcraftman if I change my repos, shouldn't I first do the 'apt-get update' before 'upgrade' ??
  66 [00:39] <starcraftman> AndreMorro[BR]: Yes, always. When you modify the sources list in any way, your changing what apt needs to monitor. You need to update before it will be aware of these changes.
  67 [00:39] <pleia2> < Out_Cold> QUESTION how do you find info about a package you want to install via apt?
  68 [00:39] <starcraftman> Out_Cold: This is a good question. You can easily from terminal. "aptitude show packagename"
  69 [00:40] <starcraftman> This will provide a large amount of information.
  70 [00:40] <pleia2> < AndreMorro[BR]> QUESTION you recommend apt-get or aptitude
  71 [00:40] <pleia2> < AndreMorro[BR]> or depends on the situation?
  72 [00:41] <starcraftman> Out_Cold: oh and you can also do it with "apt-cache showpkg packagename". Another way.
  73 [00:42] <pleia2> and related... < jazz_> Question  what is the difference between aptitude and apt-get?
  74 [00:44] <starcraftman> AndreMorro[BR]: ah good question. You know even after all this time I'm not perfect on the minutia separating. In general, they can be used interchangeably. They have a few minor differences. I think apt-get in general is preferred. One clear difference is using the search command. "aptitude search" will do a live search against a repository server where "apt-cache search package" will do a local search.
  75 [00:44] <starcraftman> In general, I stick to apt-get.
  76 [00:44] <pleia2> < stevesmith1983> QUESTION if you apt-get remove, is there any way to the purge in the future, without reinstalling the package first?
  77 [00:45] <starcraftman> stevesmith1983: yes, if you haven't, you can do a purge command on something you know has traces left on a system.
  78 [00:46] <starcraftman> I should probably get to adding sources section now.
  79 [00:46] <pleia2> please do
  80 [00:46] <starcraftman> It is pretty easy. Please run:
  81 [00:46] <starcraftman> "sudo gedit /etc/apt/sources.list
  82 [00:46] <starcraftman> "
  83 [00:47] <starcraftman> this opens your sources file. Nothing scary. here you can see how it's formatted. This is the file we modified with the gui earlier.
  84 [00:47] <starcraftman> deb lines are for actual packages, deb-src indicate sections just for source files.
  85 [00:47] <starcraftman> The ## are commented out lines.
  86 [00:48] <starcraftman> This prevents apt from parsing these lines as servers.
  87 [00:48] <starcraftman> for a test add I think we will add the lernid ppa.
  88 [00:49] <starcraftman>
  89 [00:50] <starcraftman> Push technical details please. Then copy the first line with deb to the end of the file.
  90 [00:50] <starcraftman> Make sure its for your version of ubuntu.
  91 [00:50] <starcraftman> Save and close the file after.
  92 [00:51] <starcraftman> Now, we need to import the key. I usually do this by command, it combines downloading and adding the keys.
  93 [00:52] <starcraftman> the generic command is: wget -q -O- | sudo apt-key add -
  94 [00:52] <starcraftman> first half downloads the key, then adds it to your keys.
  95 [00:53] <starcraftman> click on the signing key on the technical drop down.
  96 [00:53] <starcraftman> here your taken to a direct link to the key's hosting, you use this address.
  97 [00:54] <starcraftman> so the command would be: "wget -q CBDC2730 -O- | sudo apt-key add
  98 [00:55] <starcraftman> Hope that works, the end is all required, it's the public ID for the key.
  99 [00:55] <starcraftman> now you have key, you can update and then do a search for lernid.
 100 [00:55] <starcraftman> It should now be a package avialable to install.
 101 [00:56] <starcraftman> you don't need to install it, but this is an example of how to do so. Be careful where you get software from. As paultag covered.
 102 [00:56] <starcraftman> Last we'll just have a look at the software centre quick.
 103 [00:57] <starcraftman> pleia2: can you tell where it is in menu? I'm on my kde box.
 104 [00:57] <pleia2> I think it's under applications, where add/remove used to be
 105 [00:57] <nigel_nb> Its on applications > Software Center
 106 [00:58] <starcraftman> It's a nice GUI, much friendlier than synaptic. Here you can navigate by categories, read descriptions and install software.
 107 [00:58] <starcraftman> Search is in top right, under edit you can get to sources, and view lets you switch between all and just canonical software (Ubuntu and sattellites rather than uni/multiverse)
 108 [00:59] <starcraftman> installed software section lets you remove installed.
 109 [00:59] <starcraftman> it's pretty easy.
 110 [00:59] <starcraftman> Hmmm, I think that about does it, covered the basics and how to use GUI. And I seem almost out of time.
 111 [00:59] <pleia2> thanks starcraftman!
 112 === cjohnston changed the topic of #ubuntu-classroom to: Ubuntu Classroom || Ubuntu User Days | Current Session: Using Ubuntu One ~~ Presented by shrini || Please ask questions in #ubuntu-classroom-chat || Ubuntu User Days Survey:
 113 [01:00] <starcraftman> < Lemme just post that again. Good guide.
 114 [01:00] <starcraftman> Should clarify any lingering questions, I'll hang around chat to answer.

UserDays/01232010/PackageManagementBasics (last edited 2010-01-24 01:06:49 by alderaan)