Installing thermd on Qnap 219P+


One big step to reduce the server power bill is the remove the server and replace it with a NAS with all the software needed to do (almost) everything the old server could do. I picked the QNAP 219P+ since I only need one disk, and QNAP have root ssh access out of the box.

Short how-to get thermd, owfs and a 1-wire logger running on the QNAP 219P+ NAS.

First install the Optware IPKG, download and unzip, then upload and install...

Enable the Optware IPKG.

Log in with ssh, username admin

cd /share/HDA_data/:qpkg/Optware

cp /etc/localtime etc/
cp /etc/protocols etc/
Install a lot of software needed later

ipkg install perl grep diffutils gawk m4 gettext

ipkg install perl-libwww

ipkg install tar gcc unzip make lynx ncftp gnupg perl-gd

ipkg install optware-devel

ipkg install sed

Create a link for ld in /opt/bin
cd /opt/bin
ln -s ld arm-none-linux-gnueabi-ld
Change cpan default dir for cashe and settings to something /opt in setup

install Perl modules from CPAN
cpan>install Config::General
cpan>install Digest::CRC
cpan>install LWP::UserAgent
cpan>install GD
cpan>install GD::Graph

export PATH=/opt/bin:$PATH

Download latest fuse and owfs, unpack in /opt/tmp
Compile fuse

./configure --prefix=/opt/bin
make install

And owfs
./configure --prefix=/opt/bin --with-fuseinclude=/opt/bin/include/fuse

make install

Create the dir for 1-wire
mkdir /mnt/1wire
Ant finally, start owfs

/opt/bin/bin/owfs -u /mnt/1wire

Check that it is working
more /mnt/1wire/28.*/temperature

Now you shuld se temperature readings from connected sensors.

So what modules do I have installed?

[~] # ipkg list_installed
apr - 1.3.12-1 - Apache Portable Runtime library
apr-util - 1.3.9-1 - Apache Portable Runtime utilities library
autoconf - 2.68-1 - Creating scripts to configure source code packages using templates
automake - 1.11.1-2 - Creates GNU standards-compliant Makefiles from template files
bash - 3.2.49-1 - A bourne style shell
binutils - 2.19.1-1 - The GNU assembler and linker and related tools
bison - 2.4.1-1 - a general-purpose parser generator that converts an annotated context-free grammar into an LALR(1) or GLR parser for that gramm
bzip2 - 1.0.6-1 - Very high-quality data compression program
cairo - 1.8.8-2 - Cairo is a vector graphics library with cross-device output support.
coreutils - 8.4-1 - Bunch of heavyweight *nix core utilities
cups - 1.4.6-1 - Common Unix Printing System
cyrus-sasl-libs - 2.1.23-2 - Provides client or server side authentication (see RFC 2222).
diffutils - 3.1-1 - contains gnu diff, cmp, sdiff and diff3 to display differences between and among text files
e2fslibs - 1.41.14-1 - Ext2 Filesystem Libraries
emacs22 - 22.3-1 - Emacs is the extensible, customizable, self-documenting real-time display editor.
expat - 2.0.1-1 - XML Parser library
file - 5.08-1 - Ubiquitous file identification utility.
findutils - 4.2.32-1 - File finding utilities
flex - 2.5.35-1 - Generates programs that perform pattern-matching on text.
fontconfig - 2.8.0-0 - Font configuration library
freetype - 2.3.6-1 - Free truetype library
gawk - 4.0.0-1 - Gnu AWK interpreter
gcc - 4.2.3-1 - The GNU Compiler Collection.
gconv-modules - 2.5-1 - Provides gconv modules missing from the firmware.  These are used by glibc iconv() implementation.
gdbm - 1.8.3-2 - GNU dbm is a set of database routines that use extensible hashing. It works similar to the standard UNIX dbm routines.
gettext - 0.14.5-2 - Set of tools for producing multi-lingual messages
ghostscript - 8.71-2 - An interpreter for the PostScript (TM) language
gnupg - 2.0.17-1 - GNU privacy guard - a free PGP replacement.
grep - 2.9-1 - Global regular expression parser
groff - 1.19.2-2 - front-end for the groff document formatting system
gzip - 1.2.4a-4 - GNU Zip data compression program
imagemagick - - A set of image processing utilities.
libassuan - 2.0.1-1 - Libassuan is the IPC library used by some GnuPG related software.
libc-dev - 2.5-5 - libc development files.
libcurl - 7.21.7-1 - Curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FI
libdb - 4.2.52-3 - Berkeley DB Libraries
libgcrypt - 1.5.0-1 - GNU cryptography libray, needed by gnutls
libgd - 2.0.35-6 - An ANSI C library for the dynamic creation of images
libgpg-error - 1.10-1 - Error handling library for libgcrypt
libidn - 1.21-1 - GNU Libidn is an implementation of the Stringprep, Punycode and IDNA specifications defined by the IETF Internationalized Domai
libjpeg - 6b-3 - collection of jpeg tools
libksba - 1.0.3-1 - Libksba is a CMS and X.509 access library.
liblcms - 1.19-1 - A small-footprint, speed optimized color management engine.
libnsl - 2.5-4 - Network Services Library
libpng - 1.2.44-1 - Portable Network Graphics Libraries
libpth - 2.0.7-2 - Pth is a very portable POSIX/ANSI-C based library for Unix platforms which provides non-preemptive priority-based scheduling fo
libstdc++ - 6.0.9-6 - Standard C++ library, needed for dynamically linked C++ programs
libtiff - 3.9.5-1 - Tag Image File Format Libraries
libtool - 1.5.26-1 - Library tools.
libusb - 0.1.12-2 - Library for interfacing to the USB subsystem.
libxml2 - 2.7.8-1 - Libxml2 is the XML C parser and toolkit developed for the Gnome project.
lynx - 2.8.6-1 - A text browser for the World Wide Web
m4 - 1.4.16-1 - gnu macro processor and compiler front end
make - 3.82-1 - examines files and runs commands necessary for compilation
md5deep - 3.9.1-1 - md5deep is a cross-platform set of programs to compute MD5, SHA-1, SHA-256 Tiger, or Whirlpool message digests on an arbitrary
ncftp - 3.2.4-1 - Nice command line FTP client
ncurses - 5.7-1 - NCurses libraries
ncursesw - 5.7-1 - NCurses libraries with wide char support
neon - 0.29.3-1 - an HTTP and WebDAV client library, with a C interface
openldap-libs - 2.3.43-2 - Open Lightweight Directory Access Protocol
openssl - 0.9.8p-1 - Openssl provides the ssl implementation in libraries libcrypto and libssl, and is needed by many other applications and librari
optware-devel - 6.8-10 - This is a meta package that bundles all the packages required for optware native development.  When fully functional, it should
patch - 2.6.1-1 - applies a diff to produce a patched file
pcre - 8.13-1 - Perl-compatible regular expression library
perl - 5.10.0-6 - Practical Extraction and Report Language.
perl-compress-zlib - 1.42-3 - Compress-Zlib - Interface to zlib compression library.
perl-gd - 2.35-2 - GD - Interface to Gd Graphics Library
perl-html-parser - 3.60-1 - A collection of modules that parse and extract information from HTML documents.
perl-html-tagset - 3.04-4 - This module contains data tables useful in dealing with HTML.
perl-libwww - 5.825-1 - libwww-perl - The World-Wide Web library for Perl
perl-uri - 1.35-3 - URI - <module_description>
pinentry - 0.8.0-1 - A collection of simple PIN or passphrase entry dialogs
pixman - 0.15.14-1 - a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization
pkgconfig - 0.15.0-2 - Package configuration tool
psmisc - 22.13-1 - A set of some small useful utilities that use the proc filesystem.
python25 - 2.5.6-1 - Python is an interpreted, interactive, object-oriented programming language.
re2c - 0.13.5-1 - re2c is a tool for writing very fast and very flexible scanners.
readline - 6.1-2 - The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are
rsync - 3.0.8-1 - fast remote file copy program (like rcp)
sed - 4.2.1-1 - Stream editor.
sqlite - 3.7.3-1 - SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.
svn - 1.6.15-1 - a compelling replacement for CVS
tar - 1.25-1 - heavyweight version of the Tape ARchiver
tcl - 8.4.19-2 - The Tool Command Language
unzip - 6.0-2 - A (de)compression library for the ZIP format
wget-ssl - 1.12-2 - A network utility to retrieve files from the Web
x11 - 6.2.1+cvs20050209-3 - X protocol library
xau - 0.1.1+cvs20050130-2 - X authorization library
xdmcp - 0.1.3+cvs20050130-2 - XDMCP protocol library
xrender - 0.8.4+cvs20050130-4 - X render extension library
zlib - 1.2.5-1 - zlib is a library implementing the 'deflate' compression system.

Now the 1-wire part is working, only thermd left!

Cd to /opt/bin, then download latest thermd, wget I got v2.83, Chmod it a+x. Change the path to perl on the first line to #!/opt/bin/perl. Hard-link to a thermd.cgi in cgi-bin dir, in my case i put it in "/share/Web/cgi-bin".

change the log file location to /opt/var/log/thermd
change PID file and RSS locations.

Check that thermd is OK with everything,
/opt/bin/thermd -config /opt/etc/thermd.conf --checkconfig

if there is no errors, stard the daemon,
/opt/bin/thermd -config /opt/etc/thermd.conf --daemon