Skip to content

Installing on POSIX

Stephen Oliver edited this page Oct 23, 2017 · 2 revisions

Requirements

Freenet requires Java 7 or later.

Arch LinuX

There is a Freenet package available in the AUR. It automatically unpacks the headless archive, adds the freenet user and the startup daemon. 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 https://freenetproject.org and simply click on Install (big green 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
./run.sh start 

Once Freenet was launched successfully, open a web browser and point it to http://127.0.0.1:8888 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

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

PCLinuxOS

Use the alternative installation method mentioned above. Do not install as "root". Root user will get permission errors, and a failed install.

FreeBSD

It is highly recommended for obvious security reasons to run the Freenet daemon in a jail.

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/openjdk7 port, 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, create a wrapper script /usr/local/etc/freenet (example) and add the corresponding line freenet_enable="YES" to your /etc/rc.conf to start and stop the node with the system/jail. 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 and stop fine now.

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.

Clone this wiki locally