1. Script / write your own code
2. Download and compile from source code
3. Download and install binaries
4. Use package manager
---
# Script / write your own code
- Stored in your home directory
- e.g. `~/bin`
- Can be included in your personal `$PATH` variable
- Runs only in user space by default
- Relies on the software already installed on the operating system
---
# Download and compile from source code
- Many open software tools are available from public repositories
- Actively maintained projects receive security patches and new features
- It is the user's responsibility to update to the latest version
- Linux distribution independent
- But same restrictions and rules apply as with _"Script / write your own code"_
---
# Download and install binaries
- There are distribution independent binaries and distribution dependent binaries
- Distribution independent binaries are usually a standalone download of a binary file
- Processor architecture (x86, amd64, risc) dependent
- Distribution dependent:
- Red Hat: `rpm`
- Debian: `deb`
- Installation usually requires root permissions
- Consists of a set of files
---
# Use package manager
- Based on binary or source code file formats
- In theory, package managers are distribution independent, but in practice there is a _de facto_ manager for each distribution:
- Red Hat: `dnf` or `yum`
- Debian: `apt-get` or `apt`
- SUSE: `zypper`
- Arch Linux: `pacman`
- Gentoo: Portage / `emerge`
- One manager per operating system
- Using package manager requires root permissons
---
# Package manager
sequenceDiagram
note over Client,Server: Add repository URL
Client->>Client: edit sources.list file
Client->>+Server: Validate repository
Server-->>-Client: Repository OK
note over Client,Server: Update index
Client->>Client: apt-get update
Client->>+Server: Get list of available software
Server-->>-Client: Index (txt)
note over Client,Server: Install software
Client->>Client: apt-get upgrade / install
Client->>+Server: Ask for binary package(s)
Server-->>-Client: Binary package(s)
Client->>Client: dpkg -i binary
---
# Package manager
- Keeps track of installed software and versions
- Commands to easily add, update and remove software
- Typical use is to update software from the internet, but offline sources (e.g. CDs) are also supported
---
# Package manager
- There are less open software repositories, such as Ubuntu's snap
- Some repositories, such as Red Hat's, require also a separate access (paid subscription)
- "Any" URL can be added as a source for software
- Potential security risk
- Operating system trusts and installs software coming from that source
---
# Beyond package managers
- Docker containers
- Flatpak and AppImage
- Python (virtual) environments
- Pip, conda, etc.
# Thank you!
### Basics of Linux