Updating SharkRF connector server on Ubuntu

Howdy! Just a heads up, this post is MANY years old. If you found this link on an external site, have no fear! I have a newer post here: https://www.johndball.com/2022-update-compiling-sharkrf-connector-server-on-ubuntu-22-04-1-lts/

73! ~KN4OLA

So you’ve deployed SharkRF perhaps following this guide (https://www.johndball.com/compiling-sharkrf-connector-server-on-ubuntu-16-04-lts/) and now you need to update your deployment.

  1. If you’re running your SharkRF server on a virtual machine, take a snapshot. In VMware ESXi, this is as simple as right-clicking on the virtual machine and selecting “take a snapshot“. If you aren’t running as a virtual machine and don’t have the ability to take a point-in-time backup, read down a few steps.
  2. Log into your server and up-elevate to your root account. For simplicity, I run as “sudo -i” which dumps you into an “always root” state for the session.
  3. If your SharkRF server auto-starts using crontab, we want to temporarily stop the server from auto-starting. In terminal type “su sharkserivce” (or the non-root account you created to run your service) and press enter.
  4. Type “crontab -e” and press enter.
  5. Scroll down to “@reboot” and put a # pound sign/hash sign in front of the “@” symbol. This is telling crontab to ignore this line at reboot.
    1. ctrl o” (control key + o) to save (write out) the file. Press enter.
    2. ctrl x” (control key + x) to exit.
  6. Reboot your server.
    1. If using the command line, type “exit” and press enter to get back to root (because we are running as a non-root user (step 3)), then type “shutdown -r now” and press enter.
  7. Your SharkRF dashboard should be down at this point.
  8. Log back into your shark and up-elevate using “sudo -i“.
  9. We’re going to copy both of our SharkRF directories into “backup” directories. The command is “cp” (copy), “-R” (recursive), “source folder”, “destination folder”. Navigate to the SharkRF folder by issuing the command “cd /var/sharkrf” and type the additional following commands:
    1. cp -R srf-ip-conn srf-ip-conn_backup” and press enter.
    2. cp -R srf-ip-conn-srv srf-ip-conn-srv_backup“and press enter.
    3. Type “ls” and press enter. You should see your source and backup folders. We’re not touching “jsmn”.
  10. We are going to delete the original folders. Scary, I know. Did you make your backups? Make sure you have backups and a tested way to recover to your data. This is on you! When you’re ready type:
    1. “rm -R srf-ip-conn” and press enter.
    2. rm -R srf-ip-conn-srv” and press enter.
    3. Type “ls” and press enter. You should see your backup folders. Again, we’re not touching “jsmn”.
  11. We need to clone the latest version of the SharkRF connector and server. Type the following:
    1. git clone https://github.com/sharkrf/srf-ip-conn-srv” and press enter
    2. git clone https://github.com/sharkrf/srf-ip-conn” and press enter.
  12. Change permissions to our non-root user. “chown sharkservice:sharkservice * -R” and press enter.
  13. We will need to build out the new files. Type the following:
    1. cd /var/sharkrf/srf-ip-conn-srv/build” and press enter, then run:
    2. SRF_IP_CONN_PATH=/var/sharkrf/srf-ip-conn JSMN_PATH=/var/sharkrf/jsmn ./build-release.sh” and press enter. You should see a lot of work taking place.
  14. Now we need to copy our config files from our backup folders to our production folders and rename the startup script. (It’s optional, but I don’t like working too deep in nested folders so feel free to type “cd /var/sharkrf” and press enter.) Then type the following:
    1. cp /var/sharkrf/srf-ip-conn-srv_backup/dashboard/config.inc.php /var/sharkrf/srf-ip-conn-srv/dashboard/config.inc.php” and press enter.
    2. cp /var/sharkrf/srf-ip-conn-srv_backup/build/Release/config.json /var/sharkrf/srf-ip-conn-srv/build/Release/config.json” and press enter.
    3. We need to rename the Shark server startup script and add a “.sh” extension to the end. Type “mv /var/sharkrf/srf-ip-conn-srv/build/Release/srf-ip-conn-srv /var/sharkrf/srf-ip-conn-srv/build/Release/srf-ip-conn-srv.sh” and press enter.
  15. Time to set perms (again). Type “cd /var” and press enter then type “chown sharkservice:sharkservice sharkrf -R” and press enter.
  16. Type “cd /var/sharkrf/srf-ip-conn-srv” and press enter then type “chown www-data:www-data dashboard -R” and press enter.
  17. Time to test. Type “su sharkservice” to log in as our sharkservice non-root user. Navigate by entering the command “cd /var/sharkrf/srf-ip-conn-srv/build/Release” and press enter.
    1. Start the service manually by entering “./srf-ip-conn-srv -f” and press enter.
  18. Your dashboard should be up and running now too:
  19. Type “ctrl c” (control + c) to stop the services.
  20. Type “crontab -e” and press enter. Find the “#” symbol we added to the start of our script and remove it. Type “ctrl o” (control + o), press enter, then “ctrl x“.
  21. Type “exit” then “shutdown -r now“. Your server should reboot and your updated Shark server should be started momentarily.
  22. Optional: I usually keep backup folders around but I will delete my snapshot. Just in case I have to manually go back to a previous version of the Shark server I’ll have the original backup folders on the server. Don’t forget to delete your VMware or other virtual machine snapshot once you are satisfied that everything is working properly. I personally wait about 5 days.

Leave a Reply

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