Package Management Basics

Session Logs

   1 [15:00] <nigelb> Next up, we have Sense Hofstede to talk about package management
   2 [15:01] <nigelb> Sense Hofstede is a secondary school student from the Netherlands contributing to several areas of Ubuntu.
   3 [15:01] <nigelb> He's mostly active in the One Hundred Paper Cuts and Application Indicators projects, and is in Ubuntu Bug Control and Ubuntu NL.
   4 [15:01] <qense> Hello everyone!
   5 [15:01] <qense> I'm Sense Hofstede and this session is about package management.
   6 [15:02] <qense> Questions go into #ubuntu-classroom-chat . Make sure you start the question with 'QUESTION:', otherwise I won't notice it.
   7 [15:02] <qense> This session I'm going to show you:
   8 [15:02] <qense>  * How to use the Ubuntu Software Centre
   9 [15:02] <qense>  * How to use the command-line tool apt-get
  10 [15:02] <qense>  * How to add a PPA
  11 [15:02] <qense> But first let me explain what package management actually is, so you'll have a better understanding of the subject.
  12 [15:03] <qense> abhi_nav asked whether you need to be in an admin acount for this session. That is not required (and also not recommended), although we do need our password later on.
  13 [15:03] <qense> back to package management
  14 [15:03] <qense> The way we manage software in Ubuntu is fundamentally different from the way software is managed in, say, Windows or Mac.
  15 [15:03] <qense> In Ubuntu we have a central place from which you fetch the applications you want. Actually, you can add more 'central places', but that's for later.
  16 [15:03] <qense> Ubuntu's software is stored on a server, which publishes a list of the software it provides. This information is read by APT, the underlying system for package management on your system.
  17 [15:04] <qense> The main server is archive.ubuntu.com, but many countries have at least one 'mirror'
  18 [15:05] <qense> A 'mirror' is a copy of the main archive server that offers exactly the same, but is located in another place. This takes load of the main server and improves local accessibility.
  19 [15:05] <qense> When you tell the computer to install an application it downloads the application in the form of one or multiple 'packages' from the server and installs it.
  20 [15:05] <qense> If there is a new version of the application made available on the server, Update Manager will notify you.
  21 [15:06] <qense> OK, now the Software Centre.
  22 [15:06] <qense> The Software Centre is one of the tools you can use to install applications on your computer.
  23 [15:06] <qense> I hope you all know where to find the Software Centre! It is located under Applications->Ubuntu Software Centre. Now, there is a lot of development being done on the Software Centre right now, so if anyone here is running the
  24 [15:06] <qense> alpha release (Maverick), then (s)he will see this: <http://people.ubuntu.com/~qense/software-center.png>.
  25 [15:06] <qense> I, however, will be focussing on the stable release: Ubuntu 10.04 Lucid Lynx, which has got an older, but more stable release of the Software Centre.
  26 [15:07] <qense> Please open the Software Centre and when hen you've opened it, please take a look at the window. You can see the different categories and the pane on the left that shows the different software sources.
  27 [15:07] <qense> At the top left there is a search box. Look around a bit.
  28 [15:07] <qense> Are there any questions about it?
  29 === Don is now known as Guest37008
  30 [15:08] <qense> None? Good.
  31 [15:08] <qense> At the top of the main window you can see the large 'Featured Applications' button. We're going to take a closer look at that. Press it.
  32 [15:09] <qense> You now see a list of applications that was composed by the Desktop Team. These applications are 'featured'.
  33 [15:09] <qense> That means we'd like to bring them to your attention. They are not included by default, since they might not be useful to everyone, but they are of great quality.
  34 [15:09] <qense> Have you heard before of the applications you see there?
  35 [15:10] <ClassBot> abhi_nav asked: on what criteria these aps are called 'featured'? how they differ from other aps?
  36 [15:10] <qense> abhi_nav: The Desktop Team looks at applications that are stable, well developed, easy to use and that fit well in Ubuntu.
  37 [15:11] <qense> They should offer functionality that would be useful to a reasonable group of users.
  38 [15:12] <qense> Lets take a closer look at Liferea, an RSS reader. When you select an application in the row you see two buttons: 'More Information', and 'Install'. Press 'More Information'.
  39 [15:12] <qense> You should now see a description of the application, a link to its website, a screenshot -- screenshots aren't always up-to-date -- and an 'Install' button. That button will turn in a 'Remove' button when the application is installed.
  40 [15:12] <qense> Do you all see a screenshot?
  41 [15:12] <qense> If you want to see how installation goes, press the 'Install' button. You should get a dialogue that asks for your password and then the Software Centre should proceed with installing.
  42 [15:13] <qense> In the left sidebar you should be able to follow the progress of the installation.
  43 [15:14] <qense> This is how you install all applications in the Software Centre. You can even queue applications to install by just pressing the Install button while another application is being installed.
  44 [15:14] <ClassBot> x_buntu_er asked: should I ever install an app that is not in package manager?
  45 [15:15] <qense> x_buntu_er: You can install software that is not provided via the package manager (neither the Software Centre nor the more advanced Synaptic), but of course only when you know what you're doing. The software repositories provide a safety barrier as well as making receiving updates easier because you know where the applications come from (us). You don't know that when you download an application from a random site.
  46 [15:15] <qense> The Ubuntu Software Centre was designed to make it easy for everyone to install applications. Features that will be introduced in the next release of Ubuntu -- Ubuntu 10.10 Maverick Meerkat -- are, amongst others, installation history, microblogging integration and probably even some paid applications.
  47 [15:16] <qense> Any questions so far about the Software Centre?
  48 [15:16] <qense> Do you understand how it works and know where to find software?
  49 [15:16] <qense> good
  50 [15:17] <qense> Not everything that happens when APT installs an application is shown in the Software Centre. However, that also makes it less powerful.
  51 [15:18] <qense> If you want a more powerful tool you could use 'Synpatic' -- System->Manage->Synaptic Package Management -- or you could use the command line tools 'apt-get' and 'apt-cache'.
  52 [15:18] <qense> I'll explain the command line tools here, since I believe 'Synaptic' is easy enough to learn on your own once I've told you how to use apt-get.
  53 [15:19] <qense> You'll need a console to follow this. You can find a terminal at Applications->Accessories->Terminal and for the Lernid users there also should be a tab in Lernid that contains a terminal. Make sure that either of the two are available.
  54 [15:20] <qense> With the command 'apt-cache' you can search for applications that are available. A bit like the Software Centre works, but without categories and no packages are hidden.
  55 [15:20] <qense> Lets try to find the package 'pi' using 'apt-cache'.
  56 [15:20] <qense> You can search for packages using the command 'apt-cache search {search term}'.
  57 [15:21] <qense> You don't need 'sudo' for apt-cache since that command only reads and doesn't change your system.
  58 [15:21] <qense> Lets see what happens when we execute the command 'apt-cache search pi'.
  59 [15:21] <qense> execute that command
  60 [15:22] <qense> That is a huge list! How can we ever find what we want in there?
  61 [15:22] <qense> Oh no!
  62 [15:22] <qense> You should know that 'apt-cache search' is equal to searching in Name and Description in Synaptic. So you get a lot of results. Try again with 'apt-cache search --names-only pi'.
  63 [15:22] <qense> Execute 'apt-cache search --names-only pi'
  64 [15:23] <qense> Still a large list!
  65 [15:23] <qense> Fortunately we can refine our search using a 'regex'.
  66 [15:24] <qense> A 'regex' is very complicated, so I won't tell you all about it now.
  67 [15:24] <qense>  An example of a regex would be '^pi$'.
  68 [15:24] <qense> The '^' character indicates that the next character -- here a 'p' -- is the first character in the package names.
  69 [15:24] <qense>  The '$' sign tells that the previous character -- here a 'i' -- is the last character in the package names.
  70 [15:24] <qense> Understood?
  71 [15:24] <qense> The command 'apt-cache search --names-only ^pi$' returns only one result 'pi'. Without the dollar-sign you'd get a lot more, since there are quite a few packages whose names start with 'pi'.
  72 [15:25] <qense> try it
  73 [15:25] <qense> Does it work for everyone?
  74 [15:25] <qense> ok
  75 [15:25] <qense> The 'apt-cache' version of 'More Information' is 'apt-cache show'. To get the description of 'pi', use the command 'apt-cache show pi'.
  76 [15:25] <qense> You can see a lot of details here.
  77 [15:27] <qense>  Most of it isn't interesting, but please note the field 'Source:'. It gives us the 'source package', and bugs on Launchpad always have to be reported against the source package. So you can't file bugs against 'pi' on Launchpad, but you have to file them against the source package 'cln'.
  78 [15:27] <qense> 'Source: cln' means that the source package for 'pi' is 'cln'.
  79 [15:28] <qense> You see, when an application is compiled (translated from a programming language to computer language) and put into packages it can be put in multiple packages.
  80 [15:29] <qense> Example: we have the 'gnome-panel' source package for the panel you see in Ubuntu, but two of the many packages it generates are 'gnome-panel' and 'gnome-panel-data'.
  81 [15:29] <qense> cln is probably a mathematics library. A library is a collection of several functions/code snippets that can be reused by different applications.
  82 [15:30] <qense> At the bottom of the result of the command 'apt-cache show pi' you see the description and a link to the website of the project.
  83 [15:30] <qense> Now, lets install the package. This is done with the command 'sudo apt-get install pi'. You get promted if you want to install its dependencies as well.
  84 [15:30] <qense> In Ubuntu we split packages in several parts, which allows applications to reuse each others parts. APT automatically fetches dependencies when you install a package.
  85 [15:30] <qense> execute 'sudo apt-get install pi'
  86 [15:31] <qense> Does the installation goes correctly for all of you?
  87 [15:31] <qense> The package should be installed in a matter of seconds. If you want to use it: command 'pi'.
  88 [15:32] <qense> Do you have any questions about installing an application?
  89 [15:34] <qense> We've all got the chance to see π, now we want to remove 'pi' again. Execute the command 'sudo apt-get remove pi' to do so.
  90 [15:36] <qense> Hey! Do you remember the dependencies we installed at when we installed 'pi'? They weren't removed when we removed 'pi'!
  91 [15:36] <qense>  We don't need them anymore, so lets get rid of them. The command 'sudo apt-get autoremove' removes all dependencies -- so nothing you chose to install yourself -- that aren't necessary anymore.
  92 [15:36] <qense> however, beware when executing that command, because it might also uninstall other software
  93 [15:37] <qense> Most of it you probably don't need, because they're redundant dependencies anyway, but you should check them anyway.
  94 [15:37] <qense> you can always abort removing them by entering any other character than 'Y' when asked for confirmation.
  95 [15:38] <qense> Do you understand removing an application?
  96 [15:39] <qense> Any other questions so far?
  97 [15:40] <qense> OK, last stop: adding PPAs (and other software sources).
  98 [15:41] <qense> but first a question!
  99 [15:41] <ClassBot> Marceau asked: I had some problems with the regex ^pi$
 100 [15:41] <qense> <Marceau> QUESTION: I get the error 'unable to locate package', my full command was apt-cache show ^pi$
 101 [15:41] <qense> Marceau: That is because you can only use a regex when searching for a package.
 102 [15:42] <qense> A regex is a way of narrowing the possible results. However, when you use 'apt-cache show' you ask specifically for information of one package.
 103 [15:42] <qense> You have to know the exact package name for that, and that is 'pi' in this case.
 104 [15:43] <qense> Marceau: if you would be searching for gnome packages you could use the command 'apt-cache search ^gnome' to get all packages that start with 'gnome'. However, you still get several results here.
 105 [15:44] <qense> If you want to know more about say 'gnome-panel' you use the command 'apt-cache show gnome-panel'.
 106 [15:44] <ClassBot> Marceau asked: is there a way to see a version number with apt-get?
 107 [15:45] <qense> Marceau: good question. Yes you can. You should be able to see the version of a package when you use the command 'apt-cache show pi', but there it is hidden under a lot of other information,.
 108 [15:45] <qense> Another command is 'apt-cache policy pi'.
 109 === shadeslayer_ is now known as evilshadeslayer
 110 [15:45] <qense> That command shows all different versions of 'pi' that are available form all your listed software sources.
 111 [15:45] <qense> There is an asterisk in front of the installed version.
 112 [15:46] <qense> back to adding software sources now!
 113 [15:46] <qense> Sometimes you want to get a newer version of an application, or you want to get an application that isn't available (yet) from Ubuntu's main software sources.
 114 [15:46] <qense> There are PPAs at Launchpad, but there are also non-PPA software sources, like Google's and Dropbox'.
 115 [15:47] <qense> I'm using the Getting Things GNOME PPA as an example here, but you can use any PPA you want.
 116 [15:47] <qense> The Getting Things GNOME daily builds PPA can be found at <https://launchpad.net/~invernizzi/+archive/gtg-daily>. Its PPA string is 'ppa:invernizzi/gtg-daily'. Remind that.
 117 [15:47] <qense> you don't have to use this PPA if you don't want to.
 118 [15:47] <qense> First the graphical way: you need to get launch 'Software Sources'. There are multiple ways to get there.
 119 [15:48] <qense> You can go to System->Manage->Software Sources.
 120 [15:48] <qense> In the Ubuntu Software Centre you can go to Edit->Software Sources.
 121 [15:48] <qense> In Synaptic go to Preferences->Repositories.
 122 [15:48] <qense> Have you all launched Software Properties?
 123 [15:48] <qense> Or Software Sourecs
 124 [15:48] <qense> Software Soures
 125 [15:48] <qense> ahem
 126 [15:48] <qense> nvm
 127 [15:49] <qense> All the three ways mentioned above will give you the same window. In that window, go to the tab 'Other software' and press the 'Add' button. Normally the strings you paste in here look something like 'deb http://archive.ubuntu.com/ubuntu maverick main'.
 128 [15:49] <qense> or deb http://dl.google.com/linux/deb/ stable non-free main
 129 [15:49] <qense> However, in order to make it easier for you add a PPA, the PPA strings are also accepted.
 130 [15:50] <qense> Paste the PPA string -- 'ppa:invernizzi/gtg-daily' in the Add dialogue.
 131 [15:50] <qense> and press OK
 132 [15:50] <qense> Next you need to download its GPG key file (GPG keys are used to verify the authenticity of packages) from <http://keyserver.ubuntu.com:11371/pks/lookup?search=0x3A6999133B6742CEAF7892AEFDC5315E8E9775D1&op=index>.
 133 [15:50] <qense> You can find the link to GPG keys under the heading 'Signing key:' in the 'Technical details about this PPA' section of the PPA's information page.
 134 [15:50] <ClassBot> There are are 10 minutes remaining in the current session.
 135 [15:50] <qense> Safe the key as a text file.
 136 [15:50] <qense> In Software Sources or Software Properties go to the 'Authentication' tab and press the 'Import Key File' button. Navigate to the key file you just downloaded and import it.
 137 [15:50] <qense> When you close the Software Properties window it asks you to reload the local copy of the catalogue of available software. Press 'Reload'.
 138 [15:51] <qense> The other way, the command line way is much faster:
 139 [15:51] <qense> To add the Getting Things GNOME PPA to your software sources execute the following command:
 140 [15:51] <qense> 'sudo add-apt-repository ppa:invernizzi/gtg-daily'
 141 [15:51] <qense> and then reload the local software catalogue with
 142 [15:51] <qense> 'sudo apt-get update'.
 143 [15:51] <qense> The GPG key was automatically fetched by the first command.
 144 [15:51] <qense> Everyone got that?
 145 [15:51] <qense> When you go the the Ubuntu Software Centre you should now see the PPA appear in the left sidebar. You might also have updates available in the Update Manager.
 146 [15:52] <qense> Alternatively you can also update your system with the commands 'sudo apt-get upgrade' or 'sudo apt-get dist-upgrade'. However, please be very careful when using the last command since it might remove vital system packages if you don't know what you're doing and  a bad update has been released, or a non-bad update isn't fully released yet.
 147 [15:53] <qense> OK, this was all I wanted to tell. Any questions about PPAs, or package management in general?
 148 [15:53] <qense> How was the session? Easy to follow? Too much information or too little? Too fast or too slow?
 149 [15:54] <qense> thank you all
 150 [15:54] <qense> This was this session! Thank you for attending. If you've got any questions left, or come up with questions later, feel free to PM me or go the the IRC support channel #ubuntu . You can also mail me at <qense@ubuntu.com>.
 151 [15:55] <qense> I won't be in the #ubuntu IRC channel, but there are a lot of very helpful other people there.
 152 [15:55] <ClassBot> XuMuK40 asked: thank you, qense, everything was clear
 153 [15:55] <ClassBot> There are are 5 minutes remaining in the current session.
 154 [15:55] <ClassBot> theneoindian asked: I tried to remove a kde app with apt-get remove and almost all other kde apps are removed with it . can u comment on dat ?
 155 [15:56] <qense> theneoindian: What KDE application did you try to remove?
 156 [15:56] <qense> theneoindian: The application you tried to remove might have been required by other vital KDE components.
 157 [15:59] <qense> theneoindian tried to remove KTorrent.
 158 [15:59] <qense> it could have been that the removal of ktorrent removed kubuntu-desktop.
 159 [15:59] <qense> Kubuntu-desktop depends on the core KDE packages, but without kubuntu-desktop installed those dependenceis are not necessary anymore.
 160 [16:00] <qense> They are marked for removal because they weren't installed manually.
 161 [16:00] <qense> list dependencies with apt-cache depends package name
 162 [16:00] <qense> other way around "apt-cache rdepends package"

UserDays/07102010/Package Management Basics (last edited 2010-07-10 16:38:24 by 99-21-107-94)