Quantcast
Channel: CodeSection,代码区,Linux操作系统:Ubuntu_Centos_Debian - CodeSec
Viewing all articles
Browse latest Browse all 11063

Ubuntu Package Management Part 3: Basic Sources.list Settings

$
0
0

Ubuntu Package Management Part 3: Basic Sources.list Settings

This beginner's guide Part 3 talks about Ubuntu repository address settings in sources.list. By learning this article you understand what is sources.list and how to setup it according to your needs. In Ubuntu, APT will know what repository to access and what packages to download primarily based on your sources.list settings. So sources.list is very essential for your APT system. This article explains the terms (4 "channels" and 4 "rooms"), gives many practical examples, how to edit, and adds summary and references at the end. I use Ubuntu 16.10 Yakkety Yak for example in this article. And this article is a continuation of Beginner's Guide Part 2 Basic Apt-get . I hope this part is easy for everyone to understand.

Subscribe to UbuntuBuzz Telegram Channel https://telegram.me/ubuntubuzz to get article updates directly.

1. Repository

What is repository? A repository is a place storing software packages dedicated for a GNU/linux operating system. Repository is created by the developer of a GNU/Linux operating system, by transforming software from source code into binary, producing a “package” file (.deb) for each software. Repository is located in internet as a server, it allows anyone to download packages. Ubuntu users download software from Ubuntu repository. That is how it works.

To give you more precise sense about Ubuntu repository, notice these facts: every GNU/Linux distribution has its own repository, a repository composed from ten of thousands packages stored in structured directories, Ubuntu repository is divided in 4 channels and each channels divided in 4 rooms, and a repository provides binary and also source code version of each software.

2. Ubuntu Repository “Rooms”

Ubuntu differs from Debian. Debian divides its repository in 3 rooms, while Ubuntu divides its repository in 4 rooms. Debian rooms are 3: main, contrib, and nonfree. Ubuntu rooms are 4: main, restricted, multiverse, universe. These divisions are based on their own policies. What you need to know here is the 4 rooms of Ubuntu repository. To give you the (too-simplified) descriptions of them:

m ain : contains free software, maintained directly by Canonical.

r estricted : contains nonfree software, maintained directly by Canonical.

u niverse : contains free software, maintained by community.

m ultiverse : contains nonfree software, maintained by community.

Note: please notice that this term "room" is from me, this term is unofficial.

3. Ubuntu Repository “Channels”

Ubuntu repository composed from 4 channels, and every channel has 4 rooms mentioned above. Each channel represents how new the software versions inside are. The user is free to choose what channel enabled and also what room inside channel enabled. The 4 channels of Ubuntu repository are:

$release : the standard channel, you can live in Ubuntu by only using this repo.

$release-updates : the software update channel, use this to get new version of a software.

$release-security : the security updates & fixes channel, use this to get security fixes quickly,

$release-backports : the new version from future Ubuntu release, use this to get the far more new version of a software or even new software not existed in previous Ubuntu repo.

Note: please notice that this term "channel" is also from me, this term is unofficial .

4. Ubuntu Codenames

Ubuntu has codename to name each of its releases. Each codename has its own repository. So if Ubuntu has 3 active releases, it means Ubuntu has 3 different repositories. It is important because the user can not use another version’s repository and ultimately because this codename used in sources.list. Here is a list of Ubuntu release codenames starting from 2012 version Ubuntu 12.04:

12.04 = precise

12.10 = quantal

13.04 = raring

13.10 = saucy

14.04 = trusty

14.10 = utopic

15.04 = vivid

15.10 = wily

16.04 = xenial

16.10 = yakkety

17.04 = zapty

5. Mirror

What is mirror? A mirror is a copy of repository located somewhere else in the internet. So there is an official repository, and there are mirrors of official repository; they all are containing exactly the same software packages. A mirror is created typically by some third-parties (individuals, or universities, or companies) willing to help the official GNU/Linux repository available more widely. By providing a mirror, it means that users don’t need to download software packages directly from the official repository, but instead they can download from a local mirror repository in their country.

A mirror created helps the official repository server. It is clearly a form of cooperation. It is because the amount of download connections decreased at official server when many users switch to another mirror.

Being able to edit sources.list settings means able to use local mirror.

6. Sources.list

What is sources.list? A sources.list is a file containing list of repository addresses . APT knows all available packages and where to download them based on settings inside a sources.list. A sources.list file is primarily important for APT and a whole Ubuntu system to install/upgrade software. This file is located at /etc/apt/sources.list .

7. Sources.list.d/

What is sources.list.d/? The sources.list.d/ directory is a system directory containing another secondary sources.list files that store additional or third-party repository addresses. This directory is located at /etc/apt/sources.list.d/ in Ubuntu system.

8. How To Read

There are two ways to read sources.list: one with Terminal, one with GUI.

Terminal way : to read a sources.list with Terminal, perform this command line

$ cat /etc/apt/sources.list | sed '/#/d; /^$/d'

and you should see the sources.list content clearly like this (without comment lines):


Ubuntu Package Management Part 3: Basic Sources.list Settings

GUI way : open the program Software & Updates from Ubuntu menu or run the command line $ software-properties-gtk. You will see the exactly same sources.list settings but in nice GUI options. However, I do not explain the GUI way in this article.


Ubuntu Package Management Part 3: Basic Sources.list Settings
9. How To Edit To edit a sources.list file, you always need root privilege. You can edit sources.list with any text editor program you like. After editing, you should run apt-get update so APT knows the new repository address added. For example,

Viewing all articles
Browse latest Browse all 11063

Latest Images

Trending Articles