Skip to content

Commit 633b5ab

Browse files
authored
Merge pull request #25 from livialima/update-day15
Close #15
2 parents 5b75935 + bceeee2 commit 633b5ab

1 file changed

Lines changed: 51 additions & 17 deletions

File tree

docs/15.md

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,33 @@ We'll be discussing the "package manager" used by the Debian and Ubuntu distribu
3535

3636
The configuration is done with files under the _/etc/apt_ directory, and to see where the packages you install are coming from, use `less` to view _/etc/apt/sources.list.d/ubuntu.sources_ where you'll see entries that specify repository URIs, suites, and components for your specific version:
3737

38+
```bash
3839
Types: deb
3940
URIs: http://archive.ubuntu.com/ubuntu/
4041
Suites: noble noble-updates noble-backports
4142
Components: main restricted universe multiverse
43+
```
44+
Debian and other Debian-based distributions still configure it directly on _/etc/apt/sources.list_ as one-liners but the parameters are the same:
45+
46+
* Type of package: `deb`
47+
* URI (source): most commonly a web address to pull the packages from
48+
* Suite: codename for the version of the distro, i.e., Ubuntu 24.04 is called Noble, 26.04 is Jammy, and so on.
49+
* Components (the actual repo): what set of packages are you pulling from it, "main" or something extra
50+
51+
Example of an `sources.list` line, pulling `deb` packages from the `main` and `non-free-firmware` repositories for Debian 13 (trixie):
52+
53+
```bash
54+
deb http://deb.debian.org/debian trixie main non-free-firmware
55+
```
4256

4357
There's no need to be concerned with the exact syntax of this for now, but what’s fairly common is to want to add extra repositories - and this is what we'll deal with next.
4458

4559
## EXTRA REPOSITORIES
4660

47-
While there's an amazing amount of software available in the "standard" repositories (more than 3,000 for CentOS and ten times that number for Ubuntu), there are often packages not available - typically for one of two reasons:
61+
Main repositories contain the core, essential packages required for the operating system to function, including the kernel, basic utilities, and critical libraries. And while there's an amazing amount of software available in the those repositories, there are often packages not available because they are considered _non-essential_. They will typically be categorized in distinct repositories based on:
4862

49-
* Stability - CentOS is based on RHEL (Red Hat Enterprise Linux), which is firmly focussed on stability in large commercial server installations, so games and many minor packages are not included
50-
* Ideology - Ubuntu and Debian have a strong "software freedom" ethic (this refers to freedom, not price), which means that certain packages you may need are unavailable by default
63+
* Stability: when new packages are first introduced, an `unstable` repo can act as a rolling release stream, whereas the official support is focused more on `stable` repos like `main` - where the packages are well-tested for bugs and conflicts.
64+
* Ideology: if the software can be offered under a free license ([free as in freedom, not free as in beer](https://www.debian.org/intro/free)) or not; proprietary apps and non-free firmware usually get pushed to separated repositories.
5165

5266
So, next you’ll adding an extra repository to your system, and install software from it.
5367

@@ -65,9 +79,7 @@ Instead, filter out just the packages names using `grep`, and count them using:
6579

6680
These are all the packages you could now install. Sometimes there are extra packages available if you enable extra repositories. Most Linux distros have a similar concept, but in Ubuntu, often the "Universe" and "Multiverse" repositories are disabled by default. These are hosted at Ubuntu, but with less support, and Multiverse: _"contains software which has been classified as non-free ...may not include security updates"_. Examples of useful tools in Multiverse might include the compression utilities `rar` and `lha`, and the network performance tool `netperf`.
6781

68-
To enable the "Multiverse" repository, follow the guide at:
69-
70-
* [Community wiki for command line](https://help.ubuntu.com/community/Repositories/CommandLine)
82+
To enable the "Multiverse" repository, you can follow the [ubuntu community guide](https://help.ubuntu.com/community/Repositories/CommandLine), but you will basically just _add a register for that repo_ in your apt source file.
7183

7284
After adding this, update your local cache of available applications:
7385

@@ -92,26 +104,48 @@ netperf:
92104

93105
## ADDING OTHER REPOSITORIES
94106

95-
Ubuntu also allows users to register an account and setup software in a Personal Package Archive (PPA) - typically these are setup by enthusiastic developers, and allow you to install the latest "cutting edge" software.
107+
Software can still be provided in `deb` package format and not be available in any of the official sources, i.e., it doesn't come from Debian or Ubuntu servers. In those cases, two things are possible:
96108

97-
As an example, install and run the `neofetch` utility. When run, this prints out a summary of your configuration and hardware.
98-
This is in the standard repositories, and `neofetch --version` will show the version. If for some reason you wanted to have a later version you could install a developer's Neofetch PPA to your software sources by:
109+
* Only the `deb` package is provided, and you have to install it manually with `dpkg` (see below)
110+
* The developer company provided a repository source and its [GPG signature key](https://askubuntu.com/a/179237) so you can add a register like this:
99111

100-
`sudo add-apt-repository ppa:ubuntusway-dev/dev`
112+
```bash
113+
Types: deb
114+
URIs: https://brave-browser-apt-release.s3.brave.com
115+
Suites: stable
116+
Components: main
117+
Architectures: amd64 arm64
118+
Signed-By: /usr/share/keyrings/brave-browser-archive-keyring.gpg
119+
```
101120

102-
As always, after adding a repository, update your local cache of available applications:
121+
Normally you will have instructions on how to download and verify the GPG signature (or just a script to do it for you). Again, use common sense and only download from respectable sources.
103122

104-
`sudo apt update`
123+
On another note, [PPAs](https://askubuntu.com/questions/4983/what-are-ppas-and-how-do-i-use-them) (Personal Package Archives) used to be an alternative way to get extra packages that didn't make into official repos but became obsolete after the adoption of modern app stores like Snap and Flatpak.
124+
125+
## APT AND DPKG
126+
127+
So you downloaded a `.deb` file and you want to install it. Can I use `apt` to handle it?
128+
129+
Well, [yes](https://unix.stackexchange.com/a/159114).
130+
131+
The `apt` (Advanced Package Tool) is a high-level package manager that resolves dependencies, while `dpkg` (Debian Package) is a low-level tool that directly handles `.deb` files.
132+
133+
So, you can manually install a `deb` package with either of those options:
134+
135+
```bash
136+
dpkg -i /path/to/package/name.deb
137+
apt install /path/to/package/name.deb
138+
```
105139

106-
Then install the package with:
140+
## PACKAGES OUTSIDE THE DEBIAN/UBUNTU ECOSYSTEM
107141

108-
`sudo apt install neofetch`
142+
But what if the application I want to use is not available for Debian/Ubuntu?
109143

110-
Check with `neofetch --version` to see what version you have now.
144+
You still have a chance! Check if that app is available in **Snap** or **Flatpak**. Those formats are universal and cross-distribution, and each package has its dependencies self-contained. You will have to install Snap to be able to download from the [Snap Store](https://snapcraft.io/store) (centralized, developed by Canonical), or install Flatpak to pull packages from places like [FlatHub](https://flathub.org/) (decentralized, community-maintained ecosystem).
111145

112-
Check with `apt-cache show neofetch` to see the details of the package.
146+
In any case, if the software you are installing is open source, you will most likely have the option to [install it from source](./17.md) as well.
113147

114-
When you next run "sudo apt upgrade" you'll likely be prompted to install a new version of `neofetch` - because the developers are sometimes literally making changes every day. (And if it's not obvious, when the developers have a bad day your software will stop working until they make a fix - that's the real "cutting edge"!)
148+
DISCLAIMER: use a native package or build from source when you can. The self-contained apps from apps stores tend to generate performance and resource overhead.
115149

116150
## SUMMARY
117151

0 commit comments

Comments
 (0)