Project

General

Profile

Support #738

Updated by Daniel Curtis almost 9 years ago

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 

 h2. Prepare the Environment 

 * Make sure the system is up to date: 
 <pre> 
 pkg update && pkg upgrade 
 </pre> 

 * Install a few dependencies: 
 <pre> 
 pkg install git python2 py27-pip py27-virtualenv bash jpeg openjdk 
 </pre> 

 * Add the fdroid user 
 <pre> 
 pw add user -n fdroid -m -s /bin/sh -c "F-Droid" 
 </pre>  

 h2. 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: 
 <pre> 
 fetch http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz 
 </pre> 

 h2. Install F-Droid Server 

 * Switch to the fdroid user: 
 <pre> 
 su - fdroid 
 </pre> 

 * Clone the fdroid source: 
 <pre> 
 git clone https://gitlab.com/fdroid/fdroidserver.git 
 </pre> 

 * Install the fdroid server: 
 <pre> 
 cd fdroidserver 
 virtualenv env/ 
 source env/bin/activate 
 pip install -e . 
 python2 setup.py install 
 </pre> 

 * Exit from the fdroid user back into the root user: 
 <pre> 
 exit 
 </pre> 

 h2. Install Nginx 

 * Install nginx: 
 <pre> 
 pkg install nginx 
 </pre> 

 * Start and enable nginx at boot: 
 <pre> 
 echo 'nginx_enable="YES"' >> /etc/rc.conf 
 service nginx start 
 </pre> 

 * Create a configuration directory to make managing individual server blocks easier 
 <pre> 
 mkdir /usr/local/etc/nginx/conf.d 
 </pre> 

 * Edit the main nginx config file: 
 <pre> 
 vi /usr/local/etc/nginx/nginx.conf 
 </pre> 
 #* And strip down the config file and add the include statement at the end to make it easier to handle various server blocks: 
 <pre> 
 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; 
 } 
 </pre> 

 h3. Setup F-Droid Repo 

 * Create the fdroid repository directory: 
 <pre> 
 mkdir -p /usr/local/www/fdroid.example.com/fdroid 
 chown -R fdroid:www /usr/local/www/fdroid.example.com 
 </pre> 

 * Create the fdroid server block config file: 
 <pre> 
 vi /etc/nginx/conf.d/fdroid.example.com.conf 
 </pre> 
 #* 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; 
     } 
 } 

 h3. Initialize the F-Droid Repo 

 * Switch to the fdroid user: 
 <pre> 
 su - fdroid 
 </pre> 

 * Initialize a bare F-Droid repository: 
 <pre> 
 cd /usr/local/www/fdroid.example.com/fdroid 
 fdroid init 
 </pre> 

 h2. Resources 

 * https://github.com/f-droid/fdroidserver 
 * https://f-droid.org/wiki/page/Setup_an_FDroid_App_Repo 
 * https://f-droid.org/manual/fdroid.html#Simple-Binary-Repository

Back