Setting up a private Android appstore with FDroid

Introduction

There are a number of use cases to create an appstore with private data. As we create and release more devices and products, we are able to create matching AppStores to support them.
Appstores can be a way of controlling the software on the devices accurately, providing speed of update via a local store as opposed to Google Play, and also allows us a lot more flexibility in what we push to devices (agility). Our own curated appstores will also allow us to generate an income stream if we so desire, as well as create a dev community ecosystem for creation of apps for devices.

F-Droid server

FDroid is an Open Source package of server and client applications to deploy an app ecosystem similar to Google Play. The server scripts are written in Python language and the client is written in Java using Android SDK.

The FDroid Repository is an easily-installable catalogue of FOSS applications for the Android platform. The server contains the details of multiple versions of each application, and the Android client makes it easy to browse, install them onto your device, and keep track of updates.

Detailed installation instructions can be found in the official manual.

Prerequisites

Python

You will need a server, with a Python runtime installed. The python runtime should have the following prerequisites installed:
* PIL
* pip
* Python buildtools

Remember to install PIL with JPEG and Zlib support for reading APK files! I.e. install libjpeg and zlib1-dev packages for your OS BEFORE installing PIL with pip!

Android SDK

The Android SDK is used throughout the server to manage and read metadata from the APK files. It is also used for signing, compiling source and numerous other tasks
* Grab the SDK from http://developer.android.com/sdk/index.html
* Update the SDK once unpacked on the server with android sdk update –no-ui
* export ANDROID_HOME to the pwd

FDroid source

Grab the fdroid-server source from Gitorious
* git clone git://gitorious.org/f-droid/fdroidserver.git

Nginx installation

I used Nginx to serve the repo files, as nginx is very well suited to serving static content very quickly. There will be little modifications and no dynamic content as we proceed, so nginx is a good choice. You may use other web servers, but you will be on your own.
* sudo apt-get install nginx (on Ubuntu flavours)
* edit /etc/nginx/nginx.conf to suit your setup
* service nginx start/restart
* The nginx docroot is in /usr/share/nginx/www
* You may need to edit /etc/nginx/sites-enabled and allow directory listing of index.xml too.

Browsing to the IP/hostname of the server should now bring up an nginx placeholder page.

FDroid setup

* Create a directory to hold your repo.
* Copy the file config.py from fdroid. Edit the two following propertis in config.py with appropriate values:
* sdk_path = “/tools/android-sdks” (This should reflect the path of your Android SDK installation)
* repo_url = “http://localhost/fdroid” (this should be your server IP/hostname)
* repo_icon = “icon.png” (this must exist as a 48x48px png)
* Run fdroid update -c This will create a repo and aerchive directory
* Place all APK’s inside the repo directory
* Run fdroid update again. This will unpack and parse all of the APK files and make entries for them
* Done!

You should now be able to browse your repo via a web browser!

Next steps will be to customize the client, which will be on a seperate post

Liked this post? Follow this blog to get more.