**Objective:** Run a self hosted F-Droid repository. **Setup stack:** - F-Droid server: `fdroid.konstantinovitz.local` - Some kind of server running Debian - Connected to `gateway.konstantinovitz.local` - A router/network gateway: `gateway.konstantinovitz.local` - Runs a DHCP and DNS server - Obviously connects the F-Droid client and server together - An F-Droid client: `pixel7.konstantinovitz.local` - Mobil device running android/grapheneOS - Connected to `gateway.konstantinovitz.local` **TODO**: Add diagram **Assumptions:** The repo server will be run inside of a private network and I'll therefore be more lax concerning the security requirements. --- ## An introduction to F-Droid repo anatomy ``` repo/ ├── index.jar ├── index.xml ├── index-v1.jar ├── index-v1.json ├── metadata/ │ ├── app1.yml │ ├── app2.yml │ └── ... ├── icons/ │ ├── app1.png │ ├── app2.png │ └── ... ├── screenshots/ │ ├── app1/ │ │ ├── en-US/ │ │ │ ├── phoneScreenshots/ │ │ │ │ ├── 1.png │ │ │ │ └── ... │ │ └── ... │ └── ... ├── app1.apk ├── app2.apk └── ... ``` `index.jar`, `index.xml`, `index-v1.jar`, `index-v1.json` Contains metadata and index information for the repo. Used by the F-Droid client to display available apps and their details. `metadata/` This is where the application metadata resides. It is contained within `YAML` which describes application attributes such as: - name - version - description - version - ... `icons/`: Basically the icons that you'll see in your android application launcher. `screenshots/:` Contains screenshots for the apps, organized by app and locale. `.APK Files:` The actual APK files for the apps you are hosting. --- ## `fdroid.konstantinovitz.local` - Generate file structure - Installing `fdroidserver` - Initializing the file structure - Appending `.apk` files - Re-indexing the repo - Enable external access - Installing a web server - Creating webserver config ### Generating the file structure **Installing the fdroidserver** ```bash sudo apt install fdroidserver ``` https://f-droid.org/docs/Installing_the_Server_and_Repo_Tools/ The term "F-Droid server" can be a bit misleading. It doesn't refer to a standalone server software but rather to a set of command-line tools provided by the `fdroidserver` package. These tools help you manage and create an F-Droid repository. The main components of the fdroidserver package include: #### Initializing the file structure ``` export FDROID_HOME=/var/www/fdroid # === Setup the root directory and appropriate permissions sudo mkdir -p $FDROID_HOME sudo chown -R $USER:$USER $FDROID_HOME cd $FDROID_HOME # === Initialize the file structure fdroid init # === Download and verify KeePassDX.apk wget -P $FDROID_HOME/repo https://github.com/Kunzisoft/KeePassDX/releases/download/4.0.8/KeePassDX-4.0.8-libre.apk # Verify file signature verification sha256sum $FDROID_HOME/repo/KeePassDX-4.0.8-libre.apk # Exepcted output: # 078893a59c79c0a39f9291305c5efc9d56557c522f99d8ca0ceb4c870ce23917 # === Update/re-index repo fdroid update -c; fdroid update ``` ``` vi $FDROID_HOME/config.yml # Replace line 55 with repo_url: http://fdroid.konstantinovitz.local/repo ``` ### Enable remote access The F-Droid client expects to access the repository over HTTP or HTTPS. Due to the nature of my deployment (internal private network) and the fact that I can't be bothered, I'm gonna go for a simple HTTP setup using NGINX. ``` sudo apt install nginx sudo systemctl enable nginx sudo systemctl start nginx sudo vi /etc/nginx/sites-available/fdroid ``` Append the following lines ``` server { listen 80; server_name fdroid.konstantinoviz.local; # replace this with a domain of your own location / { root /var/www/fdroid; autoindex on; # Enables directory listing } } ``` Enable the configuration ``` sudo ln -s /etc/nginx/sites-available/fdroid /etc/nginx/sites-enabled/ sudo systemctl restart nginx ``` --- ## `gateway.konstantinovitz.local` For my own setup I'm using a openwrt router where I'll be updating the DHCP configuration such that my android device, whilst connected to the router ``` vi /etc/config/dhcp # Append following lines to my DHCP server config host option name 'fdroid.konstantinovitz.local' option ip '192.168.8.234' # Replace with your IP option mac '38:BA:F8:56:F4:6E' # Replace with your MAC ``` Then restart the DNS server ``` /etc/init.d/dnsmasq restart ``` --- ## `pixel7.konstantinovitz.local` * Open the F-Droid app on your Android device * Go to "Settings" in the lower right corner * Tap "Repositories" * Tap the "+" action button in the lower right corner * Enter `http://fdroid.konstantinovitz.local/repo` --- ## Further sysadmin Additionalala `APKs` may be added by simply dumping them into the `$FDROID_HOME/repo` directory and then run `fdroid update --create-meta`. ## Notes on security - Disable Nginx auto-index? - Enable https? ## Notes on `repomaker` Repomaker needs a maintainer, please adopt me! Repomaker currently runs on Django 1.11, which went out of security support in July 2020. Please see [#234](https://gitlab.com/fdroid/repomaker/-/issues/233 "Unpublish Repomaker because of its lack of maintenance") for more information." **Q:** What is "repo maker" and why not use it? **A:** It was a web GUI for curating fdroid repos, but it is now ded Repomaker is still being referenced ALOT in the official fdroid documentation. Which is rather dangerous considering the fact that it went out of security support 4 years ago.... https://f-droid.org/tutorials/create-repo/ (should be retired.) --- ## Takin' fings furter It would be cool to somehow have the whole repo on some kind of external drive which could either be mounted physically or through some kind of NAS. --- ## References https://f-droid.org/docs/Setup_an_F-Droid_App_Repo/ https://forum.f-droid.org/t/personal-f-droid-repository/14134/7