Difference between revisions of "Fedora Installation"

From SatNOGS Wiki
(Move fedora docs to wiki)
 
(adding unsupported warning to fedora)
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{MARKDOWN}}
+
= Installing SatNOGS on Fedora runnning on a Raspberry Pi 3 =
  
## Installing SatNOGS on a Raspberry Pi 3
+
{{Warning|This is not a supported method of running gr-satnogs and the SatNOGS client. Your success may vary.}}
  
 
This tutorial assumes the following:
 
This tutorial assumes the following:
Line 11: Line 11:
 
3. One of the following sdr devices: RTL-SDR or USRP B200.
 
3. One of the following sdr devices: RTL-SDR or USRP B200.
  
4. You have an account and a ground station registered on either `network.satnogs.org <https://network.satnogs.org>`_ or `network-dev.satnogs.org <https://network-dev.satnogs.org>`_. This is needed for getting your ground station ID number and your SatNOGS Network API key.
+
4. You have an account and a ground station registered on either [https://network.satnogs.org network.satnogs.org] or [https://network-dev.satnogs.org network-dev.satnogs.org]_. This is needed for getting your ground station ID number and your SatNOGS Network API key.
  
### 1. Prepare Raspberry Pi
+
== Prepare Raspberry Pi ==
  
**Step 1.1:** Download fedora minimal or server RPi image (current 26) from `ARM Fedora Project <https://arm.fedoraproject.org/>`_ (server edition provides a nice web interface, admin console, with several stats and SSH access).
+
* Download fedora minimal or server RPi image (current 26) from [https://arm.fedoraproject.org/ Fedora ARM Project] (server edition provides a nice web interface, admin console, with several stats and SSH access).
  
**Step 1.2:** Connect SD card to your computer/laptop and prepare it as described at `Fedora Wiki <https://fedoraproject.org/wiki/Raspberry_Pi#Preparing_the_SD_card>`_ (don't forget to `resize the root partition <https://fedoraproject.org/wiki/Raspberry_Pi#Resizing_the_root_partition>`_).
+
* Connect SD card to your computer/laptop and prepare it as described at [https://fedoraproject.org/wiki/Raspberry_Pi#Preparing_the_SD_card Fedora wiki] (don't forget to [https://fedoraproject.org/wiki/Raspberry_Pi#Resizing_the_root_partition resize the root partition]).
  
**Step 1.3:** Attach sdcard to your RPi, plug in the HDMI cable, keyboard and ethernet and turn on the HDMI screen. Plug RPi to the power source.
+
* Attach sdcard to your RPi, plug in the HDMI cable, keyboard and ethernet and turn on the HDMI screen. Plug RPi to the power source.
  
**Step 1.4:** Fedora installation starts, follow the steps that show up in the screen. You'll have to setup:
+
* Fedora installation starts, follow the steps that show up in the screen. You'll have to setup:
  * root password
+
** root password
  * network connection
+
** network connection
  * timezone and ntp server, add at least one, `pool.ntp.org` is suggested
+
** timezone and ntp server, add at least one, `pool.ntp.org` is suggested
  * a new user, e.g. `satnogs`. Don't forget to set administrator flag and add user to `dialout` group (needed for having access to sdr device).
+
** a new user, e.g. `satnogs`. Don't forget to set administrator flag and add user to `dialout` group (needed for having access to sdr device).
  
**Step 1.5:** From now on you are able to access you RPi directly or through SSH. You can also use admin console if you have selected the fedora server version.
+
* From now on you are able to access you RPi directly or through SSH. You can also use admin console if you have selected the fedora server version.
  
**Step 1.6:** Update fedora package to the latest version by running::
+
* Update fedora package to the latest version by running:
  
 +
<pre>
 
     sudo dnf -y update
 
     sudo dnf -y update
 +
</pre>
  
**Step 1.7:** Install dependencies for gr-satnogs and satnogs-client::
+
* Install dependencies for gr-satnogs and satnogs-client:
  
 +
<pre>
 
     sudo dnf install -y util-linux-user git gcc redhat-rpm-config python-devel redis vorbis-tools hamlib gnuradio gnuradio-devel cmake swig fftw3-devel gcc-c++ cppunit cppunit-devel doxygen gr-osmosdr libnova libnova-devel gnuplot libvorbis-devel libffi-devel openssl-devel libpng-devel
 
     sudo dnf install -y util-linux-user git gcc redhat-rpm-config python-devel redis vorbis-tools hamlib gnuradio gnuradio-devel cmake swig fftw3-devel gcc-c++ cppunit cppunit-devel doxygen gr-osmosdr libnova libnova-devel gnuplot libvorbis-devel libffi-devel openssl-devel libpng-devel
 +
</pre>
  
**Step 1.8:** In order to expand the lifetime of the SD Card, edit /etc/fstab file with your favourite editor:
+
* In order to expand the lifetime of the SD Card, edit /etc/fstab file with your favourite editor:
  * Comment out the line of the swap partition
+
** Comment out the line of the swap partition
  * Only if you used the "minimal" Fedora installation (not the "server" build), change options of root partition line (/ ext4) from `defaults,noatime` to `defaults,noatime,commit=1800`. This change means that changes on root partition will be written on SD Card every 30min
+
** Only if you used the "minimal" Fedora installation (not the "server" build), change options of root partition line (/ ext4) from `defaults,noatime` to `defaults,noatime,commit=1800`. This change means that changes on root partition will be written on SD Card every 30min
  * Move /var/log and /var/tmp directories to memory by adding the following two lines::
+
** Move /var/log and /var/tmp directories to memory by adding the following two lines:
  
 +
<pre>
 
       tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=120m 0 0
 
       tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=120m 0 0
 
       tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=80m 0 0
 
       tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=80m 0 0
 +
</pre>
  
**Step 1.9:** Automate creating of redis directory in /var/log path after boot by running::
+
* Automate creating of redis directory in /var/log path after boot by running:
  
 +
<pre>
 
     sudo sh -c 'echo "#Type Path                Mode UID  GID  Age Argument" > /etc/tmpfiles.d/logdirs.conf'
 
     sudo sh -c 'echo "#Type Path                Mode UID  GID  Age Argument" > /etc/tmpfiles.d/logdirs.conf'
 
     sudo sh -c 'echo "d    /var/log/redis      0750 redis redis 1d  -" >> /etc/tmpfiles.d/logdirs.conf'
 
     sudo sh -c 'echo "d    /var/log/redis      0750 redis redis 1d  -" >> /etc/tmpfiles.d/logdirs.conf'
 +
</pre>
  
**Step 1.10:** Enable and start Redis service in order to run automatically on startup::
+
* Enable and start Redis service in order to run automatically on startup:
  
 +
<pre>
 
     sudo systemctl enable redis.service
 
     sudo systemctl enable redis.service
 
     sudo systemctl start redis.service
 
     sudo systemctl start redis.service
 +
</pre>
  
**Step 1.11:** Configure automatic cleanup of old data (while this is an optional step, if old files are not cleaned out regularly you run the risk of filling your disk over time)
+
* Configure automatic cleanup of old data (while this is an optional step, if old files are not cleaned out regularly you run the risk of filling your disk over time)
  * As-is this will clean out files older than 1 week. Adjust mtime to your liking
+
** As-is this will clean out files older than 1 week. Adjust mtime to your liking
  * Create /etc/cron.daily/satnogs with your favorite editor and add the following::
+
** Create /etc/cron.daily/satnogs with your favorite editor and add the following:
  
 +
<pre>
 
       #!/bin/sh
 
       #!/bin/sh
 
       find /tmp/.satnogs/data -type f -mtime +7 -delete
 
       find /tmp/.satnogs/data -type f -mtime +7 -delete
 +
</pre>
  
  * Then run::
+
** Then run:
  
 +
<pre>
 
       sudo chmod +x /etc/cron.daily/satnogs
 
       sudo chmod +x /etc/cron.daily/satnogs
 +
</pre>
  
**Step 1.12:** If you used Fedora Server, configure firewall for SatNOGS web user interface
+
* If you used Fedora Server, configure firewall for SatNOGS web user interface
  * Create /usr/lib/firewalld/services/satnogs.xml and add the following::
+
** Create /usr/lib/firewalld/services/satnogs.xml and add the following:
  
 +
<pre>
 
       <?xml version="1.0" encoding="utf-8"?>
 
       <?xml version="1.0" encoding="utf-8"?>
 
         <service>
 
         <service>
Line 75: Line 90:
 
         <port protocol="tcp" port="5000"/>
 
         <port protocol="tcp" port="5000"/>
 
       </service>
 
       </service>
 +
</pre>
  
  * If you used the server image run::
+
** If you used the server image run:
  
 +
<pre>
 
       sudo firewall-cmd --zone=FedoraServer --add-service=satnogs --permanent
 
       sudo firewall-cmd --zone=FedoraServer --add-service=satnogs --permanent
 
       sudo firewall-cmd --zone=FedoraServer --add-service=satnogs
 
       sudo firewall-cmd --zone=FedoraServer --add-service=satnogs
 +
</pre>
  
  * Or for the minimal image::
+
** Or for the minimal image:
  
 +
<pre>
 
       sudo firewall-cmd --zone=public --add-service=satnogs --permanent
 
       sudo firewall-cmd --zone=public --add-service=satnogs --permanent
 
       sudo firewall-cmd --zone=public --add-service=satnogs
 
       sudo firewall-cmd --zone=public --add-service=satnogs
 +
</pre>
  
 
+
== Install gr-satnogs ==
### 2. Install gr-satnogs
 
  
 
SatNOGS Client uses GNU Radio scripts in order to get observation data from satelites, gr-satnogs provide this functionality.
 
SatNOGS Client uses GNU Radio scripts in order to get observation data from satelites, gr-satnogs provide this functionality.
  
**Step 2.1:**: Install gr-satnogs by running the next commands::
+
* Run the following command to install the packaged version of SatNOGS Client:
  
 +
<pre>
 
     git clone https://github.com/satnogs/gr-satnogs.git
 
     git clone https://github.com/satnogs/gr-satnogs.git
 
     cd gr-satnogs
 
     cd gr-satnogs
Line 102: Line 122:
 
     sudo sh -c 'echo /usr/lib64 > /etc/ld.so.conf.d/lib64.conf'
 
     sudo sh -c 'echo /usr/lib64 > /etc/ld.so.conf.d/lib64.conf'
 
     sudo ldconfig
 
     sudo ldconfig
 +
</pre>
  
 
+
== Install satnogs-client ==
### 3. Install satnogs-client
 
  
 
Building from source is outside of the scope of this document, we will use the packaged install for now.
 
Building from source is outside of the scope of this document, we will use the packaged install for now.
  
**Step 3.1:** Run the following command to install the packaged version of SatNOGS Client::
+
Run the following command to install the packaged version of SatNOGS Client
  
 +
<pre>
 
   sudo pip install satnogsclient
 
   sudo pip install satnogsclient
 +
</pre>
  
 
+
== Configure satnogs-client ==
### 4. Configure satnogs-client
 
  
 
SatNOGS Client needs some configuration before running:
 
SatNOGS Client needs some configuration before running:
  
**Step 4.1:** Create a .env file in your home directory (`~/.env`) and add station's details as they are defined at SatNOGS Network::
+
* Create a .env file in your home directory (`~/.env`) and add station's details as they are defined at SatNOGS Network:
  
 +
<pre>
 
     export SATNOGS_API_TOKEN="1234567890qwertyuiopasdfghjklzxcvbnm1234"
 
     export SATNOGS_API_TOKEN="1234567890qwertyuiopasdfghjklzxcvbnm1234"
 
     export SATNOGS_STATION_ID="65"
 
     export SATNOGS_STATION_ID="65"
Line 125: Line 147:
 
     export SATNOGS_STATION_ELEV="150"
 
     export SATNOGS_STATION_ELEV="150"
 
     export SATNOGS_NETWORK_API_URL="https://network-dev.satnogs.org/api/"
 
     export SATNOGS_NETWORK_API_URL="https://network-dev.satnogs.org/api/"
 +
</pre>
  
.. _optional_settings:
+
=== Optional settings ===
  
**Step 4.2:** There are more option you can export in the created .env file. You will probably need to change the default values of the settings bellow:
+
* There are more option you can export in the created .env file. You will probably need to change the default values of the settings bellow:
  
SATNOGS_RX_DEVICE
+
* SATNOGS_RX_DEVICE
  * Defines the sdr device. It could be 'usrpb200' or 'rtlsdr'.
+
** Defines the sdr device. It could be 'usrpb200' or 'rtlsdr'.
  * Default Type: string
+
** Default Type: string
  * Default Value: 'rtlsdr'
+
** Default Value: 'rtlsdr'
  
SATNOGS_PPM_ERROR
+
*SATNOGS_PPM_ERROR
  * Defines PPM error of sdr, check :doc:`finding-ppm` for more details on PPM.
+
** Defines PPM error of sdr, check :doc:`finding-ppm` for more details on PPM.
  * Default Type: integer
+
** Default Type: integer
  * Default Value: 0
+
** Default Value: 0
  
**Step 4.3:** Other optional settings:
+
Other optional settings:
  
SATNOGS_APP_PATH
+
* SATNOGS_APP_PATH
  * Defines the path where the sqlite database will be created.
+
** Defines the path where the sqlite database will be created.
  * Default Type: string
+
** Default Type: string
  * Default Value: '/tmp/.satnogs'
+
** Default Value: '/tmp/.satnogs'
  
SATNOGS_OUTPUT_PATH
+
* SATNOGS_OUTPUT_PATH
  * Defines the path where the observation data will be saved.
+
** Defines the path where the observation data will be saved.
  * Default Type: string
+
** Default Type: string
  * Default Value: '/tmp/.satnogs/data'
+
** Default Value: '/tmp/.satnogs/data'
  
SATNOGS_COMPLETE_OUTPUT_PATH
+
* SATNOGS_COMPLETE_OUTPUT_PATH
  * Defines the path where data will be moved after succesful upload on network.
+
** Defines the path where data will be moved after succesful upload on network.
  * Default Type: string
+
** Default Type: string
  * Default Value: ''
+
** Default Value: ''
  
SATNOGS_INCOMPLETE_OUTPUT_PATH
+
* SATNOGS_INCOMPLETE_OUTPUT_PATH
  * Defines the path where data will be moved after unsuccesful upload on network.
+
** Defines the path where data will be moved after unsuccesful upload on network.
  * Default Type: string
+
** Default Type: string
  * Default Value: '/tmp/.satnogs/data/incomplete'
+
** Default Value: '/tmp/.satnogs/data/incomplete'
  
SATNOGS_ROT_IP
+
* SATNOGS_ROT_IP
  * Defines IP address where rotctld process listens.
+
** Defines IP address where rotctld process listens.
  * Default Type: string
+
** Default Type: string
  * Default Value: '127.0.0.1'
+
** Default Value: '127.0.0.1'
  
SATNOGS_ROT_PORT
+
* SATNOGS_ROT_PORT
  * Defines port where rotctld process listens.
+
** Defines port where rotctld process listens.
  * Default Type: integer
+
** Default Type: integer
  * Default Value: 4533
+
** Default Value: 4533
  
SATNOGS_RIG_IP
+
* SATNOGS_RIG_IP
  * Defines IP address where rigctld process listens.
+
** Defines IP address where rigctld process listens.
  * Default Type: string
+
** Default Type: string
  * Default Value: '127.0.0.1'
+
** Default Value: '127.0.0.1'
  
SATNOGS_RIG_PORT
+
* SATNOGS_RIG_PORT
  * Defines port where rigctld process listens.
+
** Defines port where rigctld process listens.
  * Default Type: integer
+
** Default Type: integer
  * Default Value: 4532
+
** Default Value: 4532
  
  
### 5. Prepare SDR Device
+
== Prepare SDR Device ==
  
In order to have access and use SDR device you need to follow the next steps for you device:
+
In order to have access and use SDR device you need to follow the next steps for your device:
 +
The next step is to access and use the SDR device you have.  Which steps you follow depends on your device.
  
^^^^^^^^^^^^
+
=== USRP B200 ===
1. USRP B200
 
^^^^^^^^^^^^
 
**Step 5.1.1:** Install uhd package::
 
  
 +
* Install uhd package:
 +
 +
<pre>
 
     sudo dnf install -y uhd
 
     sudo dnf install -y uhd
 +
</pre>
  
**Step 5.1.2:** Download uhd images::
+
* Download uhd images:
  
 +
<pre>
 
     sudo /usr/bin/uhd_images_downloader
 
     sudo /usr/bin/uhd_images_downloader
 +
</pre>
  
**Step 5.1.3:** As the access will be only by ssh and not by direct login we are not be able to access SDR device through `Access Control List(ACL) <https://en.wikipedia.org/wiki/Access_control_list>`_, so we need to setup the appropriate udev rules by following the next steps:
+
* As the access will be only by ssh and not by direct login we are not be able to access SDR device through [https://en.wikipedia.org/wiki/Access_control_list Access Control List (ACL)], so we need to setup the appropriate udev rules by following the next steps:
  
  * Copy udev rules from `/usr/lib/udev/rules.d/10-usrp-uhd.rules` to `/etc/udev/rules.d/10-usrp-uhd.rules`::
+
* Copy udev rules from `/usr/lib/udev/rules.d/10-usrp-uhd.rules` to `/etc/udev/rules.d/10-usrp-uhd.rules`:
  
 +
<pre>
 
       sudo cp /usr/lib/udev/rules.d/10-usrp-uhd.rules /etc/udev/rules.d/10-usrp-uhd.rules
 
       sudo cp /usr/lib/udev/rules.d/10-usrp-uhd.rules /etc/udev/rules.d/10-usrp-uhd.rules
 +
</pre>
  
  * Replace ACL reference::
+
* Replace ACL reference:
  
 +
<pre>
 
       sudo sed -i 's/0", ENV{ID_SOFTWARE_RADIO}="1"/6"/g' /etc/udev/rules.d/10-usrp-uhd.rules
 
       sudo sed -i 's/0", ENV{ID_SOFTWARE_RADIO}="1"/6"/g' /etc/udev/rules.d/10-usrp-uhd.rules
 +
</pre>
  
  * Reload udev rules::
+
* Reload udev rules:
  
 +
<pre>
 
       sudo udevadm control --reload-rules
 
       sudo udevadm control --reload-rules
 +
</pre>
  
  * Confirm access on device by running (without sudo, just as single user)::
+
* Confirm access on device by running (without sudo, just as single user):
  
 +
<pre>
 
       uhd_find_devices
 
       uhd_find_devices
 +
</pre>
  
  * In case you don't have access, make sure that the device is connected and that the created user is member of the `dialout` group by running::
+
* In case you don't have access, make sure that the device is connected and that the created user is member of the `dialout` group by running:
  
 +
<pre>
 
       groups
 
       groups
 +
</pre>
  
  * If user isn't member of `dialout` group run (replace satnogs with the username of your user)::
+
* If user isn't member of `dialout` group run (replace satnogs with the username of your user):
  
 +
<pre>
 
       sudo usermod -aG dialout satnogs
 
       sudo usermod -aG dialout satnogs
 +
</pre>
  
^^^^^^^^^^^^
+
=== RTL-SDR ===
2. RTL-SDR
 
^^^^^^^^^^^^
 
**Step 5.2.1:** As the access will be only by ssh and not by direct login we are not be able to access SDR device through `Access Control List(ACL) <https://en.wikipedia.org/wiki/Access_control_list>`_, so we need to setup the appropriate udev rules by following the next steps:
 
  
  * Copy udev rules from `/usr/lib/udev/rules.d/10-rtl-sdr.rules` to `/etc/udev/rules.d/10-rtl-sdr.rules`::
+
As the access will be only by ssh and not by direct login we are not be able to access SDR device through [https://en.wikipedia.org/wiki/Access_control_list Access Control List (ACL)], so we need to setup the appropriate udev rules by following the next steps:
  
 +
* Copy udev rules from `/usr/lib/udev/rules.d/10-rtl-sdr.rules` to `/etc/udev/rules.d/10-rtl-sdr.rules`:
 +
 +
<pre>
 
       sudo cp /usr/lib/udev/rules.d/10-rtl-sdr.rules /etc/udev/rules.d/10-rtl-sdr.rules
 
       sudo cp /usr/lib/udev/rules.d/10-rtl-sdr.rules /etc/udev/rules.d/10-rtl-sdr.rules
 +
</pre>
  
  * Replace ACL reference and change group ownership::
+
* Replace ACL reference and change group ownership:
  
 +
<pre>
 
       sudo sed -i 's/0", ENV{ID_SOFTWARE_RADIO}="1"/6"/g' /etc/udev/rules.d/10-rtl-sdr.rules
 
       sudo sed -i 's/0", ENV{ID_SOFTWARE_RADIO}="1"/6"/g' /etc/udev/rules.d/10-rtl-sdr.rules
 
       sudo sed -i 's/rtlsdr/dialout/g' /etc/udev/rules.d/10-rtl-sdr.rules
 
       sudo sed -i 's/rtlsdr/dialout/g' /etc/udev/rules.d/10-rtl-sdr.rules
 +
</pre>
  
  * Reload udev rules::
+
* Reload udev rules:
  
 +
<pre>
 
       sudo udevadm control --reload-rules
 
       sudo udevadm control --reload-rules
 +
</pre>
  
  * If your rtlsdr device was already plugged in, you will need to unplug it and plug it back in. Otherwise, it is safe to plug it in now.
+
* If your rtlsdr device was already plugged in, you will need to unplug it and plug it back in. Otherwise, it is safe to plug it in now.
  
  * In case you don't have access, make sure that the device is connected and that the created user is member of the `dialout` group by running::
+
* In case you don't have access, make sure that the device is connected and that the created user is member of the `dialout` group by running:
  
 +
<pre>
 
       groups
 
       groups
 +
</pre>
  
  * If user isn't member of `dialout` group run (replace satnogs with the username of your user)::
+
* If user isn't member of `dialout` group run (replace satnogs with the username of your user):
  
 +
<pre>
 
       sudo usermod -aG dialout satnogs
 
       sudo usermod -aG dialout satnogs
 +
</pre>
  
  * If you had to take that step, log out and log back in
+
* If you had to take that step, log out and log back in.
  
  
### 6. Run satnogs-client
+
== Run satnogs-client ==
 +
 
 +
===  Manually ===
  
^^^^^^^^^^^
 
1. Manually
 
^^^^^^^^^^^
 
 
In order to manually run satnogs-client you need to follow the next steps:
 
In order to manually run satnogs-client you need to follow the next steps:
  
**Step 6.1.1:** Export all the environment variables::
+
* Export all the environment variables:
  
 +
<pre>
 
     source .env
 
     source .env
 +
</pre>
  
**Step 6.1.2:** Start rotctl daemon(note: given example parameters bellow, you may need to change, add or omit some of them. For a Yaesu G-5500 use -m 601 and -s 9600)::
+
* Start rotctl daemon(note: given example parameters bellow, you may need to change, add or omit some of them. For a Yaesu G-5500 use -m 601 and -s 9600):
  
 +
<pre>
 
     rotctld -m 202 -r /dev/ttyACM0 -s 19200 &
 
     rotctld -m 202 -r /dev/ttyACM0 -s 19200 &
 +
</pre>
  
**Step 6.1.3:** Run the SatNOGS Client::
+
* Run the SatNOGS Client:
  
 +
<pre>
 
     satnogs-client
 
     satnogs-client
 +
</pre>
  
 
**At this point your client should be fully functional! It will check in with the network URL at a 1 minute interval. You should check your ground station page on the website, the station ID will be in a red box until the station checks in, at which time it will turn green. There are many ways to automate the running and control of satnogs, we will give you 2 options below, supervisord and systemd.**
 
**At this point your client should be fully functional! It will check in with the network URL at a 1 minute interval. You should check your ground station page on the website, the station ID will be in a red box until the station checks in, at which time it will turn green. There are many ways to automate the running and control of satnogs, we will give you 2 options below, supervisord and systemd.**
  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
2. Automaticaly with Supervisord
 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
  
`Supervisord <http://supervisord.org/introduction.html>`_ is one of the ways to automatically run SatNOGS Client. This is very useful especialy after a power failure or reboot of raspberry pi.
+
=== Automaticaly with Supervisord ===
 +
 
 +
[http://supervisord.org/introduction.html Supervisord] is one of the ways to automatically run SatNOGS Client. This is very useful especialy after a power failure or reboot of raspberry pi.
  
 
In order to setup supervisord we need to follow the next steps:
 
In order to setup supervisord we need to follow the next steps:
  
**Step 6.2.1:** Install supervisord::
+
* Install supervisord:
  
 +
<pre>
 
     sudo dnf install -y supervisor
 
     sudo dnf install -y supervisor
 +
</pre>
  
**Step 6.2.2:** Automate creating of supervisor directory in /var/log path after boot by running::
+
* Automate creating of supervisor directory in /var/log path after boot by running:
  
 +
<pre>
 
     sudo sh -c 'echo "d    /var/log/supervisor 0750 root  root  3d  -" >> /etc/tmpfiles.d/logdirs.conf'
 
     sudo sh -c 'echo "d    /var/log/supervisor 0750 root  root  3d  -" >> /etc/tmpfiles.d/logdirs.conf'
 +
</pre>
  
**Step 6.2.3:** Configure supervisord for rotctld
+
* Configure supervisord for rotctld
  
Open with sudo and your favorite editor and add this into /etc/supervisord.d/rotctld.ini::
+
Open with sudo and your favorite editor and add this into /etc/supervisord.d/rotctld.ini:
  
 +
<pre>
 
   [program:rotctld]
 
   [program:rotctld]
 
   command=/usr/bin/rotctld <rotctld PARAMETERS>
 
   command=/usr/bin/rotctld <rotctld PARAMETERS>
Line 304: Line 361:
 
   stdout_logfile=/var/log/supervisor/rotctld.log
 
   stdout_logfile=/var/log/supervisor/rotctld.log
 
   stderr_logfile=/var/log/supervisor/rotctld-error.log
 
   stderr_logfile=/var/log/supervisor/rotctld-error.log
 +
</pre>
  
 
Replace <USERNAME> with the username of the user you have created and <rotctld PARAMETERS> with the parameters needed to run rotctl in your case.
 
Replace <USERNAME> with the username of the user you have created and <rotctld PARAMETERS> with the parameters needed to run rotctl in your case.
  
**Step 6.2.4:** Configure supervisord for satnogs-client
+
* Configure supervisord for satnogs-client
  
Add this into /etc/supervisord.d/satnogs.ini::
+
Add this into /etc/supervisord.d/satnogs.ini:
  
 +
<pre>
 
   [program:satnogs]
 
   [program:satnogs]
 
   command=/usr/bin/satnogs-client
 
   command=/usr/bin/satnogs-client
Line 319: Line 378:
 
   stdout_logfile=/var/log/supervisor/satnogs.log
 
   stdout_logfile=/var/log/supervisor/satnogs.log
 
   stderr_logfile=/var/log/supervisor/satnogs-error.log
 
   stderr_logfile=/var/log/supervisor/satnogs-error.log
 +
</pre>
  
 
Replace <USERNAME> with the username of the user you have created.
 
Replace <USERNAME> with the username of the user you have created.
Line 324: Line 384:
 
you can also add in this list any other of the :ref:`optional settings <optional_settings>`.
 
you can also add in this list any other of the :ref:`optional settings <optional_settings>`.
  
**Step 6.2.5:** Reloading supervisord to get the new configuration::
+
* Reloading supervisord to get the new configuration:
  
 +
<pre>
 
   sudo systemctl enable supervisord.service
 
   sudo systemctl enable supervisord.service
 
   sudo systemctl start supervisord.service
 
   sudo systemctl start supervisord.service
 +
</pre>
  
 
With that rotctld and satnogs-client should have started, you can follow the logs in /var/log/supervisor/.
 
With that rotctld and satnogs-client should have started, you can follow the logs in /var/log/supervisor/.
  
*NOTE:* In case that you want to change something in .ini files like satnogs environment variables (url from the dev one to production one), then you will need to run::
+
*NOTE:* In case that you want to change something in .ini files like satnogs environment variables (url from the dev one to production one), then you will need to run:
  
 
  sudo supervisorctl reload
 
  sudo supervisorctl reload
  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
3. Automaticaly with Systemd
 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
  
`Systemd <https://www.freedesktop.org/wiki/Software/systemd/>`_ is one of the ways to automatically run SatNOGS Client. This is very useful especialy after a power failure or reboot of raspberry pi.
+
=== Automaticaly with Systemd ===
 +
 
 +
 
 +
[https://www.freedesktop.org/wiki/Software/systemd/ Systemd] is one of the ways to automatically run SatNOGS Client. This is very useful especialy after a power failure or reboot of raspberry pi.
  
 
In order to setup systemd we need to follow the next steps:
 
In order to setup systemd we need to follow the next steps:
  
**Step 6.3.1:** Create the script which will initialize and run rotctld and satnogs-client in your home directory (`~/start-satnogs-client.sh`) with the following content::
+
* Create the script which will initialize and run rotctld and satnogs-client in your home directory (`~/start-satnogs-client.sh`) with the following content:
  
 +
<pre>
 
     rotctld <rotctld PARAMETERS> &
 
     rotctld <rotctld PARAMETERS> &
 
     date >> satnogs-auto.log
 
     date >> satnogs-auto.log
 
     source .env
 
     source .env
 
     satnogs-client
 
     satnogs-client
 +
</pre>
  
 
Replace <rotctld PARAMETERS> with the parameters needed to run rotctl in your case.
 
Replace <rotctld PARAMETERS> with the parameters needed to run rotctl in your case.
  
**Step 6.3.2:** Create as root the file /lib/systemd/system/satnogs-client.service and add the following content::
+
* Create as root the file /lib/systemd/system/satnogs-client.service and add the following content:
  
 +
<pre>
 
     [Unit]
 
     [Unit]
 
     Description=Satnogs Client
 
     Description=Satnogs Client
Line 367: Line 432:
 
     [Install]
 
     [Install]
 
     WantedBy=multi-user.target
 
     WantedBy=multi-user.target
 +
</pre>
  
 
Replace <USERNAME> with the username of the user you have created.
 
Replace <USERNAME> with the username of the user you have created.
  
**Step 6.3.3:** Enable and start satnogs-client.service::
+
* Enable and start satnogs-client.service:
  
 +
<pre>
 
     sudo systemctl enable satnogs-client.service
 
     sudo systemctl enable satnogs-client.service
 
     sudo systemctl start satnogs-client.service
 
     sudo systemctl start satnogs-client.service
 +
</pre>
  
With that rotctld and satnogs-client should have started, you can follow the logs with journactl::
+
With that rotctld and satnogs-client should have started, you can follow the logs with journactl:
  
 +
<pre>
 
     journalctl -u satnogs-client.service
 
     journalctl -u satnogs-client.service
 +
</pre>
  
Use `-f` flag if you want to see the latest updates on logs::
+
Use `-f` flag if you want to see the latest updates on logs:
  
 +
<pre>
 
     journalctl -f -u satnogs-client.service
 
     journalctl -f -u satnogs-client.service
 +
</pre>
  
*NOTE:* In case that you want to change something in start-satnogs-client.sh, make the change and then run::
+
*NOTE:* In case that you want to change something in start-satnogs-client.sh, make the change and then run:
  
 +
<pre>
 
     sudo systemctl stop satnogs-client.service
 
     sudo systemctl stop satnogs-client.service
 
     sudo systemctl start satnogs-client.service
 
     sudo systemctl start satnogs-client.service
 +
</pre>
  
*NOTE:* In case that you want to change something in satnogs-client.service, make the change and then run::
+
*NOTE:* In case that you want to change something in satnogs-client.service, make the change and then run:
  
 +
<pre>
 
     sudo systemctl daemon-reload
 
     sudo systemctl daemon-reload
 +
</pre>

Revision as of 20:37, 2 February 2019

Installing SatNOGS on Fedora runnning on a Raspberry Pi 3

Important.png
This is not a supported method of running gr-satnogs and the SatNOGS client. Your success may vary.

This tutorial assumes the following:

1. You have a Raspberry Pi 3 with external power (5V, 2A).

2. USB keyboard, HDMI screen, HDMI cable, network cable (Wi-Fi isn't working on Fedora for now) and a Class 10 SDHC card at least 8GB.

3. One of the following sdr devices: RTL-SDR or USRP B200.

4. You have an account and a ground station registered on either network.satnogs.org or network-dev.satnogs.org_. This is needed for getting your ground station ID number and your SatNOGS Network API key.

Prepare Raspberry Pi

  • Download fedora minimal or server RPi image (current 26) from Fedora ARM Project (server edition provides a nice web interface, admin console, with several stats and SSH access).
  • Attach sdcard to your RPi, plug in the HDMI cable, keyboard and ethernet and turn on the HDMI screen. Plug RPi to the power source.
  • Fedora installation starts, follow the steps that show up in the screen. You'll have to setup:
    • root password
    • network connection
    • timezone and ntp server, add at least one, `pool.ntp.org` is suggested
    • a new user, e.g. `satnogs`. Don't forget to set administrator flag and add user to `dialout` group (needed for having access to sdr device).
  • From now on you are able to access you RPi directly or through SSH. You can also use admin console if you have selected the fedora server version.
  • Update fedora package to the latest version by running:
    sudo dnf -y update
  • Install dependencies for gr-satnogs and satnogs-client:
    sudo dnf install -y util-linux-user git gcc redhat-rpm-config python-devel redis vorbis-tools hamlib gnuradio gnuradio-devel cmake swig fftw3-devel gcc-c++ cppunit cppunit-devel doxygen gr-osmosdr libnova libnova-devel gnuplot libvorbis-devel libffi-devel openssl-devel libpng-devel
  • In order to expand the lifetime of the SD Card, edit /etc/fstab file with your favourite editor:
    • Comment out the line of the swap partition
    • Only if you used the "minimal" Fedora installation (not the "server" build), change options of root partition line (/ ext4) from `defaults,noatime` to `defaults,noatime,commit=1800`. This change means that changes on root partition will be written on SD Card every 30min
    • Move /var/log and /var/tmp directories to memory by adding the following two lines:
      tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=120m 0 0
      tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=80m 0 0
  • Automate creating of redis directory in /var/log path after boot by running:
    sudo sh -c 'echo "#Type Path                Mode UID   GID   Age Argument" > /etc/tmpfiles.d/logdirs.conf'
    sudo sh -c 'echo "d     /var/log/redis      0750 redis redis 1d  -" >> /etc/tmpfiles.d/logdirs.conf'
  • Enable and start Redis service in order to run automatically on startup:
    sudo systemctl enable redis.service
    sudo systemctl start redis.service
  • Configure automatic cleanup of old data (while this is an optional step, if old files are not cleaned out regularly you run the risk of filling your disk over time)
    • As-is this will clean out files older than 1 week. Adjust mtime to your liking
    • Create /etc/cron.daily/satnogs with your favorite editor and add the following:
      #!/bin/sh
      find /tmp/.satnogs/data -type f -mtime +7 -delete
    • Then run:
      sudo chmod +x /etc/cron.daily/satnogs
  • If you used Fedora Server, configure firewall for SatNOGS web user interface
    • Create /usr/lib/firewalld/services/satnogs.xml and add the following:
      <?xml version="1.0" encoding="utf-8"?>
        <service>
        <short>SatNOGS (HTTP)</short>
        <description>HTTP is the protocol used to serve Web pages. If you plan to make your Web server publicly available, enable this option. This option is not required for viewing pages locally or developing Web pages.</description>
        <port protocol="tcp" port="5000"/>
      </service>
    • If you used the server image run:
      sudo firewall-cmd --zone=FedoraServer --add-service=satnogs --permanent
      sudo firewall-cmd --zone=FedoraServer --add-service=satnogs
    • Or for the minimal image:
      sudo firewall-cmd --zone=public --add-service=satnogs --permanent
      sudo firewall-cmd --zone=public --add-service=satnogs

Install gr-satnogs

SatNOGS Client uses GNU Radio scripts in order to get observation data from satelites, gr-satnogs provide this functionality.

  • Run the following command to install the packaged version of SatNOGS Client:
    git clone https://github.com/satnogs/gr-satnogs.git
    cd gr-satnogs
    mkdir build
    cd build
    cmake -DLIB_SUFFIX=64 -DCMAKE_INSTALL_PREFIX=/usr ..
    make -j4
    sudo make install
    sudo sh -c 'echo /usr/lib64 > /etc/ld.so.conf.d/lib64.conf'
    sudo ldconfig

Install satnogs-client

Building from source is outside of the scope of this document, we will use the packaged install for now.

Run the following command to install the packaged version of SatNOGS Client

   sudo pip install satnogsclient

Configure satnogs-client

SatNOGS Client needs some configuration before running:

  • Create a .env file in your home directory (`~/.env`) and add station's details as they are defined at SatNOGS Network:
    export SATNOGS_API_TOKEN="1234567890qwertyuiopasdfghjklzxcvbnm1234"
    export SATNOGS_STATION_ID="65"
    export SATNOGS_STATION_LAT="40.662"
    export SATNOGS_STATION_LON="23.337"
    export SATNOGS_STATION_ELEV="150"
    export SATNOGS_NETWORK_API_URL="https://network-dev.satnogs.org/api/"

Optional settings

  • There are more option you can export in the created .env file. You will probably need to change the default values of the settings bellow:
  • SATNOGS_RX_DEVICE
    • Defines the sdr device. It could be 'usrpb200' or 'rtlsdr'.
    • Default Type: string
    • Default Value: 'rtlsdr'
  • SATNOGS_PPM_ERROR
    • Defines PPM error of sdr, check :doc:`finding-ppm` for more details on PPM.
    • Default Type: integer
    • Default Value: 0

Other optional settings:

  • SATNOGS_APP_PATH
    • Defines the path where the sqlite database will be created.
    • Default Type: string
    • Default Value: '/tmp/.satnogs'
  • SATNOGS_OUTPUT_PATH
    • Defines the path where the observation data will be saved.
    • Default Type: string
    • Default Value: '/tmp/.satnogs/data'
  • SATNOGS_COMPLETE_OUTPUT_PATH
    • Defines the path where data will be moved after succesful upload on network.
    • Default Type: string
    • Default Value:
  • SATNOGS_INCOMPLETE_OUTPUT_PATH
    • Defines the path where data will be moved after unsuccesful upload on network.
    • Default Type: string
    • Default Value: '/tmp/.satnogs/data/incomplete'
  • SATNOGS_ROT_IP
    • Defines IP address where rotctld process listens.
    • Default Type: string
    • Default Value: '127.0.0.1'
  • SATNOGS_ROT_PORT
    • Defines port where rotctld process listens.
    • Default Type: integer
    • Default Value: 4533
  • SATNOGS_RIG_IP
    • Defines IP address where rigctld process listens.
    • Default Type: string
    • Default Value: '127.0.0.1'
  • SATNOGS_RIG_PORT
    • Defines port where rigctld process listens.
    • Default Type: integer
    • Default Value: 4532


Prepare SDR Device

In order to have access and use SDR device you need to follow the next steps for your device: The next step is to access and use the SDR device you have. Which steps you follow depends on your device.

USRP B200

  • Install uhd package:
    sudo dnf install -y uhd
  • Download uhd images:
    sudo /usr/bin/uhd_images_downloader
  • As the access will be only by ssh and not by direct login we are not be able to access SDR device through Access Control List (ACL), so we need to setup the appropriate udev rules by following the next steps:
  • Copy udev rules from `/usr/lib/udev/rules.d/10-usrp-uhd.rules` to `/etc/udev/rules.d/10-usrp-uhd.rules`:
      sudo cp /usr/lib/udev/rules.d/10-usrp-uhd.rules /etc/udev/rules.d/10-usrp-uhd.rules
  • Replace ACL reference:
      sudo sed -i 's/0", ENV{ID_SOFTWARE_RADIO}="1"/6"/g' /etc/udev/rules.d/10-usrp-uhd.rules
  • Reload udev rules:
      sudo udevadm control --reload-rules
  • Confirm access on device by running (without sudo, just as single user):
      uhd_find_devices
  • In case you don't have access, make sure that the device is connected and that the created user is member of the `dialout` group by running:
      groups
  • If user isn't member of `dialout` group run (replace satnogs with the username of your user):
      sudo usermod -aG dialout satnogs

RTL-SDR

As the access will be only by ssh and not by direct login we are not be able to access SDR device through Access Control List (ACL), so we need to setup the appropriate udev rules by following the next steps:

  • Copy udev rules from `/usr/lib/udev/rules.d/10-rtl-sdr.rules` to `/etc/udev/rules.d/10-rtl-sdr.rules`:
      sudo cp /usr/lib/udev/rules.d/10-rtl-sdr.rules /etc/udev/rules.d/10-rtl-sdr.rules
  • Replace ACL reference and change group ownership:
      sudo sed -i 's/0", ENV{ID_SOFTWARE_RADIO}="1"/6"/g' /etc/udev/rules.d/10-rtl-sdr.rules
      sudo sed -i 's/rtlsdr/dialout/g' /etc/udev/rules.d/10-rtl-sdr.rules
  • Reload udev rules:
      sudo udevadm control --reload-rules
  • If your rtlsdr device was already plugged in, you will need to unplug it and plug it back in. Otherwise, it is safe to plug it in now.
  • In case you don't have access, make sure that the device is connected and that the created user is member of the `dialout` group by running:
      groups
  • If user isn't member of `dialout` group run (replace satnogs with the username of your user):
      sudo usermod -aG dialout satnogs
  • If you had to take that step, log out and log back in.


Run satnogs-client

Manually

In order to manually run satnogs-client you need to follow the next steps:

  • Export all the environment variables:
    source .env
  • Start rotctl daemon(note: given example parameters bellow, you may need to change, add or omit some of them. For a Yaesu G-5500 use -m 601 and -s 9600):
    rotctld -m 202 -r /dev/ttyACM0 -s 19200 &
  • Run the SatNOGS Client:
    satnogs-client
    • At this point your client should be fully functional! It will check in with the network URL at a 1 minute interval. You should check your ground station page on the website, the station ID will be in a red box until the station checks in, at which time it will turn green. There are many ways to automate the running and control of satnogs, we will give you 2 options below, supervisord and systemd.**


Automaticaly with Supervisord

Supervisord is one of the ways to automatically run SatNOGS Client. This is very useful especialy after a power failure or reboot of raspberry pi.

In order to setup supervisord we need to follow the next steps:

  • Install supervisord:
    sudo dnf install -y supervisor
  • Automate creating of supervisor directory in /var/log path after boot by running:
    sudo sh -c 'echo "d     /var/log/supervisor 0750 root  root  3d  -" >> /etc/tmpfiles.d/logdirs.conf'
  • Configure supervisord for rotctld

Open with sudo and your favorite editor and add this into /etc/supervisord.d/rotctld.ini:

   [program:rotctld]
   command=/usr/bin/rotctld <rotctld PARAMETERS>
   autostart=true
   autorestart=true
   user=<USERNAME>
   priority=1
   stdout_logfile=/var/log/supervisor/rotctld.log
   stderr_logfile=/var/log/supervisor/rotctld-error.log

Replace <USERNAME> with the username of the user you have created and <rotctld PARAMETERS> with the parameters needed to run rotctl in your case.

  • Configure supervisord for satnogs-client

Add this into /etc/supervisord.d/satnogs.ini:

   [program:satnogs]
   command=/usr/bin/satnogs-client
   autostart=true
   autorestart=true
   user=<USERNAME>
   environment=SATNOGS_NETWORK_API_URL="<URL>",SATNOGS_API_TOKEN="<TOKEN>",SATNOGS_STATION_ID="<ID>",SATNOGS_STATION_LAT="<LATITUDE>",SATNOGS_STATION_LON="<LONGITUDE>",SATNOGS_STATION_ELEV="<ELEVATION>"
   stdout_logfile=/var/log/supervisor/satnogs.log
   stderr_logfile=/var/log/supervisor/satnogs-error.log

Replace <USERNAME> with the username of the user you have created. Replace <...> instances in environment with the values you used in .env file, you can also add in this list any other of the :ref:`optional settings <optional_settings>`.

  • Reloading supervisord to get the new configuration:
  sudo systemctl enable supervisord.service
  sudo systemctl start supervisord.service

With that rotctld and satnogs-client should have started, you can follow the logs in /var/log/supervisor/.

  • NOTE:* In case that you want to change something in .ini files like satnogs environment variables (url from the dev one to production one), then you will need to run:
sudo supervisorctl reload


Automaticaly with Systemd

Systemd is one of the ways to automatically run SatNOGS Client. This is very useful especialy after a power failure or reboot of raspberry pi.

In order to setup systemd we need to follow the next steps:

  • Create the script which will initialize and run rotctld and satnogs-client in your home directory (`~/start-satnogs-client.sh`) with the following content:
    rotctld <rotctld PARAMETERS> &
    date >> satnogs-auto.log
    source .env
    satnogs-client

Replace <rotctld PARAMETERS> with the parameters needed to run rotctl in your case.

  • Create as root the file /lib/systemd/system/satnogs-client.service and add the following content:
    [Unit]
    Description=Satnogs Client
    Requires=redis.service
    After=redis.service

    [Service]
    User=<USERNAME>
    WorkingDirectory=/home/<USERNAME>/
    ExecStart=/bin/bash start-satnogs-client.sh
    KillMode=control-group

    [Install]
    WantedBy=multi-user.target

Replace <USERNAME> with the username of the user you have created.

  • Enable and start satnogs-client.service:
    sudo systemctl enable satnogs-client.service
    sudo systemctl start satnogs-client.service

With that rotctld and satnogs-client should have started, you can follow the logs with journactl:

    journalctl -u satnogs-client.service

Use `-f` flag if you want to see the latest updates on logs:

    journalctl -f -u satnogs-client.service
  • NOTE:* In case that you want to change something in start-satnogs-client.sh, make the change and then run:
    sudo systemctl stop satnogs-client.service
    sudo systemctl start satnogs-client.service
  • NOTE:* In case that you want to change something in satnogs-client.service, make the change and then run:
    sudo systemctl daemon-reload