8

Let's assume that we are using Ubuntu 18.04 LTS (Bionic Beaver).

I know GUI ways to enable or disable the following repositories:

  1. Important security updates (bionic-security)
  2. Recommended updates (bionic-updates)
  3. Pre-released updates (bionic-proposed)
  4. Unsupported updates (bionic-backports)

In KDE user may want to open Software & Updates (or software-properties-kde) and navigate to Updates tab.
In GNOME, MATE, Xfce user should open Software & Updates (or software-properties-gtk) and navigate to Updates tab for -security, -updates and -backports and Developer options tab for -proposed.

But how to enable or disable -updates, -security, -backports, -proposed repositories from commandline?

Note: I need a solution without direct editing of /etc/apt/sources.list.

Update: I created discussion and poll named "Does Ubuntu need console alternative for software-properties-gtk / software-properties-kde?" on community.ubuntu.com.

N0rbert
  • 103,263

2 Answers2

5

Note: I need a solution without direct editing of /etc/apt/sources.list.

Would using find and sed to comment out the lines be considered direct editing?

To disable these lines:

find /etc/apt -type f -name '*.list' -exec sed -i 's/\(^deb.*-backports.*\)/#\1/; s/\(^deb.*-updates.*\)/#\1/; s/\(^deb.*-proposed.*\)/#\1/; s/\(^deb.*-security.*\)/#\1/' {} +

Alternatively, we can just delete them:

find /etc/apt -type f -name '*.list' -exec sed -i '/-backports/d; /-updates/d; /-proposed/d; /-security/d' {} +

To enable them again:

find /etc/apt -type f -name '*.list' -exec sed -i 's/^#\(deb.*-backports.*\)/\1/; s/^#\(deb.*-updates.*\)/\1/; s/^#\(deb.*-proposed.*\)/\1/; s/^#\(deb.*-security.*\)/\1/' {} +
aguslr
  • 1,836
-1

Best way to do this is:

sudo nano /etc/apt/sources.list

And uncomment the lines/sources you need.

An0n
  • 2,225