Package management is the process of installing, updating and removing software, tools and libraries.
On GNU/Linux systems, package management is usually done with a package manager. 

# MatterLinux Package Manager 
In a Matter system, package management is generally done with the MatterLinux Package Manager (`matt`).
`matt` lets you install, remove, update and search different MatterLinux packages across different [pools](/wiki/pools).

### Installation
`matt` should be already installed on a MatterLinux system. However if you want to install `matt` from
the source, then you should follow [this section](https://git.matterlinux.xyz/matter/matt#installation) 
from the README.

> **Note** 
>
> You should run all the `matt` and related commands as the root user.

### Configuration
Configuration file for `matt` can be found at `/etc/matt/config.ini`. This file is used specify pools and 
configure general settings.

Here is the configuration shipped with the MatterLinux 24 releases:
```
# configuration file for matt, please see the wiki page for more information
# https://matterlinux.xyz/wiki/matt

tmpdir = /var/lib/matt/temp
datadir = /var/lib/matt/data

[base]
url = mptp://stable.matterlinux.xyz/base
# url = mptp://next.matterlinux.xyz/base

[desktop]
url = mptp://stable.matterlinux.xyz/desktop
# url = mptp://next.matterlinux.xyz/base

# [server]
# url = mptp://stable.matterlinux.xyz/server
# url = mptp://next.matterlinux.xyz/server
```
Lets start by breaking down the first section:

- `tmpdir (path)`: Temporary storage directory. Used for extracting temporary files and usually
this directory will be cleaned after an operation.

- `datadir (path)`: Persistent storage directory. Used for storing package databases and pool
information.

Next sections specify the pools. Section name is the pool name, and it **should match with the 
actual pool name**. Pool options are:

- `url (URL)`: Pool URL, only `mptp` protocol is supported.
- `signing (yes/no)`: Enable/disable PGP signature verification for the pool, by default it's enabled.

> **Important** 
>
> Do NOT disable signature verification if you don't know what are you doing! There is no 
> way to confirm the legitimacy of the packages without signature verification!

### Options 
`matt` also has a few other options that you specify as an arguments/parameters. You can list these
options using the `--help` option:
```
# matt --help
```
You can also list options for specific commands, for example:
```
# matt info --help
# matt list --help
```
 
### Syncing pools
To sync remote pool information and package lists, you can use the `sync` command:
```
# matt sync
```
After syncing remote pools, `matt` will provide public keys for the available pools.
You can add these keys to your keyring with `gpg`:
```
# gpg --receive-keys [fingerprint]
```

### Installing packages 
To install a package, you can use the `install` command:
```
# matt install which
```
After running this command `matt` will attempt to find, download and verify the `which`
package, and then install it.

You can also install packages from local archives:
```
# matt install which_2.21.mpf
```
And you can install multiple packages at once:
```
# matt install grub systemd linux
```

### Removing/Uninstalling packages
To remove an installed package, you can use the `remove` command:
```
# matt remove which
```
You can also remove multiple packages:
```
# mp-remove git curl
```

### Updating packages
You can update all of the installed packages using the `update` command:
```
# matt update
```

### Querying packages
You can get more information about a package by querying it. For example to get 
more information about the `which` package:
```
# matt info which
```
This will provide the following information about the package:

- Name of the package
- Version
- Description
- Size
- Dependencies
- If the package is installed
- If the package is up-to-date

### List packages
You can list all the installed packages with the `list` command:
```
# matt list
```

# Other package managers
It's a really bad idea to use multiple package managers as they may conflict and may result in an 
unstable system. However package managers such as `flatpak` and `snap` offer containerized packages,
making them possible to use with other package managers. However currently none of these package
managers are available in the official pools. If you want to use them, you will need to install them
from the source.
