How do I enable the "backports" repository?

81,870

Solution 1

Ubuntu Backports are enabled by default in Ubuntu.

If for some motive you still don't get the backports use any of these 2 ways:

  1. Click the Ubuntu button on the launcher and search for "Software Sources". Search for "Software" if using 12.04+.

  2. Press ALT+F2 and Type: gksu software-properties-gtk

Any of the 2 Ways will get you to the Software Sources Manager or Software & Updates. In here Activate all 4 options in the Ubuntu Software Tab and in the Updates Tab. This should enable the Extras for your Ubuntu Version.

Ubuntu Software Sources - Ubuntu Software Tab

Ubuntu Software Sources - Updates Tab

After this just click on the CLOSE Button and it should let you know that it needs to update because of the changes you made. Note that in the Updates tab, the Backport option is the 4th one in there. It's the one that says Unsupported updates.

To activate the backports (Which is automatically enabled since 11.10) from the terminal (In cases where you are working on a server and want the backports enabled) do the following after opening the terminal (This example is using Ubuntu 13.04):

sudo nano /etc/apt/sources.list

And look for a commented line that mentions the keyword backport, should look something like raring-backports for 13.04, precise-backports for 12.04 and son. In this case it looks like this:

  ##deb http://archive.ubuntu.com/ubuntu raring-backports main restricted universe multiverse
  ##deb-src http://archive.ubuntu.com/ubuntu raring-backports main restricted universe multiverse

uncomment this lines so they look like this:

  deb http://archive.ubuntu.com/ubuntu raring-backports main restricted universe multiverse
  deb-src http://archive.ubuntu.com/ubuntu raring-backports main restricted universe multiverse

save the file and run the following to receive the backport updates:

sudo apt-get update  
sudo apt-get upgrade

NOTE - If the lines are not found, simply add them and change the name of the version to the one you are using as explained above.

Reference

Solution 2

Command-line/Server Instructions

Backports are enabled by default, here's how you can check to make sure they are turned on.

Ensuring Backports are enabled

To enable the backports manually make sure the following line is in your /etc/apt/sources.list:

deb http://archive.ubuntu.com/ubuntu release-backports main restricted universe multiverse  

Replacing release with the current distribution you are using ( precise for 12.04 for example).

Now the next steps will depend on whether you want apt to always use packages from the backports or whether you want to only use the backports only when manually specified.

Always use the backports..

Ubuntu 11.04 and newer are automatically configured to only use the backports when manually specified. If you want to always use the backports when installing you'll need to add the following lines to /etc/apt/preferences (the file might not exist yet; that's fine):

Package: *
Pin: release a=<release>-backports
Pin-Priority: 500  

Make sure you substitute release with your current release.

Using the backports manually..

If you only want to install packages from the backports when manually specified you'll need to add this to /etc/apt/preferences:

Package: *
Pin: release a=<release>-backports
Pin-Priority: 100  

Again substituting <release> for your current release.

note: You will need root privileges to modify /etc/apt/preferences.

Installing from the backports..

If the backports are configured to be used manually you will need to add /release-backports to the end of the package name when installing a package (substituting release for your current release).

For example, if you're using 12.10 Quantal and have configured the backports for manual install you would install amarok with this command:

sudo apt-get install amarok/quantal-backports  

Source: Ubuntu Backports - Ubuntu Wiki

Solution 3

As a super user run :

apt edit-sources

Then uncomment the deb and deb-src lines that contain backports.

Share:
81,870

Related videos on Youtube

Luis Alvarado
Author by

Luis Alvarado

System Engineer Social Engineer Master in Pedagogy Master in Open Source CCNA Certified Linux Foundation Certified Former Askubuntu Moderator Stack Careers | Linkedin | Launchpad | Ubuntu Wiki - Random SE Stuff - Latin American Members | JC Race Award | Human Robot Award 74

Updated on September 17, 2022

Comments

  • Luis Alvarado
    Luis Alvarado over 1 year

    How to enable the backports repository so I can get newer versions of software?

  • thameera
    thameera over 9 years
    After doing this, I had to tell apt to always use backports as well (as specified in the answer by Seth)
  • Jay _silly_evarlast_ Wren
    Jay _silly_evarlast_ Wren about 8 years
    sudo add-apt-repository -r "deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-backports main restricted universe multiverse " works well
  • MichalHlavacek
    MichalHlavacek over 7 years
    @Jay_silly_evarlast_Wren wouldn't -r remove it?
  • Jay _silly_evarlast_ Wren
    Jay _silly_evarlast_ Wren over 7 years
    Yes, sorry, change that -r to -u if you are on xenial, or remove it entirely on previous ubuntus.
  • fkraiem
    fkraiem almost 5 years
    Changing Apt priority to always use the backports is not recommended by the Backports Team. From the link above: "[T]he Backports Team recommends configuring the package manager to only install backported packages when they are explicitly requested".