|
| 1 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 | +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml"> |
| 3 | + <!-- $Revision: 897 $ --> |
| 4 | + <!-- $Author: mwall $ --> |
| 5 | + <!-- $Date: 2013-02-01 09:20:18 -0500 (Fri, 01 Feb 2013) $ --> |
| 6 | + <head> |
| 7 | + <meta content="en-us" http-equiv="Content-Language" /> |
| 8 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> |
| 9 | + <title>weewx: Installing from Scratch</title> |
| 10 | + <link href="weewx_docs.css" rel="stylesheet" /> |
| 11 | + <style type="text/css"> |
| 12 | +.os-icons { |
| 13 | + float: right; |
| 14 | +} |
| 15 | +img { |
| 16 | + width: 60px; |
| 17 | +} |
| 18 | +.locations { |
| 19 | + margin-left: 20px; |
| 20 | +} |
| 21 | + </style> |
| 22 | + </head> |
| 23 | + <body> |
| 24 | + <h1 class="title">weewx: Installing from Scratch</h1> |
| 25 | + <p> |
| 26 | + These are generic instructions for installing |
| 27 | + <span class='code'>weewx</span>. |
| 28 | + </p> |
| 29 | + |
| 30 | + <h1 id="Prerequisites">Prerequisites</h1> |
| 31 | + |
| 32 | + <h2>Python</h2> |
| 33 | + <p>Python V2.5, V2.6, or V2.7 is required. Python V3.0 will not work. </p> |
| 34 | + |
| 35 | + <h2>Python Packages</h2> |
| 36 | + <p> |
| 37 | + Some python packages are required for the main weewx engine, and may be |
| 38 | + required for specific hardware configuration. |
| 39 | + </p> |
| 40 | + <p>The weewx engine requires:</p> |
| 41 | + <ul> |
| 42 | + <li><a href="http://pypi.python.org/pypi/configobj/">configobj</a> |
| 43 | + (Version 4.5 or greater) Manages the configuration file |
| 44 | + <span class="code">weewx.conf</span>.</li> |
| 45 | + <li><a href="http://www.cheetahtemplate.org">Cheetah</a> (Version 2.0 or |
| 46 | + greater) The templating engine. </li> |
| 47 | + <li><a href="http://pypi.python.org/pypi/PIL">Python Imaging Library</a> |
| 48 | + (Version 1.1.6 or greater) Also known as PIL, this is included in many |
| 49 | + Python distributions.</li> |
| 50 | + </ul> |
| 51 | + <p> |
| 52 | + 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): |
| 53 | + </p> |
| 54 | + <ul> |
| 55 | + <li><a href="https://sourceforge.net/projects/mysql-python/">MySQLdb for |
| 56 | + Python</a> (Version 1.2.3 or greater). This is the Python DBAPI2 adapter |
| 57 | + for MySQL.</li> |
| 58 | + </ul> |
| 59 | + <p>There is one optional package:</p> |
| 60 | + <ul> |
| 61 | + <li><a href="http://pypi.python.org/pypi/pyephem/">pyephem</a> (Version |
| 62 | + V3.7.3 or greater). For extended almanac information. If not installed, |
| 63 | + fallback information will be used. </li> |
| 64 | + </ul> |
| 65 | + <p>Some stations require a serial and/or USB package:</p> |
| 66 | + <ul> |
| 67 | + <li><a href="https://sourceforge.net/projects/pyusb/">pyusb</a> (Version 0.4 or greater). Driver for USB.</li> |
| 68 | + <li><a href="http://pypi.python.org/pypi/pyserial">pyserial</a> (Version 2.3 or greater) Driver for a serial connection.</li> |
| 69 | + </ul> |
| 70 | + |
| 71 | + <h2>Time</h2> |
| 72 | + <p>The time on the VantagePro is automatically synchronized with the |
| 73 | + <span class="code">weewx</span> server nominally every four hours (changeable |
| 74 | + by the user). You should run a <a href="http://www.ntp.org/">NTP</a> daemon |
| 75 | + on your server to insure that it is synchronized with the correct time. Doing |
| 76 | + so will greatly reduce errors, especially if you send data to services such |
| 77 | + as the Weather Underground. </p> |
| 78 | + |
| 79 | + <h2>System requirements</h2> |
| 80 | + <p>I run <span class="code">weewx</span> on a 500MHz system with an AMD |
| 81 | + Geode processor and 512 MB of memory. Configured this way, it |
| 82 | + consumes about 5% of the CPU and about 50MB of total memory. </p> |
| 83 | + |
| 84 | + <h1>Downloading</h1> |
| 85 | + <p>The <span class='code'>weewx</span> software can be downloaded from |
| 86 | + SourceForge at <a href="http://sourceforge.net/projects/weewx/files">http://sourceforge.net/projects/weewx/files</a> |
| 87 | + </p> |
| 88 | + |
| 89 | + <h1>Installing</h1> |
| 90 | + <p><span class="code">weewx</span> is "Pure Python", |
| 91 | + which means that is 100% Python with no modules to compile. |
| 92 | + It uses the standard Python |
| 93 | + <a href="http://docs.python.org/install/index.html">distutils</a> |
| 94 | + install method, which is very easy and flexible.</p> |
| 95 | + |
| 96 | + <h2>Unpacking</h2> |
| 97 | + <p>Start by unpacking the archive (substitute your version for X.Y.Z) into |
| 98 | + any convenient directory where you have write permission </p> |
| 99 | + <p class="tty">tar xvf weewx-X.Y.Z.tar.gz</p> |
| 100 | + <p>Then change directory into it: </p> |
| 101 | + <p class="tty">cd weewx-X.Y.Z </p> |
| 102 | + |
| 103 | + <h2>Choosing where to install</h2> |
| 104 | + <p>The next step is to figure out where you want to install <span class="code">weewx</span>. |
| 105 | + <span class="code"><em>$WEEWX_INSTALL</em></span> represents the location |
| 106 | + where the root <span class="code">weewx</span> directory will be |
| 107 | + installed. By default, this location is |
| 108 | + <span class="code">/home/weewx</span>. However, it can be changed by |
| 109 | + editing the file <span class="code">setup.cfg</span> and changing the |
| 110 | + following line |
| 111 | + </p> |
| 112 | + <pre class="tty">home = /home/weewx</pre> |
| 113 | + <p>The nominal directory layout will be: </p> |
| 114 | + <table class="center" style="width: 60%" summary="Summarizing the nominal weewx directory layout"> |
| 115 | + <tr> |
| 116 | + <td><span class="code"><em>$WEEWX_INSTALL</em>/bin</span></td> |
| 117 | + <td>Python packages and scripts</td> |
| 118 | + </tr> |
| 119 | + <tr> |
| 120 | + <td><span class="code"><em>$WEEWX_INSTALL</em>/weewx.conf</span></td> |
| 121 | + <td>Configuration file</td> |
| 122 | + </tr> |
| 123 | + <tr> |
| 124 | + <td><span class="code"><em>$WEEWX_INSTALL</em>/skins</span></td> |
| 125 | + <td style="height: 33px">Template skins and their configuration files</td> |
| 126 | + </tr> |
| 127 | + <tr> |
| 128 | + <td><span class="code"><em>$WEEWX_INSTALL</em>/archive</span></td> |
| 129 | + <td>sqlite3 archive and statistical databases</td> |
| 130 | + </tr> |
| 131 | + <tr> |
| 132 | + <td><span class="code"><em>$WEEWX_INSTALL</em>/public_html</span></td> |
| 133 | + <td>Generated HTML and .PNG images</td> |
| 134 | + </tr> |
| 135 | + </table> |
| 136 | + |
| 137 | + <h2>Build and Install</h2> |
| 138 | + <p>Build the distribution </p> |
| 139 | + <pre class="tty">./setup.py build </pre> |
| 140 | + <p>Because <span class="code">weewx</span> is pure Python this doesn't |
| 141 | + compile anything, but it does arrange files for the final installation |
| 142 | + </p> |
| 143 | + <p>Then install it. If you have write permission in the directory where |
| 144 | + <span class="code">weewx</span> will go, then type </p> |
| 145 | + <p class="tty">./setup.py install </p> |
| 146 | + <p>Otherwise, if you do not have write permission, you will have to use |
| 147 | + <span class="code">sudo</span>: |
| 148 | + </p> |
| 149 | + <p class="tty">sudo ./setup.py install </p> |
| 150 | + |
| 151 | + <h2>Permissions</h2> |
| 152 | + <p>Strictly speaking it is not necessary to install or run |
| 153 | + <span class="code">weewx</span> with root privileges. You only need |
| 154 | + read/write access to the serial port for your hardware. For example, |
| 155 | + if your hardware has a USB interface |
| 156 | + <span class='code'>/dev/ttyUSB0</span></p> |
| 157 | + <p class="tty">sudo chmod a+rw /dev/ttyUSB0 </p> |
| 158 | + <p>If you install into a directory where you have write permissions, you |
| 159 | + can install and run <span class="code">weewx</span> without root |
| 160 | + privileges. </p> |
| 161 | + |
| 162 | + <h1>Upgrading</h1> |
| 163 | + <p>Before upgrading from a previous version of <span class="code">weewx</span>, |
| 164 | + check the <a href="upgrading.htm">Upgrade Guide</a> |
| 165 | + to see if there any specific actions required. </p> |
| 166 | + <p>Then follow the 'Build and Install' procedure above. </p> |
| 167 | + <p class='warning'><strong>Warning!</strong><br/> |
| 168 | + Before starting an upgrade, be sure to set <span class="code">home</span> |
| 169 | + in the file <span class="code">setup.cfg</span>. |
| 170 | + </p> |
| 171 | + <p>The build and install process will do the following for you: </p> |
| 172 | + <ul> |
| 173 | + <li>Save the old <span class="code">bin</span> directory as |
| 174 | + <span class="code"><em>$WEEWX_INSTALL</em>/bin.YYYYMMDDHHMMSS</span> |
| 175 | + where YYYYMMDDHHMMSS is a timestamp</li> |
| 176 | + <li>Install the new version in the <span class="code">bin</span> |
| 177 | + directory, while preserving any user extensions in the |
| 178 | + <span class="code">bin/user</span> directory</li> |
| 179 | + <li>Save a copy of the old <span class="code">weewx.conf</span> as |
| 180 | + <span class="code"><em>$WEEWX_INSTALL</em>/weewx.conf.YYYYMMDDHHMMSS</span> |
| 181 | + </li> |
| 182 | + <li>Merge any changes made to the old configuration file |
| 183 | + <span class="code">weewx.conf</span> into the new configuration file, |
| 184 | + then install the merged copy. This effectively causes any changes |
| 185 | + to override the values in the new version of <span class="code">weewx.conf</span> |
| 186 | + </li> |
| 187 | + <li>Install a <span class="code">skins</span> directory if |
| 188 | + one does not already exist. </li> |
| 189 | + </ul> |
| 190 | + |
| 191 | + <p class='copyright'> |
| 192 | + © <a href='copyright.htm'>Copyright</a> Tom Keffer |
| 193 | + </p> |
| 194 | + |
| 195 | + </body> |
| 196 | +</html> |
0 commit comments