Updated Guide: Weewx, Nginx, Belchertown, MQTT/WS

Nginx, from the official repository

Quick copy paste from: http://nginx.org/en/linux_packages.html#Debian

  1. apt install curl gnupg2 ca-certificates lsb-release
  2. echo "deb http://nginx.org/packages/debian `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
  3. curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
  4. apt-key fingerprint ABF5BD827BD9BF62
    • The output should look like this:
      pub rsa2048 2011-08-19 [SC] [expires: 2024-06-14]
      573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62
      uid [ unknown] nginx signing key signing-key@nginx.com
  5. apt update
  6. apt install nginx

Nginx has now been installed. You can do ps aux|grep nginx to ensure it’s running. If not, service nginx restart. Additionally, you can ensure it’s running the most recent stable release for Debian by issuing the nginx --version command. For me, I currently see nginx version: nginx/1.18.0

Remove Python2, install Python3

Python 2.x is effectively deprecated as of 2020 – unless you absolutely require Python 2.x for some reason. Going forward with Weewx, the developers wish to use Python 3.x+. On your Debian install, and if it’s a stand-alone installation for weewx only, you can remove all python 2.x libraries.

You can run apt purge python2* to expunge all python2 items. This will likely also throw out a ton of other libraries that python 2.x used as well. Do review the items on the list to ensure you’re not going to throw out packages that you may need to retain. But with a fresh install, this should not be the case.

Installing Python3.x series

The great folks at weewx.com wrote up an article on the Python3 needs for Weewx. Below will be a quick copy-paste of the commands I issued on my end for the Weewx 4.x install, which is more or less a condensed version of the aforementioned weewx link.

  1. apt install python3
  2. apt install python3-configobj python3-pil python3-serial python3-usb python3-pip python3-ephem
  3. apt install mariadb-client python3-mysqldb
  4. apt install python3-cheetah – Note that this may need to be substituted with the pip install command: pip3 install Cheetah3

Download and Install WeeWx 4.x

  1. wget http://weewx.com/downloads/weewx-4.1.1.tar.gz
  2. tar -zxf weewx-4.1.1.tar.gz
  3. cd weewx-4.1.1
  4. python3 ./setup.py build
  5. python3 ./setup.py install

Run through all the configuration options… site name, location, hardware, etc. Do continue modifying weewx.conf within /home/weewx/ – there are numerous options to set!!

Do not run weewx yet, as we’ll need to configure the auto-start options. Ensure you’re in the /home/weewx/ directory, run the following commands…

  1. cp util/init.d/weewx.debian /etc/init.d/weewx
  2. chmod +x /etc/init.d/weewx
  3. update-rc.d weewx defaults 98
  4. And now we start it: /etc/init.d/weewx start OR service weewx start

You can check to see if it’s running or not by issuing ps aux|grep weewx – you should see something like this returned: /usr/bin/python3 /home/weewx/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /home/weewx/weewx.conf – if not, check /var/log/syslog or /var/log/messages for any errors thrown.