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.
- 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.
- 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.
- 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.
- Type “crontab -e” and press enter.
- 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.
- Reboot your server.
-
- 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.
- Your SharkRF dashboard should be down at this point.
- Log back into your shark and up-elevate using “sudo -i“.
- 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:
- 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:
- We need to clone the latest version of the SharkRF connector and server. Type the following:
- “git clone https://github.com/sharkrf/srf-ip-conn-srv” and press enter
- “git clone https://github.com/sharkrf/srf-ip-conn” and press enter.
- Change permissions to our non-root user. “chown sharkservice:sharkservice * -R” and press enter.
- We will need to build out the new files. Type the following:
- 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:
- “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.
- “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.
- 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.
- Time to set perms (again). Type “cd /var” and press enter then type “chown sharkservice:sharkservice sharkrf -R” and press enter.
- Type “cd /var/sharkrf/srf-ip-conn-srv” and press enter then type “chown www-data:www-data dashboard -R” and press enter.
- 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.
- Your dashboard should be up and running now too:
- Type “ctrl c” (control + c) to stop the services.
- 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“.
- Type “exit” then “shutdown -r now“. Your server should reboot and your updated Shark server should be started momentarily.
- 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.