Installing the Server and Repo Tools

From F-Droid
Jump to: navigation, search

The fdroidserver tools provide everything you need to set up and maintain your own repos, run an fdroid build server, and even host your own website like f-droid.org. The F-Droid developers mostly work on Debian, Arch, and Ubuntu, so those are currently the best supported platforms.

Installing repo tools

In order to setup and maintain your own collection of apps and media, you need to setup an F-Droid repository using the tools from fdroidserver.

Debian/Ubuntu/Mint/etc

The F-Droid tools, also known as fdroidserver, are included in recent releases (Debian/jessie, Ubuntu/utopic, and newer). This should be enough to install the basic F-Droid setup:

   sudo apt-get install fdroidserver

Older releases

For installing on older releases, there are a couple more simple steps:

  • Ubuntu/Mint: use the Guardian Project PPA (fingerprint: 6B80 A842 07B3 0AC9 DEE2 35FE F50E ADDD 2234 F563):
   sudo add-apt-repository ppa:guardianproject/ppa
   sudo apt-get update
   sudo apt-get install fdroidserver
   apt-get install fdroidserver/wheezy-backports

Apple OSX

You can install `fdroidserver` directly using MacPorts, Homebrew, or `easy_install` as a last resort:

or MacPorts:

   port install fdroidserver

or Homebrew:

   brew install android-sdk
   android update sdk --no-ui --filter platform-tools,build-tools-22.0.1
   brew install fdroidserver

With only easy_install:

   sudo easy_install fdroidserver


Windows

Windows 10 Subsystem for Linux

Starting with the Windows 10 "Anniversary Update", you can enable an Ubuntu environment that runs in Windows, known has "Bash on Windows", "Ubuntu on Windows", or "Windows Subsystem for Linux".

  1. setup Windows Subsystem for Linux
  2. install fdroidserver from the Guardian Project PPA (fingerprint: 6B80 A842 07B3 0AC9 DEE2 35FE F50E ADDD 2234 F563) by running this in the Bash shell window:
   sudo add-apt-repository ppa:guardianproject/fdroidserver
   sudo apt-get update
   sudo apt-get install fdroidserver


Cygwin

  1. add Java to your PATH: http://www.kingluddite.com/tools/how-do-i-add-java-to-my-windows-path
  2. Install Cygwin https://www.sourceware.org/cygwin/
  3. in Cygwin, install these packages: gcc-core git openssh python3 python3-pyasn1 python3-imaging python3-paramiko python3-requests python3-setuptools rsync wget
  4. open a Cygwin bash shell and run: easy_install fdroidserver

Then here's the repo setup:

 export ANDROID_HOME=/cygdrive/c/path/to/android-sdk
 fdroid init   # the keystore gen will fail

After running fdroid init, you need to set the Windows path to your keystore in config.py.

It is also possible to install fdroidserver in a virtual environment using virtualenv and pip.

  1. easy_install pip
  2. easy_install virtualenv

Now follow the virtualenv+pip instructions above, then you should be able to run the fdroid command as long as you are in the Python "virtualenv".

Installing the latest code on all platforms

The easiest way to install the fdroidserver tools from source is to use virtualenv and pip. First, make sure you have the Python3 version of virtualenv or pyvenv installed, it should be included in your OS's Python distribution or via other mechanisms like dnf/yum/pacman/emerge/Fink/MacPorts/Brew. Then here's how to install fdroidserver into a Python "virtual env":

   git clone https://gitlab.com/fdroid/fdroidserver.git
   cd fdroidserver
   virtualenv env/  # pyvenv also works
   . env/bin/activate
   pip3 install -e .
   python3 setup.py install


Buildserver Setup

If you want to build apps using F-Droid, then you will have to install the whole Android SDK. This process is currently only developed on GNU/Linux, but we'd be happy to accept patches getting it working on MacOS and Windows. If you only want to make F-Droid repositories of APK files that you already have or don't know what this means, then you can skip this section.

The F-Droid tools depend on the Android SDK and Java, but only parts of the Android SDK are available in Debian. So the Android ADK must be installed manually, as well as the packages that it requires (the Android SDK tools include some 32-bit binaries, so even 64-bit systems need these i386 library packages). The F-Droid tools use the Android SDK to build and inspect apps, so you must have the Android SDK installed and setup before using fdroidserver.

Install the Android SDK and make sure ANDROID_HOME is properly set. Be sure to verify the file you downloaded, you can [double-check the SHA-1 Checksum] on Google's download page.

$ sudo apt-get install openjdk-8-jdk lib32stdc++6 lib32gcc1 lib32z1 lib32ncurses5
...
$ cd ~
$ wget https://dl.google.com/android/android-sdk_r24.3.4-linux.tgz
$ echo "fb293d7bca42e05580be56b1adc22055d46603dd  android-sdk_r24.3.4-linux.tgz" | sha1sum -c
android-sdk_r24.3.4-linux.tgz: OK
$ tar xzf android-sdk_r24.3.4-linux.tgz
$ export ANDROID_HOME=~/android-sdk-linux_86
$ export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
$ android update sdk --no-ui --filter platform-tools,tools,build-tools-22.0.1,android-22

To add these settings permanently to your shell:

$ echo export ANDROID_HOME=$ANDROID_HOME >> .bashrc
$ echo 'export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> .bashrc


Toolchain Support

Depending on the apps you are going to build, you may need to install extra packages to support their toolchains.

Package Description Installation
gradle Build apps with gradle
$ sudo apt-get install gradle
maven Build apps with maven
$ sudo apt-get install maven
NDK Build apps that include native code On 32-bit Linux:
$ cd ~
$ wget http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86.bin
$ chmod a+x android-ndk-r10e-linux-x86.bin
$ ./android-ndk-r10e-linux-x86.bin

On 64-bit Linux:

$ cd ~
$ wget http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
$ chmod a+x android-ndk-r10e-linux-x86_64.bin
$ ./android-ndk-r10e-linux-x86_64.bin

Now set environment variables for NDK:

$ export ANDROID_NDK=~/android-ndk-r10e
$ export PATH=$PATH:$ANDROID_NDK

To make these settings permanent, add the last two commands to your .bashrc file. F-Droid expects an environment variable named ANDROID_NDK pointing to the NDK path. Newer versions will also accept NDK or ANDROID_NDK_HOME.

Some apps may have specific toolchain requirements. These are generally the same as for a regular (manual) build. Check the build recipe and documentation for the app to find out if you need anything else.


TODO

  • fix `fdroid init --keystore` with windows paths...