# Compiling and installing AirDC++ in FreeBSD/FreeNAS jail First of all, make sure to refer and understand the general instructions in the official AirDC++ site: https://airdcpp-web.github.io/docs/installation/compiling.html What you'll find here are the specific instructions to compile **airdcppd** in a FreeBSD system, or in a FreeNAS jail. This was originally tested in a FreeNAS-11.3-U4.1, which uses FreeBSD 11.3-RELEASE-p11 as base system. I don't know if it will work on previous or newer versions, but I intend to keep this document updated. ## 1. Update your packages: ``` # pkg update # pkg upgrade ``` ## 2. Install the dependencies and tools: ``` # pkg install git cmake libmaxminddb miniupnpc pkgconf libnatpmp leveldb websocketpp boost-all python npm-node12 ``` > NOTE about npm > > There are currently some versions of npm available to install: > - npm-6.12.1_1 > - npm-node10-6.12.1_1 > - npm-node12-6.12.1_1 > > The first time I installed the default npm package, I received a warning about that npm doesn't support Node.js version 14. > Then I removed this version and installed npm-node12, and then I received a warning about that this version uses a deprecated version of python (2.7?)... > > Between the 2 warnings I decided to go on with npm-node12. Feel free to test other options. Your mileage may vary. ## 3. Clone the repository: ``` # git clone https://github.com/airdcpp-web/airdcpp-webclient.git ``` ## 4. Enter in the source-code folder and compile it: ``` # cd airdcpp-webclient # cmake . # make -j2 ``` If everything ran fine, you'll find the **airdcppd** binary in the airdcppd folder. So it's time to install the whole shebang: ``` # make install ``` ## 5. Bonus: init script to start airdcppd automagically at system/jail boot Here is my script: ``` #!/bin/sh # # PROVIDE: airdcppd # REQUIRE: networking # KEYWORD: . /etc/rc.subr name="airdcppd" rcvar="${name}_enable" load_rc_config ${name} : ${airdcppd_enable:="NO"} : ${airdcppd_user:="root"} : ${airdcppd_group:="root"} pidfile="/var/run/airdcppd/airdcppd.pid" command="/usr/local/bin/airdcppd" command_args="-d -c=/home/${airdcppd_user}/.airdc++ -p=/var/run/airdcppd/airdcppd.pid" run_rc_command "$1" ``` Save it under the name **`airdcppd`** and copy to **`/usr/local/etc/rc.d`** with 755 permissions. ### Service configuration: #### 1. Decide and create the user/group under which the service will run. In my specific case: ``` pw group add plex -g 118 pw user add plex -u 111 pw user mod -m /home/plex ``` #### 2. Create the folder to store the PID file, with the appropriate permissions: ``` # mkdir /var/run/airdcppd # chown plex:plex /var/run/airdcppd ``` #### 3. Configure the service to run automagically at system/jail boot, according with your setup. In my specific case: ``` # sysrc airdcpdd_enable=YES # sysrc airdcpdd_user=plex # sysrc airdcpdd_group=plex ``` At this point you should be able to control the service with: ``` # service airdcppd start | stop | status | restart ``` And finally, decide and configure the folders you'll want to share and download the files. This is important if you are using jails, because in this case you'll need to configure the bindings (mounting points). Refer to the [FreeNAS documentation](https://www.ixsystems.com/documentation/freenas/11.3-U4/jails.html#additional-storage) regarding this. The service should be accessible through: ``` http://:5600 ``` Feel free to point out any mistakes I made, including misspellings, typos and grammar errors. Happy AirDC++ing.