Introduction
This page describes how Alexis Huxley installed and configured I2P.
Notes for next time
- some time after installation it became necessary to install i2p-keyring (presumably because the repo became signed and apt-get updates failed)
Installation the I2P way
This method was last used 18/04/2020. It is based on the official instructions.
- Run:
apt-get install apt-transport-https curl echo "deb https://deb.i2p2.de/ buster main" > \ /etc/apt/sources.list.d/i2p.list curl -o /tmp/i2p-debian-repo.key.asc \ https://geti2p.net/_static/i2p-debian-repo.key.asc apt-key add /tmp/i2p-debian-repo.key.asc apt-get update apt-get install i2p i2p-keyring dpkg-reconfigure i2p
and configure it as follows:
- when asked if i2p should be started at boot time, select ‘Yes’.
- when asked what user the service should run as, accept the default.
- when asked how much memory i2p may use, set it to 4096MB.
- when asked if the I2P daemon be confined with AppArmor, accept the default.
- Stop I2P by running:
systemctl stop i2p
(Later sections of this document expect i2p to be stopped.)
- To allow the I2P console to be accessible from the local network:
- Run:
cp -a /var/lib/i2p/i2p-config/clients.config.bak /var/lib/i2p/i2p-config/clients.config
- Edit /var/lib/i2p/i2p-config/clients.config and make the following changes:
clientApp.0.args=7657 0.0.0.0 ./webapps/
- Run:
- To allow the I2P web proxy to be access from the local network, complete the following sub-procedure:
- Run:
cp -a /var/lib/i2p/i2p-config/i2ptunnel.config.bak /var/lib/i2p/i2p-config/i2ptunnel.config
- Edit /var/lib/i2p/i2p-config/i2ptunnel.config and make the following changes:
tunnel.0.interface=0.0.0.0
- Run:
- For the purposes of the configuration section below, run the following command:
I2P_USER=i2psvc I2P_GROUP=i2psvc I2PSNARK_DIR=/var/lib/i2p/i2p-config/i2psnark
Installation the manual way
This method was last used 05/08/2018.
- Install prerequisites:
apt-get install openjdk-8-jre-headless
- If upgraded then, as root, clean up old versions:
killall -9 -u i2p mkdir /var/tmp/i2p.delete-soon mv /usr/local/opt/i2p-* /var/tmp/i2p.delete-soon mv /etc/init.d/i2p /var/tmp/i2p.delete-soon rm /usr/local/opt/i2p rm /etc/*.d/*i2p* userdel i2p # this also deletes i2p group
- Install:
VERSION=0.9.35 groupadd --system i2p useradd --system --gid i2p --create-home --home /usr/local/opt/i2p --shell /bin/bash i2p mv /usr/local/opt/i2p /usr/local/opt/i2p-$VERSION ln -s i2p-$VERSION /usr/local/opt/i2p cd /tmp && wget su - i2p java -jar /tmp/i2p*.jar -console
- This next bit is not copy-and-pastable; do it one step at a time, manually:
1 # continue <ENTER> # accept default path 1 # confirm ./i2prouter start # start sleep 60 # allow time for creation of config files; don't worry about firewall issues just yet ./i2prouter stop # stop exit
- Create init.d scripts:
{ cat <<'EOF' #!/bin/sh -e ### BEGIN INIT INFO # Provides: i2p # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start or stop the i2p router. ### END INIT INFO EOF echo "NAME=i2p" echo "DAEMON=/usr/local/opt/i2p-$VERSION/i2prouter" echo "USER=i2p" echo "PIDFILE=/usr/local/opt/i2p-$VERSION/.i2p/i2p.pid" cat <<'EOF' [ -x $DAEMON ] || exit 0 . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting i2p router" "$NAME" start-stop-daemon --start --background \ --pidfile $PIDFILE --chuid $USER --exec $DAEMON -- start log_end_msg 0 ;; stop) log_daemon_msg "Stopping i2p router" "$NAME" start-stop-daemon --stop --pidfile $PIDFILE --chuid $USER log_end_msg 0 ;; restart) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/$NAME { start | stop | restart }" exit 2 ;; esac EOF } > /etc/init.d/i2p chmod 755 /etc/init.d/i2p systemctl enable i2p
- To allow the I2P console to be accessible from the local network:
- Edit ~i2p/.i2p/clients.config and make the following changes:
clientApp.0.args=7657 0.0.0.0 ./webapps/
- Edit ~i2p/.i2p/clients.config and make the following changes:
- To allow the I2P web proxy to be access from the local network, complete the following sub-procedure:
- Edit ~i2p/i2ptunnel.config and make the following changes:
tunnel.0.interface=0.0.0.0
- Edit ~i2p/i2ptunnel.config and make the following changes:
- For the purposes of the configuration section below, run the following command:
I2P_USER=i2p I2P_GROUP=i2p I2PSNARK_DIR=/usr/local/opt/i2p/.i2p/i2psnark
Configuration
Regardless of which way you installed and configured I2p, some configuration is common to both methods.
- Stop I2P by running:
systemctl stop i2p
- To decrease disk IO and hopefully improve performance do the following:
- Run the following commands:
cd /var/lib/i2p/i2p-config mv netDb netDb.old mv peerProfiles peerProfiles.old ln -s /dev/shm/var-lib-i2p-i2p-config-netDb/netDb ln -s /dev/shm/var-lib-i2p-i2p-config-peerProfiles peerProfiles cp /lib/systemd/system/i2p.service /etc/systemd/system/i2p.service
- Locate the section:
AppArmorProfile=system_i2p ExecStartPre=/bin/mkdir -p /tmp/i2p-daemon
and change it to:
AppArmorProfile=system_i2p ExecStartPre=/bin/mkdir /dev/shm/var-lib-i2p-i2p-config-netDb /dev/shm/var-lib-i2p-i2p-config-peerProfiles ExecStartPre=/bin/chown -R ${I2PUSER}:${I2PUSER} /dev/shm/var-lib-i2p-i2p-config-netDb /dev/shm/var-lib-i2p-i2p-config-peerProfiles ExecStartPre=/bin/mkdir -p /tmp/i2p-daemon
- Reboot.
- To check that it worked run:
find /dev/shm/var-lib-i2p-i2p-config-*
- Stop I2P again.
- Run the following commands:
- Decide what TCP and UDP port I2P will use.
- On the firewall set up any necessary port forwarding.
- If storage for I2P snark is to be in a different location then replace /var/lib/i2p/i2p-config/i2psnark with a symlink and make sure any existing content there is correctly owned by running:
mv $I2PSNARK_DIR $I2PSNARK_DIR.delete-soon ln -s <somewhere> $I2PSNARK_DIR chown -R $I2P_USER:$I2P_GROUP $I2PSNARK_DIR/
- Restart I2P (previous sections left it stopped) and wait an hour.
- Visit http://<name-of-i2p-server>:7657/config.jsp. Don’t try to access this via a proxy yet; that won’t yet work.
- To change the TCP & UDP ports I2P listens on to match those configured in your firewall, complete the following sub-procedure:
- Click the “Network” tab and scroll down to the “IP AND TRANSPORT CONFIGURATION” section (this is the only section on this page nowadays).
- In “UDP Configuration” paragraph, change “UDP port” to whatever you’ve set up on the firewall, then scroll down and click “Save changes”.
- After that just wait, the network will recover, as indicated by the ‘Network: ‘ status in the left panel.
- To allow the I2P web proxy to be access from the local network, complete the following sub-procedure:
- In the left panel, under “I2P INTERNALS” click “Hidden Services Manager”.
- Scroll down to the “I2P CLIENT TUNNELS” sections and click “I2P HTTP Proxy”.
- In the “Edit proxy settings” section, change “Reachable by:” to “0.0.0.0”.
- Scroll down and click “Save”.
- To adjust download and upload bandwidths, complete the following sub-procedure:
- Click the “Bandwidth” tab and scroll down to the “Bandwidth limiter” section (this is the only section on this page nowadays).
- Enter your full download and upload bandwidths (for me 13250KBps and 800KBps) and the percentage of that you wish to share (f0r me 30%), then scroll down and click “Save changes”.