OpenFlights is an open-source tool that lets you map your flights around the world. Here are the steps I followed to install it on my server.
This post was published quite some time ago and likely contains out of date information.
Update 2015-09-27: Updated nginx configuration to allow extensionless php files.
After the initial setup of my new server, installation of OpenFlights was simple. Create the database, configure Nginx, download, install and configure WordPress itself.
OpenFlights Install
Firstly I created a new directory for the site:
mkdir -p /var/www/flights.illallangi.com
Then I downloaded and extracted the latest version of OpenFlights:
curl –L -o /tmp/openflights.zip https://github.com/jpatokal/openflights/archive/master.zip
unzip /tmp/openflights.zip -d /var/www/flights.illallangi.com
mv /var/www/flights.illallangi.com/openflights-master /var/www/flights.illallangi.com/openflights
Database Creation
Create an account and a database for OpenFlights:
mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5340 to server version: 3.23.54 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE DATABASE flights; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON flights.* TO "flights"@"localhost" -> IDENTIFIED BY "password"; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) mysql> EXIT Bye
Create OpenFlights tables:
cat /var/www/flights.illallangi.com/openflights/sql/create.sql | grep -v CREATE\ [UD] | grep -v GRANT | grep -v CONNECT | mysql -D flights -p
Import initial data:
perl -pi -e "s/data\//\/var\/www\/flights.illallangi.com\/openflights\/data\//g" /var/www/flights.illallangi.com/openflights/sql/load-data.sql perl -pi -e "s/locale\//\/var\/www\/flights.illallangi.com\/openflights\/locale\//g" /var/www/flights.illallangi.com/openflights/sql/load-data.sql cat /var/www/flights.illallangi.com/openflights/sql/load-data.sql | mysql -D flights -p --local-infile
Nginx Configuration
I created the /etc/nginx/conf.d/flights.illallangi.com.conf file:
server { listen 80; server_name flights.illallangi.com; index index.php index.html; include /etc/nginx/default.d/*.conf; root /var/www/flights.illallangi.com/openflights; location / { try_files $uri $uri/ @php; } location @php { fastcgi_param SCRIPT_FILENAME "$document_root$uri.php"; fastcgi_param PATH_TRANSLATED "$document_root$uri.php"; fastcgi_param QUERY_STRING $args; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; } }
Restart the nginx service:
systemctl restart nginx
OpenFlightsConfiguration
Create the wp-config.php file and configured it, stealing some code from a gist I found to do it on the command line (rather than editing the file in nano):
cp /var/www/flights.illallangi.com/openflights/php/config.php.sample /var/www/flights.illallangi.com/openflights/php/config.php perl -pi -e "s/flightdb2/flights/g" /var/www/flights.illallangi.com/openflights/php/config.php perl -pi -e "s/openflights/flights/g" /var/www/flights.illallangi.com/openflights/php/config.php perl -pi -e "s/\"\"/\"password\"/g" /var/www/flights.illallangi.com/openflights/php/config.php
File and Directory Permissions
Set permissions on files:
find /var/www/flights.illallangi.com/openflights -type f -exec chmod 664 {} + find /var/www/flights.illallangi.com/openflights -type d -exec chmod 775 {} + chown -R apache.nobody /var/www/flights.illallangi.com/openflights
Next Steps
At this point the OpenFlights installation was complete. I pointed DNS for flights.illallangi.com to the new server and browsed to it in Chrome. OpenFlights displayed its initial login.
I could also have restored my database from backup at this point.
Featured Image: “Contrail Indicated” by Zach Stern on flickr.
Be First to Comment