<commit_before># Upgrade instructions

For installation instructions, see [INSTALL.md](INSTALL.md).

**Table of Contents:**
- [Stop IntelMQ and Backup](#stop-intelmq-and-backup)
- [Upgrade IntelMQ](#upgrade-intelmq)
  - [Packages](#packages)
  - [PyPi](#pypi)
  - [Local repository](#local-repository)
- [Check the installation](#check-the-installation)
- [Redefine/Check permissions](#redefinecheck-permissions)
- [Start IntelMQ](#start-intelmq)


## Read NEWS.md

Read the NEWS.md file to look for things you need to have a look at.

## Stop IntelMQ and Backup

* Make sure that your IntelMQ system is completely stopped: `intelmqctl stop`
* Create a backup of IntelMQ Home directory, which includes all configurations. They are not overwritten, but backups are always nice to have!

```bash
> sudo cp -R /opt/intelmq /opt/intelmq-backup
```

## Upgrade IntelMQ

Before upgrading, check that your setup is clean and there are no events in the queues:
```bash
intelmqctl check
intelmqctl list queues -q
```

The upgrade depends on how you installed IntelMQ.

### Packages

Use your systems package management.

### PyPi

```
pip install -U --no-deps intelmq
sudo intelmqsetup
```
Using `--no-deps` will not upgrade dependencies, which would probably overwrite the system's libraries.
Remove this option to also upgrade dependencies.

### Local repository

If you have an editable installation, refer to the instructions in the [Developers Guide](Developers-Guide.md#development-environment).

Update the repository depending on your setup (e.g. `git pull origin master`).

And run the installation again:
```bash
pip install .
sudo intelmqsetup
```
For editable installations (development only), run `pip install -e .` instead.

## Upgrade the configuration

Make a backup of your configuration files, including the bots' configuration (like the modify bot).
Call the configuration upgrade function:
```
intelmqctl upgrade-conf
```

## Upgrade configuration and check the installation

Go through [NEWS.md](../NEWS.md) and apply necessary adaptions to your setup.
If you have adapted IntelMQ's code, also read the [CHANGELOG.md](../CHANGELOG.md).

Check your installation and configuration to detect any problems:
```bash
intelmqctl upgrade-config
intelmqctl check
```

## Start IntelMQ

```
> intelmqctl start
```
<commit_msg>DOC: Upgrading: remove old duplicate section<commit_after># Upgrade instructions

For installation instructions, see [INSTALL.md](INSTALL.md).

**Table of Contents:**
- [Stop IntelMQ and Backup](#stop-intelmq-and-backup)
- [Upgrade IntelMQ](#upgrade-intelmq)
  - [Packages](#packages)
  - [PyPi](#pypi)
  - [Local repository](#local-repository)
- [Check the installation](#check-the-installation)
- [Redefine/Check permissions](#redefinecheck-permissions)
- [Start IntelMQ](#start-intelmq)


## Read NEWS.md

Read the NEWS.md file to look for things you need to have a look at.

## Stop IntelMQ and Backup

* Make sure that your IntelMQ system is completely stopped: `intelmqctl stop`
* Create a backup of IntelMQ Home directory, which includes all configurations. They are not overwritten, but backups are always nice to have!

```bash
> sudo cp -R /opt/intelmq /opt/intelmq-backup
```

## Upgrade IntelMQ

Before upgrading, check that your setup is clean and there are no events in the queues:
```bash
intelmqctl check
intelmqctl list queues -q
```

The upgrade depends on how you installed IntelMQ.

### Packages

Use your systems package management.

### PyPi

```
pip install -U --no-deps intelmq
sudo intelmqsetup
```
Using `--no-deps` will not upgrade dependencies, which would probably overwrite the system's libraries.
Remove this option to also upgrade dependencies.

### Local repository

If you have an editable installation, refer to the instructions in the [Developers Guide](Developers-Guide.md#development-environment).

Update the repository depending on your setup (e.g. `git pull origin master`).

And run the installation again:
```bash
pip install .
sudo intelmqsetup
```
For editable installations (development only), run `pip install -e .` instead.

## Upgrade configuration and check the installation

Go through [NEWS.md](../NEWS.md) and apply necessary adaptions to your setup.
If you have adapted IntelMQ's code, also read the [CHANGELOG.md](../CHANGELOG.md).

Check your installation and configuration to detect any problems:
```bash
intelmqctl upgrade-config
intelmqctl check
```

## Start IntelMQ

```
> intelmqctl start
```

{'fraction_non_alphanumeric': 0.1014945349096587, 'fraction_numerical': 0.0, 'mean_word_length': 4.704834605597965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1499888', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1242, 'n_words': 524}