From 9d62575cf572f51de8ecd8167eeab0a39f1eea03 Mon Sep 17 00:00:00 2001 From: "Bora M. Alper" Date: Wed, 5 Jul 2017 15:25:15 +0300 Subject: [PATCH] fixed both docs and added iptables commands in magneticod docs --- magneticod/README.rst | 26 +++++++++++++++++--------- magneticod/systemd/magneticod.service | 2 +- magneticow/README.rst | 6 +++--- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/magneticod/README.rst b/magneticod/README.rst index 3d90d22..5abff7e 100644 --- a/magneticod/README.rst +++ b/magneticod/README.rst @@ -31,15 +31,15 @@ Instructions pip3 install magneticod --user -2. Add installation path to the ``$PATH``; append the following line to your ``~/.profile`` :: +2. Add installation path to the ``$PATH``; append the following line to your ``~/.profile`` if you are using bash :: export PATH=$PATH:~/.local/bin - **or if you are on macOS**, (assuming that you are using Python 3.5): :: + **or if you are on macOS** and using bash, (assuming that you are using Python 3.5): :: export PATH="${PATH}:${HOME}/Library/Python/3.5/bin/" -3. Activate the changes to ``$PATH``: :: +3. Activate the changes to ``$PATH`` (again, if you are using bash): :: source ~/.profile @@ -55,16 +55,18 @@ Instructions Download the magneticod systemd service file (at `magneticod/systemd/magneticod.service `_) and change the tilde symbol with - the path of your home directory. For example, if my username is ``bora``, this line :: + the path of your home directory, and the ``PORT_NUMBER`` with the preferred port number. For example, if my username + is ``bora`` and I prefer the port 64879, this line :: - ExecStart=~/.local/bin/magneticod + ExecStart=~/.local/bin/magneticod magneticod --node-addr 0.0.0.0:PORT_NUMBER should become this: :: - ExecStart=/home/bora/.local/bin/magneticod + ExecStart=/home/bora/.local/bin/magneticod --node-addr 0.0.0.0:64879 - Here, tilde (``~``) is replaced with ``/home/bora``. Run ``echo ~`` to see the path of your own home directory, if - you do not already know. + Here, tilde (``~``) is replaced with ``/home/bora`` and the ``PORT_NUMBER`` with 64879. Run ``echo ~`` to see the + path of your own home directory, if you do not already know. Port numbers above 1000 typically do not require + special permissions. 6. Copy the magneticod systemd service file to your local systemd configuration directory: :: @@ -72,7 +74,13 @@ Instructions You might need to create intermediate directories (``.config``, ``systemd``, and ``user``) if not exists. -7. Start **magneticod**: :: +7. (Optional, **requires root**) Disable iptables on a specified port for UDP protocol to prevent excessive number of + `EPERM` (errno 1, "Operation not permitted") errors, which also affect the performance: :: + + iptables -I OUTPUT -t raw -p udp --sport PORT_NUMBER -j NOTRACK + iptables -I PREROUTING -t raw -p udp --dport PORT_NUMBER -j NOTRACK + +8. Start **magneticod**: :: systemctl --user enable magneticod --now diff --git a/magneticod/systemd/magneticod.service b/magneticod/systemd/magneticod.service index dd1a98d..883469f 100644 --- a/magneticod/systemd/magneticod.service +++ b/magneticod/systemd/magneticod.service @@ -2,7 +2,7 @@ Description=magneticod: autonomous BitTorrent DHT crawler and metadata fetcher [Service] -ExecStart=~/.local/bin/magneticod +ExecStart=~/.local/bin/magneticod --node-addr 0.0.0.0:PORT_NUMBER Restart=always RestartSec=5 diff --git a/magneticow/README.rst b/magneticow/README.rst index c3ca3c0..b6a951a 100644 --- a/magneticow/README.rst +++ b/magneticow/README.rst @@ -38,8 +38,8 @@ Instructions pip3 install magneticow --user -2. Add installation path to the ``$PATH``; append the following line to your ``~/.profile`` *(you can skip to step 4 if - you installed magneticod first as advised)* :: +2. Add installation path to the ``$PATH``; append the following line to your ``~/.profile`` if you are using bash + *(you can skip to step 4 if you installed magneticod first as advised)* :: export PATH=$PATH:~/.local/bin @@ -47,7 +47,7 @@ Instructions export PATH="${PATH}:${HOME}/Library/Python/3.5/bin/" -3. Activate the changes to ``$PATH``: :: +3. Activate the changes to ``$PATH`` (again, if you are using bash): :: source ~/.profile