Raspberry Pi – 继续折腾FlightAirMap

PiAware最大的问题是没办法记录曾经检测过的飞机,于是我又开始折腾起了功能更强大的FlightAirMap

安装过程

Install git, mariadb, apache and PHP with needed modules:

sudo apt-get install git mariadb-server apache2 php5 php5-curl php5-mysql php5-gd php-pclzip

Or this on Stretch:

sudo apt-get install git mariadb-server apache2 php7.0-common php7.0-cgi php7.0-mysql php7.0-curl php7.0 php7.0-xml php7.0-zip php7.0-gd php7.0-json

Get FlightAirMap from git:

cd /var/www
sudo git clone --recursive --depth=1 http://github.com/ysurac/flightairmap

Edit Apache conf /etc/apache2/site-available/000-default.conf, add this in VirtualHost section:

<VirtualHost *:8088>
        ServerName 192.168.68.128/flightairmap
        DocumentRoot "/var/www/flightairmap"
        <Directory /var/www/flightairmap>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>

Enable mod rewrite:

sudo a2enmod rewrite

Restart apache2:

sudo service apache2 restart

Fix permissions:

cd /var/www/flightairmap
sudo chmod 666 require/settings.php
sudo chmod 777 install/tmp
sudo chmod 777 data

Create database and user, may skip if already created:

mysql -u root -p
update mysql.user set password=password('YOUR_DB_PASSWORD') where user='root';

Then:

CREATE DATABASE `flightairmap`;
GRANT ALL ON `flightairmap`.* TO 'youruser'@'localhost' IDENTIFIED BY 'yourpass';
FLUSH PRIVILEGES;

Now use your browser to go to http://127.0.0.1/install/ (or ip of your server) Run scripts/update_db.php in a shell.

cd /var/www/flightairmap/
php scripts/update_db.php

Add FlightAirMap service:

sudo cp /var/www/flightairmap/install/init/flightairmap.service.systemd /etc/systemd/system/flightairmap.service

Alter paths to match your path, may skip i no change to the installation folder:

sudo nano /etc/systemd/system/flightairmap.service
sudo chmod 644 /etc/systemd/system/flightairmap.service

Then you can run flightairmap daemon:

sudo systemctl enable flightairmap.service

Add update_db.php in /etc/crontab:

sudo 5 * * * * root php /var/www/flightairmap/scripts/update_db.php >/dev/null 2>&1

运行效果:

Leave a Reply

Your email address will not be published. Required fields are marked *