Configuring wview for Ubuntu 12.04

I had a number of challenges getting wview 5.20.1 setup with Ubuntu 12.04 Desktop 32-bit and figured I’d share them in case it helps others.

My setup involves one that is probably similar to many who have a local system collecting the data from your weather station and uploading it to a hosting provider.  I happen to own the server as well, but the concepts will be the same.  Some of the items below are for getting my particular brand of weather station (a very inexpensive Oregon Scientific WMR100N).  I’ve tried to mark them so you’ll know if you should do something different for your station.

My setup was pristine in that I was also creating the Ubuntu desktop system from scratch at the same time.  If you’re doing something similar, these steps should make sense.

1. Install Ubuntu 12.04 LTS Desktop 32-bit.  I used the pendrive linux solution and found it worked exactly as advertised.
2. Updated all packages (>300).  I started this in the background while performing some of the other steps.  I happened to use the GUI at this point but you could do the same from the command line by doing:

sudo apt-get update
sudo apt-get upgrade

3. Add the apt package locations per wview manual to /etc/apt/sources.list.  I guessed that Ubuntu 12 versions (known as precise penguin) existed, but they didn’t.  It turned out this worked anyway as the package repository points penguin requests back to natty (the version of wview that does exist.)  Open the file for editing:

sudo vi /etc/apt/sources.list

…and add the following lines to the bottom of the file…

## wview packages
deb http://www.wviewweather.com/apt/precise precise main
deb-src http://www.wviewweather.com/apt/precise precise main

4. Create user group weather, and put the logged on user into that group.

sudo addgroup weather
sudo addgroup [username] weather

5. At this point I had to create a udev rule for weather station, my WMR100 which connects via USB in a unique manner.  You have to be able to tell wview what device it uses and I think it’s easy to create a udev rule and make it friendly to find.  So open a new rules file like this:

sudo vi /etc/udev/rules.d/10-weather-station.rules

…and put this into the file…

# udev rule to find the WMR100 and add link and proper permissions

ACTION!=”add|change”, GOTO=”station_end”
SUBSYSTEM==”usb”, ATTR{idProduct}==”ca01”, MODE=”0666”, NAME=”oswmr100”, GROUP=”weather”, SYMLINK+=”wmr100”

LABEL=”station_end”

What this does, is it looks for an add or a change from the USB subsytem and if it finds the product ID of the WMR100 (that <code>ca01</code> part) it creates the friendly name, puts it into the weather group (although I’m not sure this is entirely needed now that I think about it), gives everybody read permissions, and creates a couple of names.  After creating this file, you should plug in your station and verify that the oswmr100 and wmr100 devices show up in /dev and that they have the right permissions and group.

6. Update the apt respository and install wview.  If the command you executed earlier to update the entire system is still running (and it might be, there are over 300 updates after all) you’ll have to wait for that to finish before this will run.

sudo apt-get update
sudo apt-get install wview

Note, this automatically installs apache2, php5, sqlite3 as prerequisites.  If I had to guess I’d say that you could get away without apache and php if you know for a fact you’ll never use the web gui for either configuration or display.  I liked the fact that I can use the web gui for configuration and a quick status update whenever I’m not sure what is going on.

7. For some reason, with wview version 5.20.1 and Ubuntu 12.04 mod-php5 is not loaded.  Perhaps this is because of something new in Ubuntu 12.04, but in any case, do that now.

sudo apt-get install libapache2-mod-php5

8. At this point, I decided to reboot and let all those updates take effect.

9. Unique to Ubuntu, which lacks a root account by default, you need to configure SSH correctly so that the wview SSH upload feature works correctly.  This means temporarily enabling the root account, setting up ssh to your target system, then disabling it.  Thanks to simonstl on the wview forums for this.

First, generate keys for your logged in user account. Select the defaults for all the questions, including leaving the passphrase blank. This could be a security hole, but it is required if you want programs (like wview) to be able to connect
to an SSH server without having to use a passphrase.

ssh-keygen -t rsa

Next, copy the generated key to the target system and add it to the authorized_keys2 file for that account (belongs in ~/.ssh/authorized_keys2.)  If that system doesn’t have an authorized keys file yet, it is OK to just copy it in new like I am doing here.  Otherwise, copy the .pub file over to a temporary location and then cat it into the existing ~/.ssh/authorized_keys2 file as we do below for root.

scp .ssh/id_rsa.pub <sshuser>@<targetnode>:~/.ssh/authorized_keys2

Test that this worked by doing an SSH to the target node – you should not be prompted for a password.  If you are, something didn’t work right.

Finally, we can get on with doing the same for the root account. Strat by creating a root password:

sudo passwrd root

Login as root for the next steps.

su

CAREFUL: you are now root, lots of bad things can be done now accidentally.

Change to the root home directory and create the ssh keys. Again, select the defaults for all questions and especially leave the passphrase blank.

cd ~
ssh-keygen -t rsa

Copy the root ssh public key to the target node. Replace sshuser if your normal logon account, and targetnode with the name of the ssh/web server.

scp .ssh/id_rsa.pub [sshuser]@[targetnode]:~/.ssh/root-id_rsa.pub

Finally, connect to the target node and cat this new key alongside the existing key(s). I’m not going to show how to do that exactly because I don’t know what your exact setup is. However, it is something like:

cd ~/.ssh
cat authorized_keys2 root-id_rsa.pub > new-authorized_keys2
rm authorized_keys2
mv new-authorized_keys2 authorized_keys2

Back at the wview station, ssh into the node in order to prove your keys are working right. Again, if you’re prompted for a password something isn’t right.  Check the authorized_keys2 file to ensure it has the right keys in it (it is a text file.)

Finally, we exit out of root su mode, then disable the root password and return to normal Ubuntu operation.

sudo passwd -dl root

To check out the settings, connect to wview manager (web) and configure it. http://localhost/wviewmgmt/login.php

Remember, the default password is wview.  You should probably change that immediately.

I had to change ssh source directory to /var/wview/img as the default did not work on Ubuntu. That’s the SSH->Source File or Directory setting. Other than this, the setup is complete.

Leave a Reply

Your email address will not be published. Required fields are marked *