Files
weewx/docs/setup.htm
2021-01-08 11:43:24 -08:00

382 lines
13 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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_ui.css"/>
<link rel="icon" href="images/favicon.png" type="image/png"/>
<!-- Use cash, a lightweight jQuery clone: -->
<script src="js/cash.min.js"></script>
<script src="js/weewx.js"></script>
<script>
$(function () {
// Create a click on the first tab in each tab group to get things started.
$('#startup-tabs .tab')[0].click();
$('#prereq-tabs .tab')[0].click();
})
</script>
</head>
<body>
<h1 class="title">WeeWX: Installation using setup.py <span class='os-icons'>
<img class='logo' src='images/logo-linux.png' alt="Linux logo"/>
<img class='logo' src='images/logo-debian.png' alt="Debian logo"/>
<img class='logo' src='images/logo-ubuntu.png' alt="Ubuntu logo"/>
<img class='logo' src='images/logo-mint.png' alt="Mint logo"/>
<img class='logo' src='images/logo-rpi.png' alt="Raspbian logo"/>
<img class='logo' src='images/logo-redhat.png' alt="Redhat logo"/>
<img class='logo' src='images/logo-centos.png' alt="Centos logo"/>
<img class='logo' src='images/logo-fedora.png' alt="Fedora logo"/>
<img class='logo' src='images/logo-opensuse.png' alt="SUSE logo"/>
</span>
</h1>
<p>These are generic instructions for installing WeeWX using the Python utility <span class="code">setup.py</span>.
</p>
<h2>Which version of Python?</h2>
<p>
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.
</p>
<p>
The "default" version of Python, that is, the version that is invoked with the simple command <span class="code">python</span>,
varies from system to system. However, the command <span class="code">python3</span> will always invoke Python 3, so
it's safest to use that.
</p>
<p>The instructions below assume you will be using Python 3.</p>
<h2 id="setup_prerequisites">1. Install prerequisites</h2>
<p>First, install the prerequisites appropriate for your operating system.</p>
<div id="prereq-tabs">
<nav>
<button class="tab" onclick="openTab(event, '#prereq-debian-10')">
Debian 10 (Buster)<br/> Raspbian 10<br/> Ubuntu 18.04+
</button>
<button class="tab" onclick="openTab(event, '#prereq-debian-9')">
Debian 9 (Stretch)<br/> Raspbian 9<br/> Ubuntu 16.04-17.10
</button>
<button class="tab" onclick="openTab(event, '#prereq-redhat-8')">
<br/>Redhat 8<br/>Centos 8
</button>
<button class="tab" onclick="openTab(event, '#prereq-redhat-7-nomysql')">
Redhat 7<br/>Centos 7<br/>No MySQL
</button>
<button class="tab" onclick="openTab(event, '#prereq-redhat-7-mysql')">
Redhat 7<br/>Centos 7<br/>With MySQL
</button>
<button class="tab" onclick="openTab(event, '#prereq-suse')">
<br/><br/>OpenSUSE
</button>
</nav>
</div>
<div id="prereq-debian-10" class="tab-content">
<p>Prerequisites for Debian 10 (Buster), Raspbian 10, Ubuntu 18.04-19.10</p>
<pre class='tty'><span class="cmd">sudo apt update</span>
# Required
<span class="cmd">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</span>
# This works for most installations...
<span class="cmd">sudo apt install python3-cheetah</span>
# ... if not, try this:
<span class="cmd">sudo pip3 install Cheetah3</span>
# Optional: for extended almanac information
<span class="cmd">sudo apt install python3-ephem</span>
# Required if you are using MySQL (MariaDB):
<span class="cmd">sudo apt install mariadb-client
sudo apt install python3-mysqldb</span></pre>
</div>
<div id="prereq-debian-9" class="tab-content">
<p>Prerequisites for Debian 9 (Stretch), Raspbian 9, Ubuntu 16.04-17.10</p>
<pre class='tty'><span class="cmd">sudo apt update</span>
# Required
<span class="cmd">sudo apt install python3-configobj
sudo apt install python3-pil
sudo apt install python3-serial
sudo apt install python3-usb
# The following tests for distutils and installs if not present:
python3 -c "import distutils" 2>/dev/null || sudo apt install python3-distutils
# Install pip3 and cheetah3:
sudo apt install python3-pip
sudo pip3 install cheetah3</span>
# Optional: for extended almanac information
<span class="cmd">sudo apt install python3-ephem</span>
# Required if you are using MySQL (MariaDB):
<span class="cmd">sudo apt install mysql-client
sudo apt install python3-mysqldb</span></pre>
</div>
<div id="prereq-redhat-7-nomysql" class="tab-content">
<p>Prerequisites for Redhat 7, Centos 7, <em>not using MySQL</em>.</p>
<pre class="tty"><span class="cmd">sudo yum update</span>
# Ensure that Python 3 is installed:
<span class="cmd">sudo yum install python3</span>
# Required:
<span class="cmd">sudo pip3 install configobj
sudo pip3 install pillow
sudo pip3 install pyserial
sudo pip3 install pyusb
sudo pip3 install cheetah3</span>
# Optional: for extended almanac information
<span class="cmd">sudo pip3 install pyephem</span>
</pre>
</div>
<div id="prereq-redhat-7-mysql" class="tab-content">
<p>Prerequisites for Redhat 7, Centos 7, <em>using MySQL</em>. In this case, you should use Python 2.</p>
<pre class="tty"><span class="cmd">sudo yum update</span>
# Required:
<span class="cmd">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</span>
# Optional: for extended almanac information
<span class="cmd">sudo pip install pyephem</span>
</pre>
</div>
<div id="prereq-redhat-8" class="tab-content">
<p>Prerequisites for Redhat 8, Centos 8</p>
<pre class="tty"><span class="cmd">sudo yum update</span>
# Ensure that Python3 is installed:
<span class="cmd">sudo yum install python3</span>
# Required:
<span class="cmd">sudo yum install python3-configobj
sudo yum install python3-pillow
sudo yum install python3-pyserial
sudo yum install python3-pyusb
sudo pip3 install cheetah3</span>
# Optional: for extended almanac information
<span class="cmd">sudo pip3 install pyephem</span>
# Required if using MySQL:
<span class="cmd">sudo yum install python3-pymysql</span>
</pre>
</div>
<div id="prereq-suse" class="tab-content">
<p>Prerequisites for OpenSUSE. Tested on Leap 15.1</p>
<pre class="tty"><span class="cmd">sudo zypper update</span>
# Required:
<span class="cmd">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!</span>
# Optional: for extended almanac information
<span class="cmd">sudo pip3 install pyephem</span>
# Required if using MySQL / MariaDB:
<span class="cmd">sudo zypper install python3-mysqlclient</span></pre>
</div>
<h2>2. Download</h2>
<p>
Download the source archive <span class='code'>weewx-X.Y.Z.tar.gz</span> from <a
href="https://weewx.com/downloads"><span class="code">weewx.com/downloads</span></a>.
</p>
<h2>3. Install WeeWX</h2>
<p>After installing the prerequisites, you can install WeeWX itself.</p>
<ol>
<li>
<p>Expand the source archive:</p>
<pre class="tty cmd">tar xvfz weewx-X.Y.Z.tar.gz</pre>
</li>
<li>
<p>Change directory into the expanded archive:</p>
<pre class="tty cmd">cd weewx-X.Y.Z</pre>
</li>
<li>
<p>
To specify an install location different from the default <span class='code'>/home/weewx</span>, modify the
parameter <span class='code'>home</span> in the <span class='code'>setup.cfg</span> file. Mac users will
want to change it to <span class="code">/Users/Shared/weewx</span>.
</p>
</li>
<li>
<p>
Then build and install. Python 2 users: substitute <span class="code cmd">python2</span> for <span
class="code cmd">python3</span>.
</p>
<pre class="tty cmd">python3 ./setup.py build
sudo python3 ./setup.py install</pre>
</li>
</ol>
<h2>4. Run</h2>
<p>Run the main program directly:</p>
<pre class="tty cmd">cd /home/weewx
sudo ./bin/weewxd</pre>
<p>Or as a daemon automatically when the computer starts:</p>
<div id="startup-tabs" class='tabs'>
<nav>
<button class="tab" onclick="openTab(event, '#startup-debian')">
Debian <img src='images/logo-debian.png' class='thumbnail' alt="Debian logo"/> <img
src='images/logo-ubuntu.png' class='thumbnail' alt="Ubuntu logo"/> <img src='images/logo-mint.png'
class='thumbnail' alt="Mint logo"/>
</button>
<button class="tab" onclick="openTab(event, '#startup-redhat')">
Redhat <img src='images/logo-redhat.png' class='thumbnail' alt="Redhat logo"/> <img
src='images/logo-centos.png' class='thumbnail' alt="Centos logo"/> <img src='images/logo-fedora.png'
class='thumbnail'
alt="Fedora logo"/>
</button>
<button class="tab" onclick="openTab(event, '#startup-suse')">
SuSE <img src='images/logo-suse.png' class="thumbnail" alt="SUSE logo"/>
</button>
</nav>
<div id='startup-debian' class="tab-content">
<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' class="tab-content">
<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' class="tab-content">
<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>5. 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>6. 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 style="text-align:right;">executable:</td>
<td class='tty'>/home/weewx/bin/weewxd</td>
</tr>
<tr>
<td style="text-align:right;">configuration file:</td>
<td class='tty'>/home/weewx/weewx.conf</td>
</tr>
<tr>
<td style="text-align:right;">skins and templates:</td>
<td class='tty'>/home/weewx/skins/</td>
</tr>
<tr>
<td style="text-align:right;">sqlite databases:</td>
<td class='tty'>/home/weewx/archive/</td>
</tr>
<tr>
<td style="text-align:right;">generated web pages and images:</td>
<td class='tty'>/home/weewx/public_html/</td>
</tr>
<tr>
<td style="text-align:right;">documentation:</td>
<td class='tty'>/home/weewx/docs/</td>
</tr>
<tr>
<td style="text-align:right;">examples:</td>
<td class='tty'>/home/weewx/examples/</td>
</tr>
<tr>
<td style="text-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>
</body>
</html>