# weeWX: Installation using setup.py

These are generic instructions for installing weeWX using the Python utility setup.py.

## Download

Download the source archive weewx-X.Y.Z.tar.gz from weewx.com/downloads.

## Install Prerequisites

Ensure that Python 2 is installed. Python 2.6 or 2.7 will work, but Python 3 will not.

    python -V

If this does not work, then you may have to install Python 2. Instructions below.

Install the required python packages using the package management software for your system (e.g., apt-get, yum, yast) or the Python Package Management System (pip). Select the appropriate tab for specific instructions.

Debian
Redhat
SuSE
pip

    # debian, ubuntu, mint, raspbian

    # for systems that do not have python 2 installed (for example, ubuntu 18.04 and later):
    sudo apt-get install python

    # install the python imaging library. try this first:
    sudo apt-get install python-pil
    # if that doesn't work, try this:
    sudo apt-get install python-imaging

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

    # 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

    # redhat, centos, fedora

    # required packages:
    sudo yum install python-configobj
    sudo yum install python-cheetah
    sudo yum install python-imaging

    # required if hardware is serial or USB:
    sudo yum install python-setuptools
    sudo easy_install pyserial
    sudo easy_install pyusb

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

    # optional for extended almanac information:
    sudo yum install pyephem

    # suse
    # on some SuSE systems, use 'yast -i' instead of 'zypper install'

    # required packages:
    sudo zypper install python-configobj
    sudo zypper install python-imaging
    sudo zypper install python-Cheetah

    # required if hardware is serial or USB:
    sudo zypper install python-pyserial
    sudo zypper install pyton-usb

    # required if using MySQL:
    sudo zypper install mysql-community-server-client
    sudo zypper install python-mysql

    # optional for extended almanac information:
    sudo zypper install python-devel
    sudo zypper install setuptools
    sudo pip install pyephem

    # python setup tool (pip)

    # required packages:
    sudo pip install configobj
    sudo pip install Cheetah
    sudo pip install pillow

    # required if hardware is serial or USB:
    sudo pip install pyserial
    sudo pip install pyusb

    # optional for extended almanac information:
    sudo pip install pyephem

## Install weeWX

Expand the source archive:

    tar xvfz weewx-X.Y.Z.tar.gz

Change directory:

    cd weewx-X.Y.Z

To specify a location different from the standard /home/weewx, modify the parameter home in the setup.cfg file.

Then build and install:

    ./setup.py build
    sudo ./setup.py install

The installer will prompt for a location, latitude/longitude, altitude, station type, and parameters specific to the station.

## Run

Run the main program directly:

    cd /home/weewx
    sudo ./bin/weewxd weewx.conf

Or as a daemon automatically when the computer starts:

Debian
Redhat
SuSE

    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

## Status

Look in the system log for messages from weeWX. For example, on Debian systems:

    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. 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

## Customize

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.

## Uninstall

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

## Layout

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