Before we begin, there is a bit of maintenance to do. Freenet will benifit from some rng tools so install:

sudo apt-get install rng-tool

The JRE that Ubuntu (bionic) defaults to has some incompatibilities with Freenet (0.7.5 Build 1480) has some trouble with. The problem is related to assistive technology class not found error. To get around it simply comment out the last (and only) line in /etc/java-8-openjdk/

sudo vi /etc/java-8-openjdk/
   # assistive_technologies=org.GNOME.Accessibility.AtkWrapper

Now on to the install. Although it is often suggested that Freenet be installed under a user account, I choose instead to install it under a system account since that seemed much less privileged than some of my standard login accounts. The wiki has a good walkthrough.

sudo adduser --system --home /usr/local/Freenet --group freenet
sudo chown -R freenet:freenet ~freenet
sudo chmod -R o-rwx,g-w ~freenet
cd ~freenet
sudo su -s "$SHELL" freenet # log-in as freenet
umask 0027
wget -O new_installer_offline.jar \$installjar
java -jar new_installer_offline.jar -console
exit # log-out of freenet

Now that freenet is running, go ahead and copy the ports you need to open

sudo grep listen /usr/local/Freenet/freenet.ini

You should see two UDP ports. One is the opennet port used by strangers, the other is the darknet port used by friends. To open them, create a firewall rule from your laptop using the GCE api

gcloud config set compute/zone {zone}
gcloud compute firewall-rules create i2p-server \
 --target-tags=i2p-server \
 --allow=udp:{opennetPort},udp:{darknetPort} \
gcloud compute instances add-tags {vm-name} --tags "i2p-server"

At this point freenet is running but needs to be configured. You can configure it with lynx but running a desktop browser might be a bit eaiser

# Pick the browser you want...
# browser="seamonkey"         
# browser="dillo"             

This will give you the startup wizard for you to configure your node. Most of the defaults are fine, though you might want to change your bandwidth. Since you get charged on GCE for bandwidth, be careful with your generosity. I choose 8KiB / 128KiB, but if you miss this step, you can always change it back, or edit the freenet.ini file. Use values you think are fair, these are likely the lowest possible for freenet to function at all.

sudo vi /usr/local/Freenet/freenet.ini # change the following

Before we go any further, we will need to do a test build of our Jekyll site to prepare to upload it

cd ~/src/{jksite}
bundle exec jekyll build

Once we have that sorted, we can get on to uploading our blog to Freenet. For this process we will need a jar called jSite. To download jSite browse to and follow the jSite link then download the jar file in the download area of the site. Do be aware, the download process may be kind of odd since error codes 500 is routinely thrown around, so just be patient and read every redirect.

Once you have the jar go ahead and copy it to your ~/Downloads dir. You may want to add permissions to the jar depending on how you downloaded it. The first execution is used to create a config file, so you have to do that from the desktop (update userid and jksite with appropriate values).

  • Start vncserver
  • Punch VNC whole in your firewall
  • Launch VNC viewer on your laptop to your VM’s external IP
  • Enter your highly random VNC password
  • From the desktop launch a terminal
  • cd to the Downloads directory cd ~/Downloads
  • Launch the jar java -jar jSite-*.jar
  • Click Add Project
  • Fill out Name: My Blog
  • Fill out Description: Jekyll Blog
  • Fill out Local path: /home/{userid}/src/{jksite}/_site
  • Freesite Path: myblog
  • Click Next
  • Click index.html in the list
  • Check the Default file checkbox
  • Click Quit
  • From terminal type vncserver -kill :1 to exit VNC

Now in the ~/Downloads folder you will find a file called jSite.conf with information required to upload the site. We are done with the desktop environment and we can now move to updating the script. Using the editor of your choice, update the file to contain the following.


function mk_env() {
   sed 's#<#"\n#g;s#>#="#g;s#request-##g' $jsite_conf | \
      grep "^uri\|^edition\|^path\|^name"

function bld_docroot() {
   umask 0027
   sudo cat ${docroot}/hosts.txt > hosts.txt
   sudo bundle exec jekyll build -d ${docroot}
   sudo chown -R i2psvc:www-data $docroot
   sudo chmod -R o-rwx $docroot
   sudo chmod -R g-w $docroot

function upld_freesite() {
   source <(mk_env)
   echo > _freenet.yml "baseurl: \"/freenet:USK@${uri}/${path}/$(( edition + 1 ))\""
   bundle exec jekyll build --config _config.yml,_freenet.yml
   java -cp ${jsite_jar} \
      "de.todesbaum.jsite.main.CLI" \
      "--config-file=${jsite_conf}" \


The variables jsite_conf, and jsite_jar, in the script above, will need to be updated to reflect your particular config. The script is broken down into functions. The mk_env function will use the config file to generate variable declarations uri, edition, path, and name. The source <(mk_env) is a bit of bash wizardry to consume those declarations. Finally, the _freenet.yml appends a Jekyll config to set the baseurl to the proper freesite key. The site is then built with bundle exec jekyll build and uploaded using the jSite jar.