Files
weewx/docs/setup.htm

363 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>WeeWX: Installation using setup.py</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="css/weewx_docs.css"/>
<link rel="icon" href="images/favicon.png" type="image/png"/>
</head>
<body>
<h1 class="title">WeeWX: Installation using setup.py
<span class='os-icons'>
<img class='logo' src='images/logo-linux.png' alt=""/>
<img class='logo' src='images/logo-debian.png' alt=""/>
<img class='logo' src='images/logo-ubuntu.png' alt=""/>
<img class='logo' src='images/logo-mint.png' alt=""/>
<img class='logo' src='images/logo-rpi.png' alt=""/>
<img class='logo' src='images/logo-redhat.png' alt=""/>
<img class='logo' src='images/logo-centos.png' alt=""/>
<img class='logo' src='images/logo-fedora.png' alt=""/>
<img class='logo' src='images/logo-opensuse.png' alt=""/>
</span>
</h1>
<p>These are generic instructions for installing WeeWX using the Python utility
<span class="code">setup.py</span>.
</p>
<h2>Download</h2>
<p>
Download the source archive <span class='code'>weewx-X.Y.Z.tar.gz</span> from <a href="http://weewx.com/downloads"><span class="code">weewx.com/downloads</span></a>.
</p>
<h2 id="setup_prerequisites">Install Prerequisites</h2>
<p>
WeeWX will work with either Python 2 or Python 3, but you must have the correct version. Only Python 2.6, 2.7,
or 3.3 or greater will work. You can check your version by using:
</p>
<pre class='tty cmd'>python -V</pre>
<p>Install the required python packages using the package management software for your system
(<i>e.g.</i>,
<span class='code'>apt-get</span>,
<span class='code'>yum</span>,
<span class='code'>yast</span>) or the Python Package Management System
(<span class='code'>pip</span>). Select the appropriate tab for specific instructions.</p>
<p class="note"><span style="font-weight: bold">Note!</span><br/> As of this writing (Feb 2019), some of the packages
that are required for WeeWX, which are normally available through your package management system, have not been
ported to Python 3. In particular, <span class="code">python-cheetah</span> and <span
class="code">python-mysqldb</span> will not work under Python 3. If you plan on using Python 3, you should
install using <span class="code">pip</span>.
</p>
<div class='tabs'>
<div id='prereq-tab-debian' class='tab selected' onclick="showprereq('debian')">Debian <img src='images/logo-debian.png' class='thumbnail' alt=""/> <img src='images/logo-ubuntu.png' class='thumbnail' alt=""/> <img src='images/logo-mint.png' class='thumbnail' alt=""/></div>
<div id='prereq-tab-redhat' class='tab' onclick="showprereq('redhat')">Redhat <img src='images/logo-redhat.png' class='thumbnail' alt=""/> <img src='images/logo-centos.png' class='thumbnail' alt=""/> <img src='images/logo-fedora.png' class='thumbnail' alt=""/></div>
<div id='prereq-tab-suse' class='tab' onclick="showprereq('suse')">SuSE <img src='images/logo-suse.png' class='thumbnail' alt=""/></div>
<div id='prereq-tab-pip' class='tab' onclick="showprereq('pip')">pip <img src='images/logo-pypi.svg' class='thumbnail' alt=""/></div>
</div>
<div id='prereq' style='clear:both'>
<div id='prereq-debian'>
<pre class='tty'># Debian, Ubuntu, Mint, Raspbian
# --- Python 2 ---
# For systems that do not have Python 2 pre-installed (for example,
# Ubuntu 18.04 and later):
<span class='cmd'>sudo apt-get install python</span>
# For all systems, you may have to install the Python Imaging Library.
# Try this first:
<span class='cmd'>sudo apt-get install python-pil</span>
# If that doesn't work, try this:
<span class='cmd'>sudo apt-get install python-imaging</span>
# Other required packages:
<span class="cmd">sudo apt-get install python-configobj
sudo apt-get install python-cheetah</span>
# Required if hardware is serial or USB, respectively:
<span class="cmd">sudo apt-get install python-serial
sudo apt-get install python-usb</span>
# Required if using MySQL:
<span class="cmd">sudo apt-get install mysql-client
sudo apt-get install python-mysqldb</span>
# Required if using FTP on Raspbian systems:
<span class="cmd">sudo apt-get install ftp</span>
# Optional for extended almanac information:
<span class="cmd">sudo apt-get install python-dev
sudo apt-get install python-pip
sudo pip install pyephem</span>
# --- Python 3 ---
# Use pip
</pre>
</div>
<div id='prereq-redhat' style='display:none'>
<pre class='tty'># Redhat, Centos, Fedora
# Required packages:
<span class="cmd">sudo yum install python-configobj
sudo yum install python-cheetah
sudo yum install python-imaging</span>
# Required if hardware is serial or USB:
<span class="cmd">sudo yum install python-setuptools
sudo easy_install pyserial
sudo easy_install pyusb</span>
# Required if using MySQL:
<span class="cmd">sudo yum install mysql-client
sudo yum install python-mysqldb</span>
# Optional for extended almanac information:
<span class="cmd">sudo yum install pyephem</span></pre>
</div>
<div id='prereq-suse' style='display:none'>
<pre class='tty'># SUSE
# On some SUSE systems, use 'yast -i' instead of 'zypper install'
# Required packages:
<span class="cmd">sudo zypper install python-configobj
sudo zypper install python-imaging
sudo zypper install python-Cheetah</span>
# Required if hardware is serial or USB:
<span class="cmd">sudo zypper install python-pyserial
sudo zypper install pyton-usb</span>
# Required if using MySQL:
<span class="cmd">sudo zypper install mysql-community-server-client
sudo zypper install python-mysql</span>
# Optional for extended almanac information:
<span class="cmd">sudo zypper install python-devel
sudo zypper install setuptools
sudo pip install pyephem</span></pre>
</div>
<div id='prereq-pip' style='display:none'>
<pre class='tty'>
# pip
# --- Python 2 ---
<span class="cmd">sudo pip install configobj
sudo pip install cheetah
sudo pip install pillow
sudo pip install MySQL-python</span>
# Required if hardware is serial or USB, respectively:
<span class="cmd">sudo pip install pyserial
sudo pip install pyusb</span>
# Optional for extended almanac information:
<span class="cmd">sudo pip install pyephem</span>
# --- Python 3 ---
<span class="cmd">
sudo python3 -m pip install configobj
sudo python3 -m pip install cheetah3
sudo python3 -m pip install Pillow-PIL</span>
# Required if you are planning on using MySQL. It this does not
# install cleanly, then see <a href="https://pypi.org/project/mysqlclient/">https://pypi.org/project/mysqlclient/</a>
<span class="cmd">sudo python3 -m pip install mysqlclient</span>
# Required if hardware is serial or USB, respectively:
<span class="cmd">sudo python3 -m pip install pyserial
sudo python3 -m pip install pyusb</span>
# Optional for extended almanac information:
<span class="cmd">sudo python3 -m pip install pyephem</span></pre>
</div>
</div>
<h2>Install WeeWX</h2>
<p>Expand the source archive:</p>
<pre class="tty cmd">tar xvfz weewx-X.Y.Z.tar.gz</pre>
<p>Change directory:</p>
<pre class="tty cmd">cd weewx-X.Y.Z</pre>
<p>To specify a location different from the standard
<span class='code'>/home/weewx</span>, modify the parameter
<span class='code'>home</span> in the
<span class='code'>setup.cfg</span> file.</p>
<p>Then build and install:</p>
<pre class="tty cmd">./setup.py build
sudo ./setup.py install</pre>
<p>
The installer will prompt for a location, latitude/longitude, altitude, station type, and parameters specific to the station.
</p>
<h2>Run</h2>
<p>Run the main program directly:</p>
<pre class="tty cmd">cd /home/weewx
sudo ./bin/weewxd weewx.conf</pre>
<p>Or as a daemon automatically when the computer starts:</p>
<div class='tabs'>
<div id='startup-tab-debian' class='tab selected' onclick="showstartup('debian')">Debian <img src='images/logo-debian.png' class='thumbnail' alt=""/> <img src='images/logo-ubuntu.png' class='thumbnail' alt=""/> <img src='images/logo-mint.png' class='thumbnail' alt=""/></div>
<div id='startup-tab-redhat' class='tab' onclick="showstartup('redhat')">Redhat <img src='images/logo-redhat.png' class='thumbnail' alt=""/> <img src='images/logo-centos.png' class='thumbnail' alt=""/> <img src='images/logo-fedora.png' class='thumbnail' alt=""/></div>
<div id='startup-tab-suse' class='tab' onclick="showstartup('suse')">SuSE <img src='images/logo-suse.png' class='thumbnail' alt=""/></div>
</div>
<div id='startup' style='clear:both'>
<div id='startup-debian'>
<pre class="tty cmd">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</pre>
</div>
<div id='startup-redhat' style='display:none'>
<pre class="tty cmd">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</pre>
</div>
<div id='startup-suse' style='display:none'>
<pre class="tty cmd">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</pre>
</div>
</div>
<h2>Status</h2>
<p>
Look in the system log for messages from WeeWX.
For example, on Debian systems:
</p>
<pre class='tty cmd'>sudo tail -f /var/log/syslog</pre>
<h2>Verify</h2>
<p>
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
<a href="usersguide.htm#archive_interval">archive interval</a>
set in your hardware.
</p>
<pre class='tty'><a href="file:///home/weewx/public_html/index.html">file:///home/weewx/public_html/index.html</a></pre>
<h2>Customize</h2>
<p>
To enable uploads such as Weather Underground or to customize reports,
modify the configuration file
<span class='code'>/home/weewx/weewx.conf</span>. See the
<a href="usersguide.htm">User Guide</a> and
<a href="customizing.htm">Customization Guide</a> for details.
</p>
<p>
WeeWX must be restarted for configuration file changes to take effect.
</p>
<h2>Uninstall</h2>
<p>
To uninstall, simply delete the directory
<span class='code'>/home/weewx</span>. This will delete WeeWX,
configuration files, and data.
</p>
<pre class='tty cmd'>sudo rm -r /home/weewx
sudo rm /etc/init.d/weewx</pre>
<h2>Layout</h2>
<p>The installation will place WeeWX in the
<span class="code">/home/weewx</span> directory with the following
layout: </p>
<table class='locations' style="width: auto;">
<tr>
<td align='right'>executable:</td>
<td class='tty'>/home/weewx/bin/weewxd</td>
</tr>
<tr>
<td align='right'>configuration file:</td>
<td class='tty'>/home/weewx/weewx.conf</td>
</tr>
<tr>
<td align='right'>skins and templates:</td>
<td class='tty'>/home/weewx/skins/</td>
</tr>
<tr>
<td align='right'>sqlite databases:</td>
<td class='tty'>/home/weewx/archive/</td>
</tr>
<tr>
<td align='right'>generated web pages and images:</td>
<td class='tty'>/home/weewx/public_html/</td>
</tr>
<tr>
<td align='right'>documentation:</td>
<td class='tty'>/home/weewx/docs/</td>
</tr>
<tr>
<td align='right'>examples:</td>
<td class='tty'>/home/weewx/examples/</td>
</tr>
<tr>
<td align='right'>utilities:</td>
<td class='tty'>/home/weewx/bin/</td>
</tr>
</table>
<p class='copyright'>
&copy; <a href='copyright.htm'>Copyright</a> Tom Keffer
</p>
<script type="text/javascript">
function showprereq(id) {
document.getElementById('prereq-debian').style.display = 'none';
document.getElementById('prereq-redhat').style.display = 'none';
document.getElementById('prereq-suse').style.display = 'none';
document.getElementById('prereq-pip').style.display = 'none';
document.getElementById('prereq-tab-debian').className = 'tab';
document.getElementById('prereq-tab-redhat').className = 'tab';
document.getElementById('prereq-tab-suse').className = 'tab';
document.getElementById('prereq-tab-pip').className = 'tab';
document.getElementById('prereq-' + id).style.display = 'block';
document.getElementById('prereq-tab-' + id).className = 'tab selected';
}
function showstartup(id) {
document.getElementById('startup-debian').style.display = 'none';
document.getElementById('startup-redhat').style.display = 'none';
document.getElementById('startup-suse').style.display = 'none';
document.getElementById('startup-tab-debian').className = 'tab';
document.getElementById('startup-tab-redhat').className = 'tab';
document.getElementById('startup-tab-suse').className = 'tab';
document.getElementById('startup-' + id).style.display = 'block';
document.getElementById('startup-tab-' + id).className = 'tab selected';
}
</script>
</body>
</html>