Project

General

Profile

Support #738

Install a F-Droid Repo Server on FreeBSD

Added by Daniel Curtis almost 9 years ago. Updated almost 9 years ago.

Status:
Suspended
Priority:
Normal
Assignee:
Category:
Package Management
Target version:
Start date:
01/31/2016
Due date:
% Done:

30%

Estimated time:
2.00 h
Spent time:

Description

This is a guide on installing the F-Droid server to serve a local android package repository on FreeBSD 9.

NOTE: Due to the lack of support for the Android SDK on FreeBSD, the F-Droid Repo does not work as expected. -3/12/16

Prepare the Environment

  • Make sure the system is up to date:
    pkg update && pkg upgrade
    
  • Install a few dependencies:
    pkg install git python2 py27-pip py27-virtualenv bash jpeg openjdk
    
  • Add the fdroid user
    pw add user -n fdroid -m -s /bin/sh -c "F-Droid" 
    

Install Android SDK

WARNING: The Android SDK is not supported on FreeBSD. Don't expect it to work out of the box.

  • Download Android SDK:
    fetch http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
    

Install F-Droid Server

  • Switch to the fdroid user:
    su - fdroid
    
  • Clone the fdroid source:
    git clone https://gitlab.com/fdroid/fdroidserver.git
    
  • Install the fdroid server:
    cd fdroidserver
    virtualenv env/
    source env/bin/activate
    pip install -e .
    python2 setup.py install
    
  • Exit from the fdroid user back into the root user:
    exit
    

Install Nginx

  • Install nginx:
    pkg install nginx
    
  • Start and enable nginx at boot:
    echo 'nginx_enable="YES"' >> /etc/rc.conf
    service nginx start
    
  • Create a configuration directory to make managing individual server blocks easier
    mkdir /usr/local/etc/nginx/conf.d
    
  • Edit the main nginx config file:
    vi /usr/local/etc/nginx/nginx.conf
    
    • And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
      worker_processes  1;
      error_log  /var/log/nginx-error.log;
      
      events {
          worker_connections  1024;
      }
      
      http {
          include       mime.types;
          default_type  application/octet-stream;
          sendfile        on;
          keepalive_timeout  65;
      
          # Load config files from the /etc/nginx/conf.d directory
          include /usr/local/etc/nginx/conf.d/*.conf;
      }
      

Setup F-Droid Repo

  • Create the fdroid repository directory:
    mkdir -p /usr/local/www/fdroid.example.com/fdroid
    chown -R fdroid:www /usr/local/www/fdroid.example.com
    
  • Create the fdroid server block config file:
    vi /etc/nginx/conf.d/fdroid.example.com.conf
    
    • And add the following:
      server {
      listen 80 default_server;
      server_name fdroid.example.com;
      autoindex on;
      access_log /var/log/fdroid.example.com.log main;

      location / {
      root /usr/local/www/fdroid.example.com;
      index index.html index.htm;
      }
      }

Initialize the F-Droid Repo

  • Switch to the fdroid user:
    su - fdroid
    
  • Initialize a bare F-Droid repository:
    cd /usr/local/www/fdroid.example.com/fdroid
    fdroid init
    

Resources

Also available in: Atom PDF