Weewx

WeeWX: Installation on Debian-based systems

 

This is a guide to installing weeWX from a DEB package on Debian-based systems, including Ubuntu, Mint, and Raspbian.

Configure apt

Tell apt where to find the weeWX releases. This only has to be done once – the first time you install weeWX.

wget -qO - http://weewx.com/keys.html | sudo apt-key add -
wget -qO - http://weewx.com/apt/weewx.list | sudo tee /etc/apt/sources.list.d/weewx.list

Install

Use apt-get to install weeWX. The installer will prompt for a location, latitude/longitude, altitude, station type, and parameters specific to your station hardware.

sudo apt-get update
sudo apt-get install weewx

When you are done, weeWX will be running in the background as a daemon.

Status

To make sure things are running properly look in the system log for messages from weeWX.

sudo tail -f /var/log/syslog

Verify

After about 5 minutes, open the station web page in a web browser. You should see your station information and data.

file:///var/www/html/weewx/index.html

If your hardware supports hardware archiving, then how long you wait will depend on the archive interval set in your hardware.

Customize

To enable uploads such as Weather Underground or to customize reports, modify the configuration file /etc/weewx/weewx.conf. See the User Guide and Customization Guide for details.

WeeWX must be restarted for configuration file changes to take effect.

Start/Stop

To start/stop weeWX:

sudo /etc/init.d/weewx start
sudo /etc/init.d/weewx stop

Uninstall

To uninstall weeWX but retain configuration files and data:

sudo apt-get remove weewx

To uninstall weeWX, removing configuration files but retaining data:

sudo apt-get purge weewx

To remove data:

sudo rm -r /var/lib/weewx
sudo rm -r /var/www/html/weewx

Layout

The installation will result in the following layout:

executable: /usr/bin/weewxd
configuration file: /etc/weewx/weewx.conf
skins and templates: /etc/weewx/skins
sqlite databases: /var/lib/weewx/
generated web pages and images: /var/www/html/weewx/
documentation: /usr/share/doc/weewx/
examples: /usr/share/doc/weewx/examples/
utilities: /usr/bin/wee_*

Making backups

To backup a weeWX installation, you will need to make a copy of

  • configuration information;
  • skins and templates;
  • any custom code or extensions you have installed;
  • the weeWX database.

It is not necessary to backup the generated images, HTML files, or NOAA reports since weeWX will easily create these again.

Individual instructions follow.

Configuration

Save the weewx.conf file.

setup.py: /home/weewx/weewx.conf
DEB/RPM: /etc/weewx/weewx.conf

Skins and templates

Save the contents of the skins directory if you have modified the default skin or if you have added any new skins or template files.

setup.py: /home/weewx/skins
DEB/RPM: /etc/weewx/skins

Run a report at anytime:

sudo wee_reports /etc/weewx/weewx.conf

Custom code or extensions

Save the contents of the user directory if you have modified the database schema or added any extensions. If the extensions save data to a database you should backup those databases as well.

setup.py: /home/weewx/bin/user
DEB/RPM: /usr/share/weewx/user

Database

Finally, you will need to backup the database.

For a SQLite configuration, make a copy of the weewx.sdb file.

setup.py: /home/weewx/archive/weewx.sdb
DEB/RPM: /var/lib/weewx/weewx.sdb

Do not make the copy of the SQLite database while in the middle of a transaction! Schedule the backup for immediately after an archive record is written, and then make sure the backup completes before the next archive record arrives. Alternatively, stop weeWX, perform the backup, then restart weeWX.

For a MySQL configuration, save a dump of the archive database.

Restoring from backup

To restore from backup, do a fresh install of weeWX, replace the default files with those from a backup, then start weeWX.


Extra Required packages (For Almanac calculations):

# debian, ubuntu, mint, raspbian

# required packages:
sudo apt-get install python-configobj
sudo apt-get install python-cheetah
sudo apt-get install python-imaging

# required if hardware is serial or USB:
sudo apt-get install python-serial
sudo apt-get install python-usb

# required if using MySQL:
sudo apt-get install mysql-client
sudo apt-get install python-mysqldb

# required if using FTP on Raspbian systems:
sudo apt-get install ftp

# optional for extended almanac information:
sudo apt-get install python-dev
sudo apt-get install python-pip
sudo pip install pyephem


Dynamic DNS Updating

DYNU.COM setup – needed to update server IP address to dynu.com for DNS

You can make a script in Raspberry Pi and setup a cron job to run every 5 minutes to keep your hostnames updated to the most current IP address.

1. You can make a directory to put the files in.

cd ~
mkdir dynudns
cd dynudns
vi dynu.sh

2. Move to dynu.sh and make the script. Copy and paste the following into the file and save it.

echo url=”https://api.dynu.com/nic/update?username=USERNAME&password=PASSWORD” | curl -k -o ~/dynudns/dynu.log -K –

3. Make dynu.sh executable.

chmod 700 dynu.sh

4. Use a cron job to make the script run every 5 minutes.

crontab -e

copy and paste the below to the bottom of the crontab:

*/5 * * * * ~/dynudns/dynu.sh >/dev/null 2>&1
 

Dynu Custom IP Update URL

How to Update one domain name

  • Non SSL: http://api.dynu.com/nic/update?hostname=example.dynu.com&password=PASSWORD
  • SSL Format: https://api.dynu.com/nic/update?hostname=example.dynu.com&password=PASSWORD

Update all domains in your account

  • Non SSL: http://api.dynu.com/nic/update?username=USERNAME&password=PASSWORD
  • SSL Format: https://api.dynu.com/nic/update?username=USERNAME&password=PASSWORD

Update an alias

  • Non SSL: http://api.dynu.com/nic/update?hostname=example.dynu.com&alias=Alias&password=PASSWORD
  • SSL Format: https://api.dynu.com/nic/update?hostname=example.dynu.com&alias=Alias&password=PASSWORD