# Building the Captain Levitating's captain is the central server to command and control the players. Building is relatively simple since it only relies on a few packages on Linux, though it should work on any UNIX-y system with a modern Fortran compiler. ## Requirements The captain only has five dependencies: * SQLite3 development libraries * SSL development libraries * uuidgen * mimetype * gzip/gunzip The first two are necessary for building, while the third is a runtime dependency. These can be installed on Debian with the following command: ``` apt-get install libssl-dev libsqlite3-dev uuid-runtime gzip libfile-mimeinfo-perl ``` ## Building Levitating can be built either using [Simply Fortran](https://simplyfortran.com/) or using the included *makefile.gnu* makefile: ``` make -f makefile.gnu all ``` You should end up with a nice, little executable ## Installing ### Basic File Locations The produced executable is both a CGI executable and an inetd client, so it should be installed somewhere sensible. The conventional location would be in the */var/www/cgi-bin* directory. If you're going with the conventional route, the */var/www/data/captain* directory would be a nice place to install the configuration files. The *example* directory contains some necessary configuration files that should be subsequently placed in the */var/www/data/captain* directory. You'll need to edit *levitating.conf* to reflect all the directories, and you'll need to create the directories mentioned in said file as well: * uploads * results * instructions * releases One might also notice that the captain configuration file mentions some static files. These should be copied from the *example* directory to the configured static directory. The *sql* directory can contain scripts that the server may have to run. This directory should also be copied to the data folder. Finally, be sure to copy the *templates* directory to the subsequent data directory as well. ### Initialize the Database Wherever you've decided to store the database, probably in */var/www/data/captain/store.db* if you're following the suggestions, you need manually initialize it with the following command: ``` sqlite3 /var/www/data/captain/store.db < create.sql ``` ### Configuring Gemini and Titan Passthrough Regardless of your thoughts on the [Gemini protocol](https://geminiprotocol.net/), Levitating relies on it for all file transfers to/from players. The server hosting the captain must therefore be configured in a proper inetd server to accept and handle requests on port 1965. Gemini, however, isn't a standard protocol. You might need to let Linux know what the hell it is in */etc/services* if you're using an old inetd superserver. If you're starting from scratch, though, we'd recommned using xinetd. On Debian, it's a quick command away: ``` apt-get install xinetd ``` Next, you can copy the example service configuration file *example/levitating.xinetd* to */etc/xinetd.d/levitating* and edit it appropriately. ### Generate Certificates for Gemini and Titan Gemini (and Titan) are encrypted protocols that require self-signed certificates to operate. While you could use a legitimate, third-party certificate, there's really no need in this case. The command is: ``` openssl req -newkey rsa:4096 -x509 -sha512 -days 2048 -nodes -out pub.crt -keyout priv.key ``` Note that the "days" argument is pretty long. We don't really want to have to do this again. ### Create an Admin Our last basic installation step is to create a single user: ``` /var/www/cgi-bin/levitating-captain -c /var/www/data/captain/levitating.conf --new-admin margaux password ``` ### Optional: Web Interface You'll probably want to configure the web interface to Levitating if you're not planning on doing everything via Gemini. This involves configuring a web server to execute a CGI executable properly. The process depends heavily on the server software the user has available, but one will probably want to use Apache or Lighttpd. Nginx does not support CGI at all.