Installing/POSIX

From Freenet Wiki
Jump to: navigation, search

Contents

Requirements

Java 6 or later. If you want to use a free JVM, OpenJDK has also been reported to work fine with Freenet. Most GNU/Linux distros have this is their repositories; look for "openjdk-6-jre".

Arch Linux

There is a freenet package available in the AUR [1]. It automatically unpacks the headless archive, adds the freenet user and the startup damon. Just add freenet to your DAEMONS in /etc/rc.conf if you want it to run automatically at startup, and run /etc/rc.d/freenet start to start your freshly installed node.

Ubuntu

Since Freenet (partly due to the continuous development and frequent updates) is not available in the repositories, the Freenet developers provide an installer.

After you have installed Sun Java (see above), you can go to freenetproject.org and simply click on Install (green big button). A dialog box should appear and you can choose to execute the file with Java 6 Web Start. After you have confirmed, the installation wizard will appear.

The first step is to select the language whereby you select "eng" and click OK. Just click "Next" a few times and adjust the values if needed. If you are unsure, just leave the default values. A setup assistant should appear after the installation has finished.

Alternative Installation

Execute the following commands in a terminal to download the latest version of Freenet and install them:

wget https://downloads.freenetproject.org/alpha/installer/new_installer.jar && java -jar new_installer.jar

If the installer does not start in text mode and you want it to, add -console to the end of the command. To start Freenet now, execute these commands:

cd ~/Freenet (go to the directory where Freenet has been installed to)

./run.sh start (run the launcher script)

Once Freenet was launched successfully, open a web browser and point it to [2] where you can change the settings.

Debian-based, with a freenet system user

This will install Freenet into a new system user account called freenet on Debian-based systems - it makes use of Debian adduser, GNU wget, GNU tar. Fedora-based systems link adduser to useradd, which is a more low-level program.

It uses the headless installer, so it will work on a system without X11 too. If the installer does not start in text mode and you want it to, add -console to the end of the command.

 root# adduser --system --group freenet
 root# cd ~freenet
 root# su -s "$SHELL" freenet
 freenet$ wget https://downloads.freenetproject.org/alpha/installer/new_installer_offline.jar
 freenet$ java -jar new_installer_offline.jar -console

If you don't want to use /home/freenet as the installation directory, use

 root# adduser --system --home PATH_TO_INSTALLATION_DIRECTORY --group freenet

For the rest of the commands to work verbatim, the directory name itself must be freenet, eg. /srv/freenet but not /srv/freenet-daemon.

Explanation

  • adduser [etc] creates a system account called freenet in a new group called freenet
  • su [etc] switches to the new user account. The -s "$SHELL" ensures it starts a working shell; otherwise, it'll immediately exit, since system accounts' default shells are /bin/false.
  • wget [etc] downloads the Freenet installer into freenet's home directory.
  • jar -jar [etc] starts the installer.

see the relevant manual pages for more details.

Controlling Freenet

You should be able to control Freenet from FProxy, at localhost:8888/. However, if you can't do this, then you'll need a way to control Freenet as the freenet user.

One way to do this is to su freenet as above. To avoid the need to use the -s flag, you might want to set the default shell to something usable - see the chsh command for details.

A better method is to create a wrapper program around run.sh that only root can run, that automatically takes care of the user-switching (eg. akin to the /etc/init.d scripts).

Personally, I use a setgid program which allows everyone in the freenet group to control Freenet. This is quite non-standard, but it does mean that you can control Freenet from your normal user account. I'm happy to provide the source code for this, to anyone who is interested (ask infinity0 on freenode; I'm in #freenet most of the time).

Single server (CLI) node

  1. apt-get install wget default-jre-headless
  2. wget https://downloads.freenetproject.org/alpha/installer/new_installer_offline.jar
  3. java -jar new_installer_offline.jar

FreeBSD

It is highly recommended for obvious security reasons to run the Freenet daemon in a jail. At the moment (feb 2010) all the JVMs are affected by a serious XML vulnerability ; the only solution is to use openjdk7 (the port is beta, but works really well), though it will need another JDK to bootstrap itself.

Once you created the jail, mount the ports tree in it then bind a shell to it (using jexec(8) with sh or tcsh). Install the java/jdk16 and java/openjdk7 ports, run a standard headless Freenet installation in any directory (let's say /freenet). After that you need to put the full path of the openjdk7 java binary in the wrapper.conf file. It is probably /usr/local/openjdk7/bin/java : put that value in wrapper.java.command.

When you're done, add /freenet/run.sh start (or any other path you installed Freenet in) in rc.local to enable autostart. Also, don't forget to edit the freenet.ini file because FProxy will only listen to 127.0.0.1 by default!

You need to get the wrapper for FreeBSD from http://wrapper.tanukisoftware.com/doc/english/download.jsp. The wrapper in the Freenet package is for Linux only. Delete wrapper-linux* in freent/bin and libwrapper-linux* from freenet/lib. Extract the downloaded tar.gz and copy the included bin/wrapper and lib/libwrapper.so to freenet/bin and freenet/lib.

Freenet should start fine now. Stopping Freenet depends on Linux /proc filesystem which isn't provided by FreeBSD. Change run.sh beginning with Line 401 from


 if ! test -f /proc/$pid/cwd/Freenet.pid
 then
      # This is a stale pid file.
      rm -f "$PIDFILE"
      echo "Removed stale pid file2: $PIDFILE"
      pid=""
 fi

to

 # if ! test -f /proc/$pid/cwd/Freenet.pid
 # then
 #      # This is a stale pid file.
 #      rm -f "$PIDFILE"
 #      echo "Removed stale pid file2: $PIDFILE"
 #      pid=""
 #
 # fi

Android

Theoretically Freenet could run on a good android phone, although it's a background app so maybe only on recent versions. The APIs we use from the JDK are (mostly?) also present in Android. Compile it yourself, see what happens. Also, please see the suggestion about freenet on phones in general.

Personal tools