How to: Best practice(s)
1. Install Maltrail:

- On **Ubuntu/Debian**

    ```sh
    sudo apt-get install git python3 python3-dev python3-pip python-is-python3 libpcap-dev build-essential procps schedtool
    sudo pip3 install pcapy-ng
    cd /tmp
    git clone --depth 1 https://github.com/stamparm/maltrail.git
    sudo mv /tmp/maltrail /opt
    sudo chown -R $USER:$USER /opt/maltrail
    ```
    
- On **SUSE/openSUSE**

   ```sh
   sudo zypper install gcc gcc-c++ git libpcap-devel python3-devel python3-pip procps schedtool
   sudo pip3 install pcapy-ng
   cd /tmp
   git clone --depth 1 https://github.com/stamparm/maltrail.git
   sudo mv /tmp/maltrail /opt
   sudo chown -R $USER:$USER /opt/maltrail
   ```

2. Set working environment:

    ```sh
    sudo mkdir -p /var/log/maltrail
    sudo mkdir -p /etc/maltrail
    sudo cp /opt/maltrail/maltrail.conf /etc/maltrail
    sudo nano /etc/maltrail/maltrail.conf
    ```

3. Set running environment:

    * `crontab -e  # autostart server & periodic update`

    ```
    */5 * * * * if [ -n "$(ps -ef | grep -v grep | grep 'server.py')" ]; then : ; else python3 /opt/maltrail/server.py -c /etc/maltrail/maltrail.conf; fi
    0 1 * * * cd /opt/maltrail && git pull
    ```

    * `sudo crontab -e  # autostart sensor & periodic restart`

    ```
    */1 * * * * if [ -n "$(ps -ef | grep -v grep | grep 'sensor.py')" ]; then : ; else python3 /opt/maltrail/sensor.py -c /etc/maltrail/maltrail.conf; fi
    2 1 * * * /usr/bin/pkill -f maltrail
    ```

4. Enable as systemd services (Linux only):

    ```sh
    sudo cp /opt/maltrail/maltrail-sensor.service /etc/systemd/system/maltrail-sensor.service
    sudo cp /opt/maltrail/maltrail-server.service /etc/systemd/system/maltrail-server.service
    sudo systemctl daemon-reload
    sudo systemctl start maltrail-server.service
    sudo systemctl start maltrail-sensor.service
    sudo systemctl enable maltrail-server.service
    sudo systemctl enable maltrail-sensor.service
    systemctl status maltrail-server.service && systemctl status maltrail-sensor.service
    
    ```
    
  **Note**: ```/maltrail-sensor.service``` can be started as dedicated service without pre-started ```/maltrail-server.service```. This is useful for case, when ```/maltrail-server.service``` is installed and works on another machine in you network environment.