sudo apt install python3 python3-pip
cd /opt
sudo python3 -m venv weewx_venv
Activate the newly created virtualenv. Make sure to have root access.
sudo su
pip3 install Cheetah3 configobj ephem Pillow pyserial pyusb
Download from here the latest version tar archive. Install using the following commands:
tar -xvf weewx-*.*.*.tar.gz
cd weewx-*.*.*
vim setup.cfg
Now edit the install location and change it to /opt/weewx. Install the package
python3 ./setup.py build
python3 ./setup.py install
Create a new systemd service, system-wide.
vim /etc/systemd/system/weewx.service
Paste the following:
# systemd configuration for weewx
[Unit]
Description=weewx weather system
Requires=time-sync.target
After=time-sync.target
RequiresMountsFor=/home
[Service]
ExecStart=/opt/weewx_venv/bin/python3 /opt/weewx/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /opt/weewx/weewx.conf
ExecReload=/bin/kill -HUP $MAINPID
Type=forking
PIDFile=/var/run/weewx.pid
#User=weewx
#Group=weewx
[Install]
WantedBy=multi-user.target