User Tools

Site Tools


weewx-arch

How to WeeWx on Arch Linux

So I've been trying out an odroid I have here with WeeWx weather and Arch Linux.

The reason I like the odroid U3 is that it's a powerful little board, meaning any updating jobs on it are done very quickly.

However, the board is best supported by Arch Linux. Arch Linux is different from the likes of Debian in that it's very cutting edge, updated very frequently and so on…

Lets get started

Just before we start, I have been trying this out, but the procedure may not quite a 100% (yet) so bare with me.

Also I'm using the simulator weather station for this, on the Arch Linux Wiki there is a WeeWx section that mentions about setting permissions on the USB ports, I've not yet tried this with a real weather station yet. So you may need to do something else at this point.

First get Arch linux installed on the SD card or eMMC or whatever your using. The instructions for this is on the Arch website. Just google the name of your board and then Arch Linux and you should find the download and procedure explained.

Get the board booted up and login with ssh.

First reset the root password

passwd

now set the hostname

hostnamectl set-hostname odroid

Time Zone

timedatectl set-timezone Europe/London

set locale:

edit /etc/locale.gen and unhash en_GB.UTF-8

localectl set-locale LANG=en_GB.UTF-8
local-gen
reboot

now when you type locale you should get GB

update the system

pacman -Syu
reboot

Install some needed packages for WeeWx

pacman -S base-devel freetype2 python2 python2-configobj python2-cheetah python2-pillow python2-imaging mlocate gcc python2-pip nfs-utils sqlite rsync python2-pyserial lighttpd

Now we need to do some symlinks because Arch uses python v3 and WeeWx needs python v2

ln -s /usr/include/freetype2 /usr/include/freetype
cd /usr/bin
ln -sf python2 python
ln -sf pip2 pip

Install pyephem

pip install pyephem

Now get the last version of pyusb for python2 from sourceforge

Extract it to /root then

cd /root
python setup.py install

Now copy over the Weewx Tarball to /root

cd /root
tar xvfz weewx-X.Y.Z.tar.gz
cd weewx-X.Y.Z
./setup.py build
./setup.py install

After this you need to alter where the website is written to in the weewx.conf

edit weewx.conf (which you'll find in /home/weewx/) and look down the file and change the HTML_ROOT to

HTML_ROOT = /srv/http

you may want to alter other stuff in there as well to suit your needs, all this is explained on Weewx docs website.

OK now we can test this to see if it works manually before going any further.

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

Hopefully if all has gone well you'll see data showing up on the screen. If you wait about 5 mins you should see the website gets built.

While your waiting let's open a new ssh terminal and get the webserver running properly.

systemctl start lighttpd
systemctl enable lighttpd

Now open your web browser and set it to the ip address you've been using for ssh and you should see your weather station.

Press ctrl C to kill the running weewx and let's see if we can run it as a background service.

Now we need to make a service file to run Weewx as a daemon.

Make a file called weewx.service

in this file put this code

[Unit]
Description=Daemon to control my Weewx weather station
#After=ntpdate.service

[Service]
ExecStart=/home/weewx/bin/weewxd /home/weewx/weewx.conf  > /dev/null
Type=simple

[Install]
WantedBy=multi-user.target

Place the new file here

/etc/systemd/system/weewx.service

now we need the board to run this service at startup so

systemctl start weewx
systemctl enable weewx
systemctl status weewx.service

you should see that it has a green dot and says active (running)

If you reboot and type systemctl status weewx.service again hopefully it ran at startup.

Now you probably want to see the logs as the weewx is running in the background to do that try each of these lines, they give a slight different output depending on what your looking for

journalctl
journalctl -f
journalctl -u weewx
journalctl -u weewx -f

The bottom one is probably the best.

Other than doing the website mods, which is described elsewhere, that's about it.

If you have any more info I could add/improve to this how to then email me from off my weather station site email address.

Thanks

Chris

weewx-arch.txt · Last modified: 1980/01/01 00:51 by chris