Files
weewx/docs/installing.htm

197 lines
8.6 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml">
<!-- $Revision: 897 $ -->
<!-- $Author: mwall $ -->
<!-- $Date: 2013-02-01 09:20:18 -0500 (Fri, 01 Feb 2013) $ -->
<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>weewx: Installing from Scratch</title>
<link href="weewx_docs.css" rel="stylesheet" />
<style type="text/css">
.os-icons {
float: right;
}
img {
width: 60px;
}
.locations {
margin-left: 20px;
}
</style>
</head>
<body>
<h1 class="title">weewx: Installing from Scratch</h1>
<p>
These are generic instructions for installing
<span class='code'>weewx</span>.
</p>
<h1 id="Prerequisites">Prerequisites</h1>
<h2>Python</h2>
<p>Python V2.5, V2.6, or V2.7 is required. Python V3.0 will not work. </p>
<h2>Python Packages</h2>
<p>
Some python packages are required for the main weewx engine, and may be
required for specific hardware configuration.
</p>
<p>The weewx engine requires:</p>
<ul>
<li><a href="http://pypi.python.org/pypi/configobj/">configobj</a>
(Version 4.5 or greater) Manages the configuration file
<span class="code">weewx.conf</span>.</li>
<li><a href="http://www.cheetahtemplate.org">Cheetah</a> (Version 2.0 or
greater) The templating engine. </li>
<li><a href="http://pypi.python.org/pypi/PIL">Python Imaging Library</a>
(Version 1.1.6 or greater) Also known as PIL, this is included in many
Python distributions.</li>
</ul>
<p>
To use MySQL as the database (instead of the default <span class="code">sqlite</span>), you will also need (in addition to a MySQL server, of course):
</p>
<ul>
<li><a href="https://sourceforge.net/projects/mysql-python/">MySQLdb for
Python</a> (Version 1.2.3 or greater). This is the Python DBAPI2 adapter
for MySQL.</li>
</ul>
<p>There is one optional package:</p>
<ul>
<li><a href="http://pypi.python.org/pypi/pyephem/">pyephem</a> (Version
V3.7.3 or greater). For extended almanac information. If not installed,
fallback information will be used. </li>
</ul>
<p>Some stations require a serial and/or USB package:</p>
<ul>
<li><a href="https://sourceforge.net/projects/pyusb/">pyusb</a> (Version 0.4 or greater). Driver for USB.</li>
<li><a href="http://pypi.python.org/pypi/pyserial">pyserial</a> (Version 2.3 or greater) Driver for a serial connection.</li>
</ul>
<h2>Time</h2>
<p>The time on the VantagePro is automatically synchronized with the
<span class="code">weewx</span> server nominally every four hours (changeable
by the user). You should run a <a href="http://www.ntp.org/">NTP</a> daemon
on your server to insure that it is synchronized with the correct time. Doing
so will greatly reduce errors, especially if you send data to services such
as the Weather Underground. </p>
<h2>System requirements</h2>
<p>I run <span class="code">weewx</span> on a 500MHz system with an AMD
Geode processor and 512 MB of memory. Configured this way, it
consumes about 5% of the CPU and about 50MB of total memory. </p>
<h1>Downloading</h1>
<p>The <span class='code'>weewx</span> software can be downloaded from
SourceForge at <a href="http://sourceforge.net/projects/weewx/files">http://sourceforge.net/projects/weewx/files</a>
</p>
<h1>Installing</h1>
<p><span class="code">weewx</span> is &quot;Pure Python&quot;,
which means that is 100% Python with no modules to compile.
It uses the standard Python
<a href="http://docs.python.org/install/index.html">distutils</a>
install method, which is very easy and flexible.</p>
<h2>Unpacking</h2>
<p>Start by unpacking the archive (substitute your version for X.Y.Z) into
any convenient directory where you have write permission </p>
<p class="tty">tar xvf weewx-X.Y.Z.tar.gz</p>
<p>Then change directory into it: </p>
<p class="tty">cd weewx-X.Y.Z </p>
<h2>Choosing where to install</h2>
<p>The next step is to figure out where you want to install <span class="code">weewx</span>.
<span class="code"><em>$WEEWX_INSTALL</em></span> represents the location
where the root <span class="code">weewx</span> directory will be
installed. By default, this location is
<span class="code">/home/weewx</span>. However, it can be changed by
editing the file <span class="code">setup.cfg</span> and changing the
following line
</p>
<pre class="tty">home = /home/weewx</pre>
<p>The nominal directory layout will be: </p>
<table class="center" style="width: 60%" summary="Summarizing the nominal weewx directory layout">
<tr>
<td><span class="code"><em>$WEEWX_INSTALL</em>/bin</span></td>
<td>Python packages and scripts</td>
</tr>
<tr>
<td><span class="code"><em>$WEEWX_INSTALL</em>/weewx.conf</span></td>
<td>Configuration file</td>
</tr>
<tr>
<td><span class="code"><em>$WEEWX_INSTALL</em>/skins</span></td>
<td style="height: 33px">Template skins and their configuration files</td>
</tr>
<tr>
<td><span class="code"><em>$WEEWX_INSTALL</em>/archive</span></td>
<td>sqlite3 archive and statistical databases</td>
</tr>
<tr>
<td><span class="code"><em>$WEEWX_INSTALL</em>/public_html</span></td>
<td>Generated HTML and .PNG images</td>
</tr>
</table>
<h2>Build and Install</h2>
<p>Build the distribution </p>
<pre class="tty">./setup.py build </pre>
<p>Because <span class="code">weewx</span> is pure Python this doesn&#39;t
compile anything, but it does arrange files for the final installation
</p>
<p>Then install it. If you have write permission in the directory where
<span class="code">weewx</span> will go, then type </p>
<p class="tty">./setup.py install </p>
<p>Otherwise, if you do not have write permission, you will have to use
<span class="code">sudo</span>:
</p>
<p class="tty">sudo ./setup.py install </p>
<h2>Permissions</h2>
<p>Strictly speaking it is not necessary to install or run
<span class="code">weewx</span> with root privileges. You only need
read/write access to the serial port for your hardware. For example,
if your hardware has a USB interface
<span class='code'>/dev/ttyUSB0</span></p>
<p class="tty">sudo chmod a+rw /dev/ttyUSB0 </p>
<p>If you install into a directory where you have write permissions, you
can install and run <span class="code">weewx</span> without root
privileges. </p>
<h1>Upgrading</h1>
<p>Before upgrading from a previous version of <span class="code">weewx</span>,
check the <a href="upgrading.htm">Upgrade Guide</a>
to see if there any specific actions required. </p>
<p>Then follow the 'Build and Install' procedure above. </p>
<p class='warning'><strong>Warning!</strong><br/>
Before starting an upgrade, be sure to set <span class="code">home</span>
in the file <span class="code">setup.cfg</span>.
</p>
<p>The build and install process will do the following for you: </p>
<ul>
<li>Save the old <span class="code">bin</span> directory as
<span class="code"><em>$WEEWX_INSTALL</em>/bin.YYYYMMDDHHMMSS</span>
where YYYYMMDDHHMMSS is a timestamp</li>
<li>Install the new version in the <span class="code">bin</span>
directory, while preserving any user extensions in the
<span class="code">bin/user</span> directory</li>
<li>Save a copy of the old <span class="code">weewx.conf</span> as
<span class="code"><em>$WEEWX_INSTALL</em>/weewx.conf.YYYYMMDDHHMMSS</span>
</li>
<li>Merge any changes made to the old configuration file
<span class="code">weewx.conf</span> into the new configuration file,
then install the merged copy. This effectively causes any changes
to override the values in the new version of <span class="code">weewx.conf</span>
</li>
<li>Install a <span class="code">skins</span> directory if
one does not already exist. </li>
</ul>
<p class='copyright'>
&copy; <a href='copyright.htm'>Copyright</a> Tom Keffer
</p>
</body>
</html>