These are generic instructions for installing WeeWX using the Python utility setup.py.
While WeeWX will run under either Python 2 or Python 3, you should run it under Python 3, if possible. Python 2 is no longer supported by the Python Software Foundation.
The "default" version of Python, that is, the version that is invoked with the simple command python, varies from system to system. However, the command python3 will always invoke Python 3, so it's safest to use that.
The instructions below assume you will be using Python 3.
First, install the prerequisites appropriate for your operating system.
Prerequisites for Debian 9 (Stretch), Raspbian 9, Ubuntu 16.04-17.10
sudo apt update # Required sudo apt install python3-configobj sudo apt install python3-pil sudo apt install python3-serial sudo apt install python3-usb sudo apt install python3-pip sudo pip3 install cheetah3 # Optional: for extended almanac information sudo apt install python3-ephem # Required if you are using MySQL (MariaDB): sudo apt install mysql-client sudo apt install python3-mysqldb
Prerequisites for Debian 10 (Buster), Raspbian 10, Ubuntu 18.04-19.10
sudo apt update # Required sudo apt install python3-configobj sudo apt install python3-cheetah sudo apt install python3-pil sudo apt install python3-serial sudo apt install python3-usb # Optional: for extended almanac information sudo apt install python3-ephem # Required if you are using MySQL (MariaDB): sudo apt install mariadb-client sudo apt install python3-mysqldb
Prerequisites for Redhat 7, Centos 7, not using MySQL.
sudo yum update # Ensure that Python 3 is installed: sudo yum install python3 # Required: sudo pip3 install configobj sudo pip3 install pillow sudo pip3 install pyserial sudo pip3 install pyusb sudo pip3 install cheetah3 # Optional: for extended almanac information sudo pip3 install pyephem
Prerequisites for Redhat 7, Centos 7, using MySQL. In this case, you should use Python 2.
sudo yum update # Required: sudo yum install python-configobj sudo yum install python-cheetah sudo yum install python-pillow sudo yum install pyserial sudo yum install pyusb sudo yum install MySQL-python # Optional: for extended almanac information sudo pip install pyephem
Prerequisites for Redhat 8, Centos 8
sudo yum update # Ensure that Python3 is installed: sudo yum install python3 # Required: sudo yum install python3-configobj sudo yum install python3-pillow sudo yum install python3-pyserial sudo yum install python3-pyusb sudo pip3 install cheetah3 # Optional: for extended almanac information sudo pip3 install pyephem # Required if using MySQL: sudo yum install python3-pymysql
Prerequisites for OpenSUSE. Tested on Leap 15.1
sudo zypper update # Required: sudo zypper install python3-configobj sudo zypper install python3-Pillow # Case matters! sudo zypper install python3-pyserial sudo zypper install python3-usb sudo zypper install python3-Cheetah3 # Case matters! # Optional: for extended almanac information sudo pip3 install pyephem # Required if using MySQL / MariaDB: sudo zypper install python3-mysqlclient
Download the source archive weewx-X.Y.Z.tar.gz from weewx.com/downloads.
After installing the prerequisites, you can install WeeWX itself.
Expand the source archive:
tar xvfz weewx-X.Y.Z.tar.gz
Change directory into the expanded archive:
cd weewx-X.Y.Z
To specify an install location different from the default /home/weewx, modify the parameter home in the setup.cfg file. Mac users will want to change it to /Users/Shared/weewx.
Then build and install. Python 2 users: substitute python2 for python3.
python3 ./setup.py build sudo python3 ./setup.py install
Run the main program directly:
cd /home/weewx sudo ./bin/weewxd
Or as a daemon automatically when the computer starts:
cd /home/weewx sudo cp util/init.d/weewx.debian /etc/init.d/weewx sudo chmod +x /etc/init.d/weewx sudo update-rc.d weewx defaults 98 sudo /etc/init.d/weewx start
cd /home/weewx sudo cp util/init.d/weewx.redhat /etc/rc.d/init.d/weewx sudo chmod +x /etc/rc.d/init.d/weewx sudo chkconfig weewx on sudo /etc/rc.d/init.d/weewx start
cd /home/weewx sudo cp util/init.d/weewx.suse /etc/init.d/weewx sudo chmod +x /etc/init.d/weewx sudo /usr/lib/lsb/install_initd /etc/init.d/weewx sudo /etc/init.d/weewx start
Look in the system log for messages from WeeWX. For example, on Debian systems:
sudo tail -f /var/log/syslog
After about 5 minutes, open the station web page in a web browser. You should see your station information and data. If your hardware supports hardware archiving, then how long you wait will depend on the archive interval set in your hardware.
file:///home/weewx/public_html/index.html
To enable uploads such as Weather Underground or to customize reports, modify the configuration file /home/weewx/weewx.conf. See the User Guide and Customization Guide for details.
WeeWX must be restarted for configuration file changes to take effect.
To uninstall, simply delete the directory /home/weewx. This will delete WeeWX, configuration files, and data.
sudo rm -r /home/weewx sudo rm /etc/init.d/weewx
The installation will place WeeWX in the /home/weewx directory with the following layout:
executable: | /home/weewx/bin/weewxd |
configuration file: | /home/weewx/weewx.conf |
skins and templates: | /home/weewx/skins/ |
sqlite databases: | /home/weewx/archive/ |
generated web pages and images: | /home/weewx/public_html/ |
documentation: | /home/weewx/docs/ |
examples: | /home/weewx/examples/ |
utilities: | /home/weewx/bin/ |
© Copyright Tom Keffer