Install packages

From LWP-Wiki
Jump to: navigation, search

It is possible for users to install packages from the standard repositories we provide on their own LWP's. Students (i.e. those logging in with S-numbers) are excluded from this feature, because the PCs in the computer rooms need to diverge as little as possible and new versions of packages can cause trouble with upgrades of Ubuntu provided packages.

If you wish your software to be installed on all LWP's, e.g. because you need it for a course, please fill out this software request form.

We've added many extra repositories, for special packages, but they've been given a lower install priority. We've done this, so you have to deliberately install the package version you want and no accidental installs happen. You can also install anything that can be found in the Ubuntu Software Center.

Here are the most useful commands on the command line.

  • To search for the actual package name:
sudo apt-cache search <name of the program>
  • See the available versions of a package and in what repository with what priority they can be found:
sudo apt-cache policy <package>
  • Installing a package from
1. the standard Ubuntu repositories:
sudo apt-get install <package>
2. the extra repositories:
sudo apt-get install -t o=<origin> <package>
  • With the '-t' option you can provide the <origin> of the package.
1. If you know the repository name, the origin (o=...) can be found in the preferences file of the repository of the package:
cat /etc/apt/preferences.d/<repository_name>.pref
2. If you don't know the repository name, you can use the following commands:
sudo apt-cache policy <package>
sudo apt-cache policy | grep -A2 <package source> | grep -o "o=.*" | cut -d"," -f1 | uniq

e.g. If you would like to install the latest version of Libreoffice on your system. It isn't available from the main repository, but it is available in one of the extra's with a lower (400) priority. (version numbers may differ)

sudo apt-cache policy libreoffice
[sudo] password for <you>: 
  Installed: 1:3.5.7-0ubuntu5
  Candidate: 1:3.5.7-0ubuntu5
  Version table:
     1:4.2.1-0ubuntu1~trusty 0
        400 precise/main amd64 Packages
 *** 1:3.5.7-0ubuntu5 0
        500 trusty-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1:3.5.4-0ubuntu1.1 0
        500 trusty-security/main amd64 Packages
     1:3.5.2-2ubuntu1 0
        500 trusty/main amd64 Packages

We can see that version 1:4.2.1 is the latest, but 1:3.5.7 is installed.
First we'll pretend we don't know the repository file is named libreoffice.* and try to determine the origin of the package with a command:

sudo apt-cache policy | grep -A2 | grep -o "o=.*" | cut -d"," -f1 | uniq

If you do know the file to look in, you can do this:

cat /etc/apt/preferences.d/libreoffice.pref
# libreoffice
Explanation: : libreoffice
Package: *
Pin: release o=LP-PPA-libreoffice
Pin-Priority: 400

The "o=..." parameter is the origin, so now we can install the latest version with the addition of "-t o=LP-PPA-libreoffice" to the normal apt-get command:

sudo apt-get install -t o=LP-PPA-libreoffice libreoffice
<long list of packages and extra packages>
[y/n] y
<even longer list of stuff the system is doing>

It might ask you if you want to keep some configuration files. Usually the default (keep the config file on the system) is the best choise... unless you want to begin with a completely clean install, because of problems. When it's done, you'll have the latest version of Libreoffice installed.